Modificare il file:
\iwgallery\pictures\inc_details.asp
<% If (strPrivate = 1 AND Request.Cookies("IWGalleryUserName") = "") Then Response.Redirect("../home/") %> <SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT> function Thumbnail(tmb_suff,tmb_filename) Dim tmb_NewFilename, tmb_Path, tmb_PosPath, tmb_PosExt if not isnull(tmb_filename) then tmb_PosPath = InStrRev(tmb_filename,"/") tmb_Path = "" if tmb_PosPath > 0 then tmb_Path = mid(tmb_filename,1,tmb_PosPath) end if tmb_PosExt = InStrRev(tmb_filename,".") if tmb_PosExt > 0 then tmb_NewFilename = tmb_Path & mid(tmb_filename,tmb_PosPath+1,tmb_PosExt-(tmb_PosPath+1)) & tmb_suff & ".jpg" else tmb_NewFilename = tmb_Path & mid(tmb_filename,tmb_PosPath+1,len(tmb_filename)-tmb_PosPath) & tmb_suff & ".jpg" end if end if Thumbnail = tmb_NewFilename end function </SCRIPT> <!--#include virtual="/iwgallery/Connections/connIWGallery.asp" --> <% ' *** Edit Operations: declare variables Dim MM_editAction Dim MM_abortEdit Dim MM_editQuery Dim MM_editCmd Dim MM_editConnection Dim MM_editTable Dim MM_editRedirectUrl Dim MM_editColumn Dim MM_recordId Dim MM_fieldsStr Dim MM_columnsStr Dim MM_fields Dim MM_columns Dim MM_typeArray Dim MM_formVal Dim MM_delim Dim MM_altVal Dim MM_emptyVal Dim MM_i MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString) End If ' boolean to abort record edit MM_abortEdit = false ' query string to execute MM_editQuery = "" %> <% ' *** Insert Record: set variables If (CStr(Request("MM_insert")) = "form1") Then MM_editConnection = MM_connIWGallery_STRING MM_editTable = "RATES" MM_editRedirectUrl = "details.asp" MM_fieldsStr = "iRating|value|iPicture|value" MM_columnsStr = "RAT_VALUE|none,none,NULL|RAT_PICTURE|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 MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i))) Next ' append the query string to the redirect URL If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If End If %> <% ' *** Insert Record: construct a sql insert statement and execute it Dim MM_tableValues Dim MM_dbValues If (CStr(Request("MM_insert")) <> "") Then ' create the sql insert statement MM_tableValues = "" MM_dbValues = "" For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_formVal = MM_fields(MM_i+1) MM_typeArray = Split(MM_columns(MM_i+1),",") MM_delim = MM_typeArray(0) If (MM_delim = "none") Then MM_delim = "" MM_altVal = MM_typeArray(1) If (MM_altVal = "none") Then MM_altVal = "" MM_emptyVal = MM_typeArray(2) If (MM_emptyVal = "none") Then MM_emptyVal = "" If (MM_formVal = "") Then MM_formVal = MM_emptyVal Else If (MM_altVal <> "") Then MM_formVal = MM_altVal ElseIf (MM_delim = "'") Then ' escape quotes MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'" Else MM_formVal = MM_delim + MM_formVal + MM_delim End If End If If (MM_i <> LBound(MM_fields)) Then MM_tableValues = MM_tableValues & "," MM_dbValues = MM_dbValues & "," End If MM_tableValues = MM_tableValues & MM_columns(MM_i) MM_dbValues = MM_dbValues & MM_formVal Next MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")" If (Not MM_abortEdit) Then ' crea il cookie Response.Cookies("Picture" & Request.Form("iPicture")) = "1" Response.Cookies("Picture" & Request.Form("iPicture")).Expires = Date() + 300 ' 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 %> <% if(Request.QueryString("iPicture") <> "") then cmdDetailsHits__iPicture = Request.QueryString("iPicture") %> <% Dim rsDetails__iPicture rsDetails__iPicture = "0" If (Request.QueryString("iPicture") <> "") Then rsDetails__iPicture = Request.QueryString("iPicture") End If %> <% set rsDetails = Server.CreateObject("ADODB.Recordset") rsDetails.ActiveConnection = MM_connIWGallery_STRING rsDetails.Source = "SELECT * FROM PICTURES, CATEGORIES, USERS WHERE PIC_CATEGORY = CAT_ID AND PIC_USER = USE_NAME AND PIC_ID = " + Replace(rsDetails__iPicture, "'", "''") + " AND CAT_ACTIVE = 1 AND PIC_APPROVED = 1 AND PIC_ACTIVE = 1" rsDetails.CursorType = 0 rsDetails.CursorLocation = 2 rsDetails.LockType = 3 rsDetails.Open() rsDetails_numRows = 0 %> <% Dim rsRating__iPicture rsRating__iPicture = "0" If (Request.QueryString("iPicture") <> "") Then rsRating__iPicture = Request.QueryString("iPicture") End If %> <% Set rsRating = Server.CreateObject("ADODB.Recordset") rsRating.ActiveConnection = MM_connIWGallery_STRING rsRating.Source = "SELECT COUNT(*) AS RATES, AVG(RAT_VALUE) AS RATED FROM RATES WHERE RAT_PICTURE = " + Replace(rsRating__iPicture, "'", "''") + "" rsRating.CursorType = 0 rsRating.CursorLocation = 2 rsRating.LockType = 1 rsRating.Open() If rsRating.Fields.Item("RATES") = 0 Then iRates = 0 iRated = 0 Else iRates = rsRating.Fields.Item("RATES") iRated = rsRating.Fields.Item("RATED") End If %> <% ' tom-muck.com Set up the detail page navigation suite Dim tfm_rsDetails,tfm_rsDetails_query,tfm_rsDetails_PIC_ID Dim prev_tfm_rsDetails,next_tfm_rsDetails Dim tfm_prev_link_rsDetails,tfm_next_link_rsDetails,tfm_first_link_rsDetails,tfm_last_link_rsDetails tfm_rsDetails_PIC_ID = Replace(CStr(Request("iPicture")),"'","''") If tfm_rsDetails_PIC_ID = "" Then tfm_rsDetails_PIC_ID = 0 If Asc(tfm_rsDetails_PIC_ID) < 48 Or Asc(tfm_rsDetails_PIC_ID) > 57 Then tfm_rsDetails_PIC_ID = 0 Set tfm_rsDetails_conn = Server.CreateObject("ADODB.Connection") tfm_rsDetails_conn.Open MM_connIWGallery_STRING %> <% ' tom-muck.com find the first and previous record numbers tfm_rsDetails_query = "SELECT MIN(PIC_ID) as FirstRecord, MAX(PIC_ID) as PrevRecord FROM PICTURES WHERE PIC_APPROVED = 1 AND PIC_ACTIVE = 1 AND PIC_CATEGORY = " & Request.QueryString("iCat") & " AND PIC_ID < " & tfm_rsDetails_PIC_ID Set tfm_rsDetails = Server.CreateObject("ADODB.Recordset") tfm_rsDetails.Open tfm_rsDetails_query, tfm_rsDetails_conn, 1, 1 If Not tfm_rsDetails.EOF Then first_tfm_rsDetails = tfm_rsDetails.getRows() tfm_first_link_rsDetails = first_tfm_rsDetails(0,0) tfm_prev_link_rsDetails = first_tfm_rsDetails(1,0) End If %> <% ' tom-muck.com find the next and last record numbers tfm_rsDetails_query = "SELECT MIN(PIC_ID) as NextRecord, MAX(PIC_ID) as LastRecord FROM PICTURES WHERE PIC_APPROVED = 1 AND PIC_ACTIVE = 1 AND PIC_CATEGORY = " & Request.QueryString("iCat") & " AND PIC_ID > " & tfm_rsDetails_PIC_ID Set tfm_rsDetails = Server.CreateObject("ADODB.Recordset") tfm_rsDetails.Open tfm_rsDetails_query, tfm_rsDetails_conn, 1, 1 If Not tfm_rsDetails.EOF Then next_tfm_rsDetails = tfm_rsDetails.getRows() tfm_next_link_rsDetails = next_tfm_rsDetails(0,0) tfm_last_link_rsDetails = next_tfm_rsDetails(1,0) End If %> <% ' tom-muck.com close and destroy the recordset tfm_rsDetails.close() Set tfm_rsDetails = Nothing %> <% set cmdDetailsHits = Server.CreateObject("ADODB.Command") cmdDetailsHits.ActiveConnection = MM_connIWGallery_STRING cmdDetailsHits.CommandText = "UPDATE PICTURES SET PIC_HITS = PIC_HITS + 1 WHERE PIC_ID = " + Replace(cmdDetailsHits__iPicture, "'", "''") + "" cmdDetailsHits.CommandType = 1 cmdDetailsHits.CommandTimeout = 0 cmdDetailsHits.Prepared = true cmdDetailsHits.Execute() %> <script language="javascript" src="../ScriptLibrary/OpenImage.js"></script> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="box"> <tr> <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="1" align="left" class="box-header"><img src="../themes/<%= strTheme %>/box-header-left.jpg" alt="Box Left"></td> <td width="100%" class="box-header"><a href="default.asp">Immagini</a> › <% FillArray 'Response.Write "" For i = UBound(arrayId) to 0 Step - 1 If NOT arrayId(i) = "" then Response.Write "<a href=""cat.asp?iCat=" & arrayId(i) & """>"& (arrayName(i)) & "</a> › " End If Next 'Response.Write "" %></td> <td width="1" align="right" class="box-header"><img src="../themes/<%= strTheme %>/box-header-right.jpg" alt="Box Right"></td> </tr> </table></td> </tr> <tr> <td align="left" valign="top" class="box-main"><% If rsDetails.EOF And rsDetails.BOF Then %> <table width="100%" border="0" cellspacing="1" cellpadding="0" class="content"> <tr> <td>Spiacente, l'immagine che cercavi non è disponibile...</td> </tr> </table> <% End If ' end rsDetails.EOF And rsDetails.BOF %> <% If Not rsDetails.EOF Or Not rsDetails.BOF Then %> <table width="100%" border="0" cellspacing="1" cellpadding="0" class="content"> <tr> <td><strong>File</strong>: <a href="download.asp?file=<%=(rsDetails.Fields.Item("PIC_FILE").Value)%>" title="Scarica l'immagine"><%=(rsDetails.Fields.Item("PIC_FILE").Value)%></a> (<%= GetFileSize(rsDetails.Fields.Item("PIC_FILE").Value) %> KB) </td> <td align="right"><strong>Data</strong>: <%=(rsDetails.Fields.Item("PIC_DATED").Value)%></td> </tr> <tr> <td><strong>Autore</strong>: <span class="evidence"><%=(rsDetails.Fields.Item("USE_NAME").Value)%></span> <% If (rsDetails.Fields.Item("USE_PUBLIC").Value) = 1 Then %> <a href="mailto:<%=(rsDetails.Fields.Item("USE_EMAIL").Value)%>"><img src="../images/icon_mail_0.gif" alt="Scrivi" border="0" align="absmiddle"></a> <% End If %> </td> <td align="right"><strong>Giudizio</strong>: <% If iRated = 0 Then Response.write("-") Else %> <% For i = 1 to Fix(iRated) %> <img src="../images/icon_star.gif" align="absmiddle"> <% Next %> <% If (FormatNumber((iRated), -1, 0, -2, -2) - Fix(iRated)) >= 0.5 Then Response.Write("½") Else Response.Write("")%> <% End If %></td> </tr> <tr> <td><strong>Clicks</strong>: <%=(rsDetails.Fields.Item("PIC_HITS").Value)%></td> <td align="right"><strong>Votanti</strong>: <%= iRates %></td> </tr> <% Dim imgWidth, imgHeight, imgPercent, imgFixWidth, imgFixHeight imgWidth = rsDetails.Fields.Item("PIC_WIDTH").Value imgHeight = rsDetails.Fields.Item("PIC_HEIGHT").Value If rsDetails.Fields.Item("PIC_WIDTH").Value > 320 Then imgFixWidth = 320 Else imgFixWidth = rsDetails.Fields.Item("PIC_WIDTH").Value End If imgPercent = (imgFixWidth/imgWidth) imgFixHeight= (imgHeight*imgPercent) %> </table> <br> <form name="form1" method="POST" action="<%=MM_editAction%>"> <table width="320" border="0" align="center" cellpadding="0" cellspacing="1" class="inside"> <tr> <td width="33%" align="left" nowrap><a href="../pictures/details.asp?iPicture=<%= tfm_prev_link_rsDetails %>&iCat=<%=(rsDetails.Fields.Item("PIC_CATEGORY").Value)%>"> <%If tfm_prev_link_rsDetails <> "" Then %> ‹ Precedente <% End If ' end tfm_prevrsDetails link %> </a></td> <td align="center" nowrap> | <%=(rsDetails.Fields.Item("PIC_WIDTH").Value)%> x <%=(rsDetails.Fields.Item("PIC_HEIGHT").Value)%> | </td> <td width="33%" align="right" nowrap><a href="../pictures/details.asp?iPicture=<%= tfm_next_link_rsDetails %>&iCat=<%=(rsDetails.Fields.Item("PIC_CATEGORY").Value)%>"> <%If tfm_next_link_rsDetails <> "" Then %> Successiva › <% End If ' end tfm_nextrsDetails link %> </a></td> </tr> <tr align="center"> <td colspan="3"><a href="javascript:OpenImage('<%= strPublicPath %>/<%=(rsDetails.Fields.Item("PIC_FILE").Value)%>')"><img src="<%= strPublicPath %>/<%=(rsDetails.Fields.Item("PIC_FILE").Value)%>" alt="Clicca per l'immagine a dimensioni reali" width="<%= imgFixWidth %>" height="<%= imgFixHeight %>" border="0"></a></td> </tr> <tr align="center"> <td colspan="3"><%=TrimBody(rsDetails.Fields.Item("PIC_DESCRIPTION").Value)%></td> </tr> <% If Len((rsDetails.Fields.Item("PIC_URL").Value)) > 10 Then %> <tr align="center"> <td colspan="3" nowrap><strong>Link</strong>: <a href="<%=(rsDetails.Fields.Item("PIC_URL").Value)%>" target="_blank"><%=(rsDetails.Fields.Item("PIC_URL").Value)%></a></td> </tr> <% End If %> <% If Request.Cookies("Picture" & Request.QueryString("iPicture")) = "" Then %> <tr align="center"> <td colspan="3"><select name="iRating" id="iRating"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <input type="submit" name="Submit" value="Vota" class="button"> <input name="iPicture" type="hidden" id="iPicture" value="<%=(rsDetails.Fields.Item("PIC_ID").Value)%>"></td> </tr> <% End If %> </table> <input type="hidden" name="MM_insert" value="form1"> </form> <% End If ' end Not rsDetails.EOF Or NOT rsDetails.BOF %> </td> </tr> <tr> <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="1" align="left" class="box-bottom"><img src="../themes/<%= strTheme %>/box-bottom-left.jpg"></td> <td width="100%" class="box-bottom"><img src="../images/shim.gif" width="1" height="1"></td> <td width="1" align="right" class="box-bottom"><img src="../themes/<%= strTheme %>/box-bottom-right.jpg"></td> </tr> </table></td> </tr> </table> <% rsDetails.Close() Set rsDetails = Nothing %> <% rsRating.Close() Set rsRating = Nothing %>
[
Íàçàä
]