home *** CD-ROM | disk | FTP | other *** search
/ 221.214.14.186 / 221.214.14.186.tar / 221.214.14.186 / zb / Notepad-zb / post_do.asp < prev    next >
Text File  |  2005-12-26  |  6KB  |  259 lines

  1. <!--#include file="conn.asp"-->
  2. <!--#include file="connip.asp"-->
  3. <!--#include file=const.asp -->
  4. <!--#include file=md5.asp -->
  5. <%
  6.  
  7. dim title,name,pass,email,qq,url,pic,nei,t,rt,yd,hf,jh,bl,male,face,icq,msn
  8. dim exec1, rs1, rs, rs2, id,isPrivate, foundErr
  9.       
  10. title=encodestr(Request.form("title"))
  11. name=encodestr(Request.form("name"))
  12. pass=encodestr(Request.form("pass"))
  13. email=encodestr(Request.form("email"))
  14. qq=encodestr(Request.form("qq"))
  15. icq=encodestr(Request.form("icq"))
  16. msn=encodestr(Request.form("msn"))
  17. url=encodestr(Request.form("url"))
  18. nei=replace(Request.form("nei"),"'","""")
  19. pic=encodestr(Request.form("pic"))
  20. male=encodestr(Request.form("male"))
  21. face=encodestr(Request.form("face"))
  22. isPrivate=encodestr(Request.form("isPrivate"))
  23. bl=0
  24.  
  25. if isDate(request.cookies("gbook")("lastpost")) then
  26.     if dateDiff("s",Cdate(request.cookies("gbook")("lastPost")),now)<=postLimit then
  27.         session("error")="╟δ▓╗╥¬╣α╦«úíúí<br>"
  28.         foundErr=true
  29.     end if
  30. end if
  31. if len(title)<3 then
  32.     session("error")="╟δ╚╧╒µ╠ε╨┤┴⌠╤╘▒Ω╠Γúíúí<br>"
  33.     foundErr=true
  34. end if
  35. if len(name)=0 and not theUser.reged then
  36.     session("error")=session("error") & "╟δ╠ε╨┤╙├╗º├√úíúí<br>"
  37.     foundErr=true
  38. end if
  39. if len(nei)<2 then
  40.     session("error")=session("error") & "╟δ╚╧╒µ╠ε╨┤┴⌠╤╘─┌╚▌úíúí<br>"
  41.     foundErr=true
  42. end if
  43. if len(nei)>maxLength then
  44.     session("error")=session("error") & "┴⌠╤╘─┌╚▌╫ε╢α"& maxLength &"╕÷╫╓╖√ú¼╟δ╝⌡╔┘─π╡─┴⌠╤╘─┌╚▌úíúí<br>"
  45.     foundErr=true
  46. end if
  47. if len(title)>40 then
  48.     session("error")=session("error") & "┴⌠╤╘▒Ω╠Γ▓╗┐╔╥╘│¼╣²40╕÷╫╓╖√úíúí<br>"
  49.     foundErr=true
  50. end if
  51. if len(name)>10 then
  52.     session("error")=session("error") & "╙├╗º├√▓╗┐╔╥╘│¼╣²10╕÷╫╓╖√úíúí<br>"
  53.     foundErr=true
  54. end if
  55.  
  56. if foundErr then
  57.     connclose()
  58.     response.redirect("error.asp")
  59. end if
  60.  
  61. if theUser.reged then
  62.     name=theUser.name
  63.     qq=theUser.qq
  64.     email=theUser.email
  65.     url=theUser.url
  66.     if theUser.male then
  67.         male="1"
  68.     else
  69.         male="0"
  70.     end if
  71.     face=theUser.face
  72.     bl=1
  73. elseif pass<>"" then
  74.     pass=MD5(pass)
  75.     exec1="select * from [user] where username='"&name&"'"
  76.     Set RS1 = Server.CreateObject("ADODB.RecordSet") 
  77.     rs1.Open exec1, Conn, 1, 2
  78.     if not rs1.eof then
  79.         if pass=rs1("userpassword") then
  80.             qq=rs1("oicq")
  81.             icq=rs1("icq")
  82.             msn=rs1("msn")
  83.             email=rs1("useremail")
  84.             url=rs1("homepage")
  85.             male=rs1("sex")
  86.             face=rs1("GBface")
  87.             bl=1
  88.         else
  89.             rs1.close : set rs1=nothing
  90.             connclose()
  91.             session("error")="▒ú┴⌠╙├╗º├▄┬δ╒╩║┼▓╗╢╘╙ªúíúíúí"
  92.             response.redirect "error.asp"
  93.         end if
  94.     else
  95.         if email<>"" and not validEmail(email) then
  96.             connclose()
  97.             session("error")="╟δ╩Σ╚δ╒²╚╖╡─email╡╪╓╖úíúíúí"
  98.             response.redirect "error.asp"
  99.         end if
  100.         if isLikeMasterName(name) then
  101.             connclose()
  102.             session("error")="╟δ▓╗╥¬╩╣╙├╙δ░µ╓≈├√╧α╦╞╡─╙├╗º├√úíúíúí"
  103.             response.redirect "error.asp"
  104.         end if
  105.         
  106.         Set rs2 = Server.CreateObject("ADODB.Recordset")
  107.         exec1="select * from [user] where userid=0"
  108.         rs2.Open exec1,conn,1,2
  109.         rs2.addnew
  110.         rs2("username")=name
  111.         rs2("userpassword")=pass
  112.         if email<>"" then
  113.             rs2("useremail")=email
  114.         end if
  115.         if qq<>"" then
  116.             rs2("oicq")=qq
  117.         end if
  118.         if icq<>"" then
  119.             rs2("icq")=icq
  120.         end if
  121.         if msn<>"" then
  122.             rs2("msn")=msn
  123.         end if
  124.         if url<>"" then
  125.             rs2("homepage")=url
  126.         end if
  127.         rs2("sex")=male
  128.         rs2("GBface")=face
  129.         rs2("GBpostNum")=0
  130.         rs2("GBprivateNum")=0
  131.         rs2("addDate")=dateAdd("h",timeDiff,now)
  132.         rs2.update
  133.         rs2.close
  134.         set rs2=nothing
  135.         exec1="update GBconst set userNum=userNum+1"
  136.         conn.execute(exec1)
  137.         
  138.         bl=1
  139.     end if
  140.     rs1.close
  141.     set rs1=nothing
  142. else
  143.     '╬┤╫ó▓ß,╬┤╠ε├▄┬δ
  144.     if mustReg then
  145.         connclose()
  146.         session("error")="╓╗╙╨╫ó▓ß╙├╗º┐╔╥╘╖ó╤╘ú¼╟δ╫ó▓ßúí"
  147.         response.redirect "error.asp"
  148.     end if
  149.     if email<>"" and not validEmail(email) then
  150.         connclose()
  151.         session("error")="╟δ╩Σ╚δ╒²╚╖╡─email╡╪╓╖úíúíúí"
  152.         response.redirect "error.asp"
  153.     end if
  154.     if isLikeMasterName(name) then
  155.         connclose()
  156.         session("error")="╟δ▓╗╥¬╩╣╙├╙δ░µ╓≈├√╧α╦╞╡─╙├╗º├√úíúíúí"
  157.         response.redirect "error.asp"
  158.     end if
  159.         
  160.     exec1="select top 1 userid from [user] where username='"& name &"'"
  161.     set rs2=conn.execute(exec1)
  162.     if not rs2.eof then
  163.         connclose()
  164.         session("error")="─·╩╣╙├╡─╙├╗º├√╩▄╡╜▒ú╗ñ,╟δ╕ⁿ╗╗!"
  165.         response.redirect("error.asp")
  166.     end if
  167.     rs2.close
  168.     set rs2=nothing
  169.     if request.cookies("gbookGuestName")<>"" then
  170.         if name<>request.cookies("gbookGuestName") then
  171.             connclose()
  172.             session("error")="╟δ▓╗╥¬╩╣╙├╢α╕÷╙├╗º├√┴⌠╤╘"
  173.             response.redirect "error.asp"
  174.         end if
  175.     else
  176.         if cookiePath<>"" then
  177.             response.cookies("gbookGuestName").Path=cookiePath
  178.         end if
  179.         response.cookies("gbookGuestName")=name
  180.     end if
  181. end if
  182.  
  183.  
  184. Set rs = Server.CreateObject("ADODB.Recordset")
  185. exec1="select * from ly where id=0"
  186. rs.Open exec1,conn,1,2
  187.     rs.addnew
  188.     rs("name")=name
  189.     rs("title")=title
  190.     if email<>"" then
  191.         rs("email")=email
  192.     end if
  193.     if qq<>"" then
  194.         rs("qq")=qq
  195.     end if
  196.     if icq<>"" then
  197.         rs("icq")=icq
  198.     end if
  199.     if msn<>"" then
  200.         rs("msn")=msn
  201.     end if
  202.     if url<>"" then
  203.         rs("url")=url
  204.     end if
  205.     rs("male")=male
  206.     rs("face")=face
  207.     rs("nei")=nei
  208.     rs("t")=dateAdd("h",timeDiff,now)
  209.     rs("pic")=pic
  210.     rs("bl")=bl
  211.     rs("yd")=0
  212.     rs("hf")=0
  213.     rs("jh")=0
  214.     rs("rt")=0
  215.     rs("ip")=request.servervariables("remote_addr")
  216.     rs("comefrom")=getFrom(request.servervariables("remote_addr"))
  217.     if isPrivate="1" then
  218.         rs("isPrivate")=1
  219.     end if
  220.     rs.update
  221.     rs.close
  222.     exec1="select max(id) from ly"
  223.     rs.open exec1,conn,1,1
  224.     id=rs(0)
  225.     rs.close
  226.     set rs=nothing
  227.     exec1="update ly set reid=id, retime=t where id="& id
  228.     conn.execute exec1
  229.     
  230. exec1="update GBconst set topicNum=topicNum+1"
  231. conn.execute(exec1)
  232. if bl=1 then
  233.     exec1="update [user] set GBpostNum=GBpostNum+1 where username='"& name &"'"
  234.     conn.execute(exec1)
  235. end if
  236. if bl=1 and isPrivate="1" then
  237.         exec1="update GBconst set privateNum=privateNum+1"
  238.         conn.execute(exec1)
  239.         exec1="update [user] set GBprivateNum=GBprivateNum+1 where username='"& name &"' "
  240.         conn.execute(exec1)
  241. end if
  242.  
  243. conn.close
  244. set conn=nothing
  245. connIpclose()
  246.  
  247. if cookiePath<>"" then
  248.     response.cookies("gbook").Path=cookiePath
  249. end if
  250. response.cookies("gbook")("lastPost")=now
  251.  
  252. if not theUser.reged then
  253.     response.cookies("gbook")("username")=vbescape(name)
  254.     response.cookies("gbook")("password")=pass
  255. end if
  256.  
  257. session("url")="show.asp?id="&id
  258. response.redirect "addok.asp"
  259. %>