<%@LANGUAGE="VBSCRIPT"%> <% If UploadFormRequest("MM_insert") <> "" AND UploadFormRequest("CatID") = "" THEN Response.write(" Please go back and choose a category") Response.End() END IF %> <% '*** Pure ASP File Upload 2.1.3 Dim GP_uploadAction,UploadQueryString PureUploadSetup If (CStr(Request.QueryString("GP_upload")) <> "") Then Dim pau_thePath,pau_Extensions,pau_Form,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout,pau_progressBar,pau_progressWidth,pau_progressHeight pau_thePath = """../cgi-bin/mypics/"" & Session(""Username"") & ""/""& UploadFormRequest(""CatID"")" pau_Extensions = "GIF,JPG,JPEG,BMP,PNG" pau_Form = "form1" pau_Redirect = "" pau_storeType = "file" pau_sizeLimit = "" pau_nameConflict = "over" pau_requireUpload = "true" pau_minWidth = "" pau_minHeight = "" pau_maxWidth = "" pau_maxHeight = "" pau_saveWidth = "width" pau_saveHeight = "hieght" pau_timeout = "600" pau_progressBar = "showProgress.htm" pau_progressWidth = "300" pau_progressHeight = "100" Dim RequestBin, UploadRequest CheckPureUploadVersion 2.13 ProcessUpload pau_thePath,pau_Extensions,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout end if %> <% Dim rsSettings Dim rsSettings_numRows Set rsSettings = Server.CreateObject("ADODB.Recordset") rsSettings.ActiveConnection = MM_mygallery_STRING rsSettings.Source = "SELECT * FROM Settings" rsSettings.CursorType = 0 rsSettings.CursorLocation = 2 rsSettings.LockType = 1 rsSettings.Open() rsSettings_numRows = 0 %> <% ' *** Smart Image Processor 1.1.1 If (CStr(Request.QueryString("GP_upload")) <> "") Then Dim RUF_Component, RUF_DotNetResize, RUF_ResizeImages, RUF_AspectImages, RUF_maxWidth, RUF_maxHeight, RUF_Quality, RUF_MakeThumb, RUF_AspectThumb, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, RUF_RedirectURL RUF_Component = "AUTO" RUF_DotNetResize = "ScriptLibrary/ResizeImage.aspx" RUF_ResizeImages = true RUF_AspectImages = true RUF_maxWidth = rsSettings.Fields.Item("LargeWidth").Value RUF_maxHeight = rsSettings.Fields.Item("LargeHieght").Value RUF_Quality = rsSettings.Fields.Item("Picquality").Value RUF_MakeThumb = true RUF_AspectThumb = true RUF_Suffix = "_small" RUF_maxWidthThumb = rsSettings.Fields.Item("ThumbWidth").Value RUF_maxHeightThumb = rsSettings.Fields.Item("ThumbHieght").Value RUF_QualityThumb = rsSettings.Fields.Item("Thumbquality").Value RUF_RedirectURL = "" if RUF_ResizeImages then ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, "", RUF_maxWidth, RUF_maxHeight, RUF_Quality, true, pau_saveWidth, pau_saveHeight, RUF_AspectImages, pau_nameConflict end if if RUF_MakeThumb then ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, false, pau_saveWidth, pau_saveHeight, RUF_AspectThumb, pau_nameConflict end if if RUF_RedirectURL <> "" then Response.Redirect RUF_RedirectURL end if end if %> <% IF Session("Loggedin") = "" THEN Response.redirect("list.asp") END IF %> <% ' *** Edit Operations: (Modified for File Upload) declare variables MM_editAction = CStr(Request.ServerVariables("URL")) 'MM_editAction = CStr(Request("URL")) If (UploadQueryString <> "") Then MM_editAction = MM_editAction & "?" & UploadQueryString End If ' boolean to abort record edit MM_abortEdit = false ' query string to execute MM_editQuery = "" %> <% ' *** Insert Record: (Modified for File Upload) set variables If (CStr(UploadFormRequest("MM_insert")) <> "") Then MM_editConnection = MM_mygallery_STRING MM_editTable = "Pictures" MM_editRedirectUrl = "addnew.asp" MM_fieldsStr = "Image|value|Description|value|CatID|value|User|value|hieght|value|width|value" MM_columnsStr = "Image|',none,''|Description|',none,''|CatID|none,none,NULL|UserID|none,none,NULL|Hieght|none,none,NULL|Width|none,none,NULL" ' create the MM_fields and MM_columns arrays MM_fields = Split(MM_fieldsStr, "|") MM_columns = Split(MM_columnsStr, "|") ' set the form values For i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_fields(i+1) = CStr(UploadFormRequest(MM_fields(i))) Next ' append the query string to the redirect URL If (MM_editRedirectUrl <> "" And UploadQueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString End If End If End If %> <% ' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it If (CStr(UploadFormRequest("MM_insert")) <> "") Then ' create the sql insert statement MM_tableValues = "" MM_dbValues = "" For i = LBound(MM_fields) To UBound(MM_fields) Step 2 FormVal = MM_fields(i+1) MM_typeArray = Split(MM_columns(i+1),",") Delim = MM_typeArray(0) If (Delim = "none") Then Delim = "" AltVal = MM_typeArray(1) If (AltVal = "none") Then AltVal = "" EmptyVal = MM_typeArray(2) If (EmptyVal = "none") Then EmptyVal = "" If (FormVal = "") Then FormVal = EmptyVal Else If (AltVal <> "") Then FormVal = AltVal ElseIf (Delim = "'") Then ' escape quotes FormVal = "'" & Replace(FormVal,"'","''") & "'" Else FormVal = Delim + FormVal + Delim End If End If If (i <> LBound(MM_fields)) Then MM_tableValues = MM_tableValues & "," MM_dbValues = MM_dbValues & "," End if MM_tableValues = MM_tableValues & MM_columns(i) MM_dbValues = MM_dbValues & FormVal Next MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")" If (Not MM_abortEdit) Then ' execute the insert Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% Dim rsCat__MMColParam rsCat__MMColParam = "1" If (Session("UserID") <> "") Then rsCat__MMColParam = Session("UserID") End If %> <% set rsCat = Server.CreateObject("ADODB.Recordset") rsCat.ActiveConnection = MM_mygallery_STRING rsCat.Source = "SELECT * FROM Category WHERE UserID = " + Replace(rsCat__MMColParam, "'", "''") + " ORDER BY CatID DESC" rsCat.CursorType = 0 rsCat.CursorLocation = 2 rsCat.LockType = 3 rsCat.Open() rsCat_numRows = 0 %> <% Dim rsPicCount__MMColParam rsPicCount__MMColParam = "1" If (Session("UserID") <> "") Then rsPicCount__MMColParam = Session("UserID") End If %> <% Dim rsPicCount Dim rsPicCount_numRows Set rsPicCount = Server.CreateObject("ADODB.Recordset") rsPicCount.ActiveConnection = MM_mygallery_STRING rsPicCount.Source = "SELECT * FROM Piccountmax WHERE UserID = " + Replace(rsPicCount__MMColParam, "'", "''") + "" rsPicCount.CursorType = 0 rsPicCount.CursorLocation = 2 rsPicCount.LockType = 1 rsPicCount.Open() rsPicCount_numRows = 0 %> Add New Photo
<% If Session("UserID") = "1" Then %> <% End If%>
<% If Not rsPicCount.EOF Or Not rsPicCount.BOF Or Session("UserID") = "1" THEN%>

<%=Session("Username")%>

Image:
Description:
Category: ">
 
<%ELSE%> You have reached the maximum allowed pictures.
You cannot upload any more.
<% End If %>

 

Back to list - Manage categories - View Gallery

 

 

v5.0

'My ASP Thumbnail Gallery' is a product of Kattouf Internet Services Email: johnny@kattouf.com

<% rsCat.Close() %> <% rsPicCount.Close() Set rsPicCount = Nothing %> <% rsSettings.Close() Set rsSettings = Nothing %>