home *** CD-ROM | disk | FTP | other *** search
/ 221.214.14.186 / 221.214.14.186.tar / 221.214.14.186 / wh / lyb / photodiaryFix.asp < prev    next >
Text File  |  2008-04-03  |  15KB  |  297 lines

  1. <%@LANGUAGE="VBSCRIPT"%>
  2. <%
  3. ' *** Logout the current user.
  4. MM_Logout = CStr(Request.ServerVariables("URL")) & "?MM_Logoutnow=1"
  5. If (CStr(Request("MM_Logoutnow")) = "1") Then
  6.   Session.Contents.Remove("MM_Username")
  7.   Session.Contents.Remove("MM_UserAuthorization")
  8.   MM_logoutRedirectPage = "photodiary.asp"
  9.   ' redirect with URL parameters (remove the "MM_Logoutnow" query param).
  10.   if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariables("URL"))
  11.   If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
  12.     MM_newQS = "?"
  13.     For Each Item In Request.QueryString
  14.       If (Item <> "MM_Logoutnow") Then
  15.         If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
  16.         MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
  17.       End If
  18.     Next
  19.     if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
  20.   End If
  21.   Response.Redirect(MM_logoutRedirectPage)
  22. End If
  23. %>
  24. <!--#include file="Connections/lyb.asp" -->
  25. <%
  26. ' *** Edit Operations: declare variables
  27.  
  28. Dim MM_editAction
  29. Dim MM_abortEdit
  30. Dim MM_editQuery
  31. Dim MM_editCmd
  32.  
  33. Dim MM_editConnection
  34. Dim MM_editTable
  35. Dim MM_editRedirectUrl
  36. Dim MM_editColumn
  37. Dim MM_recordId
  38.  
  39. Dim MM_fieldsStr
  40. Dim MM_columnsStr
  41. Dim MM_fields
  42. Dim MM_columns
  43. Dim MM_typeArray
  44. Dim MM_formVal
  45. Dim MM_delim
  46. Dim MM_altVal
  47. Dim MM_emptyVal
  48. Dim MM_i
  49.  
  50. MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
  51. If (Request.QueryString <> "") Then
  52.   MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
  53. End If
  54.  
  55. ' boolean to abort record edit
  56. MM_abortEdit = false
  57.  
  58. ' query string to execute
  59. MM_editQuery = ""
  60. %>
  61. <%
  62. ' *** Update Record: set variables
  63.  
  64. If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
  65.  
  66.   MM_editConnection = MM_lyb_STRING
  67.   MM_editTable = "diarydata"
  68.   MM_editColumn = "id"
  69.   MM_recordId = "" + Request.Form("MM_recordId") + ""
  70.   MM_editRedirectUrl = "photodiaryAdmin.asp"
  71.   MM_fieldsStr  = "pd_date|value|pd_subject|value|pd_weather|value|pd_content|value|rePic|value|pd_photocontent|value"
  72.   MM_columnsStr = "pd_date|',none,NULL|pd_subject|',none,''|pd_weather|',none,''|pd_content|',none,''|pd_photo|',none,''|pd_photocontent|',none,''"
  73.  
  74.   ' create the MM_fields and MM_columns arrays
  75.   MM_fields = Split(MM_fieldsStr, "|")
  76.   MM_columns = Split(MM_columnsStr, "|")
  77.   
  78.   ' set the form values
  79.   For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
  80.     MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  81.   Next
  82.  
  83.   ' append the query string to the redirect URL
  84.   If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
  85.     If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
  86.       MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
  87.     Else
  88.       MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
  89.     End If
  90.   End If
  91.  
  92. End If
  93. %>
  94. <%
  95. ' *** Update Record: construct a sql update statement and execute it
  96.  
  97. If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
  98.  
  99.   ' create the sql update statement
  100.   MM_editQuery = "update " & MM_editTable & " set "
  101.   For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
  102.     MM_formVal = MM_fields(MM_i+1)
  103.     MM_typeArray = Split(MM_columns(MM_i+1),",")
  104.     MM_delim = MM_typeArray(0)
  105.     If (MM_delim = "none") Then MM_delim = ""
  106.     MM_altVal = MM_typeArray(1)
  107.     If (MM_altVal = "none") Then MM_altVal = ""
  108.     MM_emptyVal = MM_typeArray(2)
  109.     If (MM_emptyVal = "none") Then MM_emptyVal = ""
  110.     If (MM_formVal = "") Then
  111.       MM_formVal = MM_emptyVal
  112.     Else
  113.       If (MM_altVal <> "") Then
  114.         MM_formVal = MM_altVal
  115.       ElseIf (MM_delim = "'") Then  ' escape quotes
  116.         MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
  117.       Else
  118.         MM_formVal = MM_delim + MM_formVal + MM_delim
  119.       End If
  120.     End If
  121.     If (MM_i <> LBound(MM_fields)) Then
  122.       MM_editQuery = MM_editQuery & ","
  123.     End If
  124.     MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
  125.   Next
  126.   MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
  127.  
  128.   If (Not MM_abortEdit) Then
  129.     ' execute the update
  130.     Set MM_editCmd = Server.CreateObject("ADODB.Command")
  131.     MM_editCmd.ActiveConnection = MM_editConnection
  132.     MM_editCmd.CommandText = MM_editQuery
  133.     MM_editCmd.Execute
  134.     MM_editCmd.ActiveConnection.Close
  135.  
  136.     If (MM_editRedirectUrl <> "") Then
  137.       Response.Redirect(MM_editRedirectUrl)
  138.     End If
  139.   End If
  140.  
  141. End If
  142. %>
  143. <%
  144. Dim lyb__MMColParam
  145. lyb__MMColParam = "1"
  146. If (Request.QueryString("id") <> "") Then 
  147.   lyb__MMColParam = Request.QueryString("id")
  148. End If
  149. %>
  150. <%
  151. Dim lyb
  152. Dim lyb_numRows
  153.  
  154. Set lyb = Server.CreateObject("ADODB.Recordset")
  155. lyb.ActiveConnection = MM_lyb_STRING
  156. lyb.Source = "SELECT * FROM diarydata WHERE id = " + Replace(lyb__MMColParam, "'", "''") + ""
  157. lyb.CursorType = 0
  158. lyb.CursorLocation = 2
  159. lyb.LockType = 1
  160. lyb.Open()
  161.  
  162. lyb_numRows = 0
  163. %>
  164. <html>
  165. <head>
  166. <title>╩²╫╓╚╒╝╟╣▄└φ</title>
  167. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  168. <!-- Fireworks MX Dreamweaver MX target.  Created Thu Feb 27 23:51:44 GMT+0800 (úñxúñ_?DíñCRE?!) 2003-->
  169. <style type="text/css">
  170. <!--
  171. .dotline {
  172.     border: 1px dashed #666666;
  173. }
  174. * {
  175.     font-size: 12px;
  176. }
  177. -->
  178. </style>
  179. </head>
  180. <body bgcolor="#ffffff">
  181. <table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
  182.   <tr>
  183.     <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE">
  184.         <tr valign="top">
  185.           <td width="180" background="images/diary_back.gif"> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  186.               <tr>
  187.                 <td height="106"><img name="diary_r1_c1" src="images/diary_r1_c1.gif" width="180" height="106" border="0" alt=""></td>
  188.               </tr>
  189.               <tr>
  190.                 <td> <table width="90%" height="100%" border="0" cellpadding="2" cellspacing="0">
  191.                     <tr>
  192.                       <td width="15"><font size="2"> </font></td>
  193.                       <td><font color="#FF3300" size="2">¿ï <strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">ADMIN</font></strong></font>
  194.                         <hr align="left" width="100%" size="1" noshade class="dotline">
  195.                         <font size="2"> <a href="photodiaryAdd.asp">╠φ╝╙╩²╫╓╚╒╝╟</a></font>
  196.                         <hr align="left" width="100%" size="1" noshade class="dotline">
  197.                         <font size="2"> <a href="photodiaryAdmin.asp">╣▄└φ╩²╫╓╚╒╝╟</a></font>
  198.                         <hr align="left" width="100%" size="1" noshade class="dotline">
  199.                         <font size="2"><a href="<%= MM_Logout %>">╫ó╧·╣▄└φ╜τ├µ</a></font>
  200.                         <hr align="left" width="100%" size="1" noshade class="dotline"></td>
  201.                     </tr>
  202.                   </table></td>
  203.               </tr>
  204.             </table></td>
  205.           <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  206.               <tr>
  207.                 <td height="29" background="images/diary_r1_c4.gif">íí</td>
  208.               </tr>
  209.               <tr>
  210.                 <td><font color="#FF0000" size="3"><strong>╨▐╕─╩²╫╓╚╒╝╟</strong></font>
  211.                   <hr size="1" noshade> <table width="100%" border="0" cellspacing="0" cellpadding="0">
  212.                     <tr>
  213.                       <td><form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" style="margin=0px;">
  214.                           <table width="100%" border="0" cellspacing="1" cellpadding="2">
  215.                             <tr>
  216.                               <td width="80" align="right" bgcolor="#999999"><strong><font color="#FFFFFF" size="2">╚╒╞┌ú║</font></strong></td>
  217.                               <td valign="top"><font size="2">
  218.                                 <input name="pd_date" type="text" id="pd_date" value="<%=(lyb.Fields.Item("pd_date").Value)%>" size="20">
  219.                                 </font></td>
  220.                             </tr>
  221.                             <tr>
  222.                               <td align="right" bgcolor="#999999"><strong><font color="#FFFFFF" size="2">╓≈╠Γú║</font></strong></td>
  223.                               <td valign="top"><font size="2">
  224.                                 <input name="pd_subject" type="text" id="pd_subject" value="<%=(lyb.Fields.Item("pd_subject").Value)%>" size="20">
  225.                                 </font></td>
  226.                             </tr>
  227.                             <tr>
  228.                               <td align="right" bgcolor="#999999"><strong><font color="#FFFFFF" size="2">╜±╠∞╠∞╞°ú║</font></strong></td>
  229.                               <td valign="top"><font size="2">
  230.                                 <input <%If (CStr((lyb.Fields.Item("pd_weather").Value)) = CStr("weather01.gif")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="pd_weather" type="radio" value="weather01.gif" checked>
  231.                                 <img src="images/weather01.gif" width="30" height="25" align="absmiddle">
  232.                                 <input <%If (CStr((lyb.Fields.Item("pd_weather").Value)) = CStr("weather02.gif")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="pd_weather" type="radio" value="weather02.gif">
  233.                                 <img src="images/weather02.gif" width="30" height="25" align="absmiddle">
  234.                                 <input <%If (CStr((lyb.Fields.Item("pd_weather").Value)) = CStr("weather03.gif")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="pd_weather" type="radio" value="weather03.gif">
  235.                                 <img src="images/weather03.gif" width="30" height="25" align="absmiddle">
  236.                                 <input <%If (CStr((lyb.Fields.Item("pd_weather").Value)) = CStr("weather04.gif")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="pd_weather" type="radio" value="weather04.gif">
  237.                                 <img src="images/weather04.gif" width="30" height="25" align="absmiddle"><br>
  238.                                 <input <%If (CStr((lyb.Fields.Item("pd_weather").Value)) = CStr("weather05.gif")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="pd_weather" type="radio" value="weather05.gif">
  239.                                 <img src="images/weather05.gif" width="30" height="25" align="absmiddle">
  240.                                 <input <%If (CStr((lyb.Fields.Item("pd_weather").Value)) = CStr("weather06.gif")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="pd_weather" type="radio" value="weather06.gif">
  241.                                 <img src="images/weather06.gif" width="30" height="25" align="absmiddle">
  242.                                 <input <%If (CStr((lyb.Fields.Item("pd_weather").Value)) = CStr("weather07.gif")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="pd_weather" type="radio" value="weather07.gif">
  243.                                 <img src="images/weather07.gif" width="30" height="25" align="absmiddle">
  244.                                 <input <%If (CStr((lyb.Fields.Item("pd_weather").Value)) = CStr("weather08.gif")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="pd_weather" type="radio" value="weather08.gif">
  245.                                 <img src="images/weather08.gif" width="30" height="25" align="absmiddle"></font></td>
  246.                             </tr>
  247.                             <tr>
  248.                               <td align="right" valign="top" bgcolor="#999999"><strong><font color="#FFFFFF" size="2">╚╒╝╟─┌╚▌ú║</font></strong></td>
  249.                               <td valign="top"><p><font size="2">
  250.                                 <textarea  style="display:none"name="pd_content" cols="45" rows="10" id="pd_content"><%=(lyb.Fields.Item("pd_content").Value)%></textarea>
  251.     <IFRAME ID="eWebEditor1" SRC="edit/ewebeditor.asp?id=pd_content&style=s_blue" FRAMEBORDER="0" SCROLLING="no" WIDTH="550" HEIGHT="350"></IFRAME>                            
  252.                               </font></p>
  253.                                 <p> </p></td>
  254.                             </tr>
  255.                             <tr>
  256.                               <td align="right" valign="top" bgcolor="#999999"><strong><font color="#FFFFFF" size="2">╔╧┤½═╝╞¼<br>
  257.                                 ╝░╦╡├≈ú║</font></strong></td>
  258.                               <td valign="top"><font size="2">
  259.                                 <img src="images/photo/<%=(lyb.Fields.Item("pd_photo").Value)%>" alt="╒Γ╩╟╧╘╩╛╔╧┤½╘ñ└└═╝╞¼╡─╬╗╓├" name="showImg" id="showImg" onClick='javascript:alert("╒Γ╩╟╧╘╩╛╔╧┤½╘ñ└└═╝╞¼╡─╬╗╓├");'>
  260.                                 <input type="button" name="Submit" value="╔╧┤½═╝╞¼" onClick="window.open('fupload.asp?useForm=form1&prevImg=showImg&upUrl=images/photo&ImgS=300&ImgW=400&ImgH=340&reItem=rePic','fileUpload','width=400,height=180')">
  261.                                 <input name="rePic" type="hidden" id="rePic" size="4">
  262.                                 <textarea name="pd_photocontent" cols="45" rows="2" id="pd_photocontent"><%=(lyb.Fields.Item("pd_photocontent").Value)%></textarea>
  263.                               </font></td>
  264.                             </tr>
  265.                           </table>
  266.                           <input type="submit" name="Submit2" value="╦═│÷">
  267.                           <input type="reset" name="Submit3" value="╓╪╔Φ">
  268.                           <input type="button" name="Submit4" value="╗╪╔╧╥╗╥│" onClick="window.history.back();">
  269.                           <input type="hidden" name="MM_update" value="form1">
  270.                           <input type="hidden" name="MM_recordId" value="<%= lyb.Fields.Item("id").Value %>">
  271.                       </form></td>
  272.                     </tr>
  273.                   </table></td>
  274.               </tr>
  275.             </table></td>
  276.           <td><img name="diary_r1_c5" src="images/diary_r1_c5.gif" width="12" height="29" border="0" alt=""></td>
  277.         </tr>
  278.         <tr bgcolor="#EEEEEE">
  279.           <td height="12"><table width="20" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  280.               <tr>
  281.                 <td width="8"><img src="images/spacer.gif" width="8" height="12"></td>
  282.                 <td width="12"><img name="diary_r4_c1" src="images/diary_r4_c1.gif" width="12" height="12" border="0" alt=""></td>
  283.               </tr>
  284.             </table></td>
  285.           <td height="12"><img src="images/spacer.gif" width="1" height="12"></td>
  286.           <td width="12" height="12"><img name="diary_r4_c5" src="images/diary_r4_c5.gif" width="12" height="12" border="0" alt=""></td>
  287.         </tr>
  288.       </table></td>
  289.   </tr>
  290. </table>
  291. </body>
  292. </html>
  293. <%
  294. lyb.Close()
  295. Set lyb = Nothing
  296. %>
  297.