Recommended: ASP long numbers are separated by commas to display instance code % Function Comma(str) If Not(IsNumeric(str)) Or str = 0 Then Result = 0 ElseIf Len(Fix(str)) 4 Then Result = str Else Pos = Instr(1,str,.) If Pos 0 Then Dec = Mid(str,Pos) End if Res = StrReverse(Fix(str)) LoopCount = 1 While LoopCount =
Due to work relationships, one of the functions is to vote for users, requiring that the same IP can only vote for the same user once, and post Asp code
- <%
- 'Author: Ruthless Source:
- db_conn(dbs)
- Voteusername=trim(request.QueryString(username))
- rs_create(selectusernamefrom[user]whereusername='&Voteusername&')
- ifrs.eofandrs.bofthen
- Response.write incorrect parameters, please access them from correctly!
- response.end()
- endif
- 'The first case is the first click, the cookies are empty, and the ip is empty
- 'The second situation is to click the second person to vote, the first person's cookies exist, the second person's cookies do not exist, but the IP exists
- 'The third situation is to vote with IP, cookies exist, IP is empty
- ifRequest.cookies(dwww)(&Voteusername&)=then
- Response.cookies(dwww)(&Voteusername&)=Voteusername&|
- Response.cookies(dwww).Expires=Date()+365
- CallVoteBody()
- else
- ifinstr(request.cookies(dwww)(&Voteusername&),request.cookies(dwww)(&Voteusername&)&|)<>0then
- CallVoteBody()
- else
- 'response.write Sorry, you have voted! Cookies Repeat
- Response.Write<script>alert('Sorry, you voted!');history.back();</script>
- response.end()
- endif
- endif
- SubVoteBody()
- Voteusername=trim(request.QueryString(username))
- CheckIp=Request.ServerVariables(HTTP_X_FORWARDED_FOR)'Bypass proxy IP
- IfCheckIp=ThenCheckIp=Request.ServerVariables(REMOTE_ADDR)
- GetUrl=
- GetUrl=Request.ServerVariables(Http_Referer)
- sql=Selectusername,ipfromvotewhereusername='&Voteusername&'andip='&CheckIp&'
- rs_create(Sql)
- IfNotrs.BofAndNotrs.eofThen
- 'response.write Sorry, you have voted! IP duplicate
- Response.Write<script>alert('Sorry, you voted!');history.back();</script>
- response.end()
- Else
- conn.execute(insertintovote(username,ip,addtime)values('&Voteusername&','&CheckIp&','&now()&'))
- conn.execute(update[user]setvote=vote+1whereusername='&Voteusername&')
- 'response.write vote succeeded!
- Response.Write<script>alert('Congratulations, vote was successful!');location.href='&Request.ServerVariables(HTTP_REFERER)&'</script>
- response.end()
- EndIf
- endSub
- rs_close()
- db_close()
- %>
Share: ASP creates login page verification program User login verification script, Chkpwd.asp % '========= User login verification script====== 'If Passed object has not been defined yet, define it as false, which means that the verification has not been passed. If IsEmpty(Session(Passed)) Then Session(Passed)=false End If 'Session(Passed)=False, it means that the verification has not been passed, and then reading begins.