%
strUpdateMessage = ""
sub doAnyUpdatesFirst
if Request( "upd_data" ) <> "" then
upd_newpassword = TRIM( Request( "upd_newpassword" ) )
upd_verifypassword = TRIM( Request( "upd_verifypassword" ) )
if upd_newpassword <> "" AND upd_newpassword <> upd_verifypassword then
strUpdateMessage = "Could not update, because the passwords you entered did not match."
else
upd_username = TRIM( Request( "upd_username" ) )
upd_oldusername = TRIM( Request( "upd_oldusername" ) )
if ucase(upd_username) <> ucase(upd_oldusername) then
Set chk_rs = Server.CreateObject("ADODB.Recordset")
chkSQL = "SELECT count(username) as chk_num FROM users WHERE username = '" & upd_username & "'"
chk_rs.Open chkSQL, Con
If Not (chk_rs.BOF AND chk_rs.EOF) Then
if chk_rs("chk_num")<> 0 then
strUpdateMessage = "The username " & upd_username & " is already in use and so could not be changed."
upd_username = upd_oldusername
end if
else
strUpdateMessage = "The usage username " & upd_username & " could not be checked, so it has not been changed."
end if
chk_rs.close
end if
upd_realname = TRIM( Request( "upd_realname" ) )
upd_email = TRIM( Request( "upd_email" ) )
upd_website = TRIM( Request( "upd_website" ) )
upd_notification = TRIM( Request( "upd_notification" ) )
upd_divider = INSTR( userkey, "p")
upd_userID = LEFT( userKey, upd_divider - 1 )
upd_secretKey = RIGHT( userKey, LEN( userKey ) - upd_divider )
Set upd_rs = Server.CreateObject("ADODB.Recordset")
upd_SQL = "UPDATE users SET "
upd_SQL = upd_SQL & "username = '" & upd_username & "', "
upd_SQL = upd_SQL & "name = '" & upd_realname & "', "
upd_SQL = upd_SQL & "email = '" & upd_email & "', "
upd_SQL = upd_SQL & "website = '" & upd_website & "', "
if upd_newpassword <> "" then
upd_SQL = upd_SQL & "password = '" & upd_newpassword & "', "
end if
upd_SQL = upd_SQL & "notification = '" & upd_notification & "' "
upd_SQL = upd_SQL & "WHERE userid = " & userID & " AND secretKey = " & upd_secretKey
'response.write upd_SQL & "
"
Con.Execute upd_SQL
end if
end if
end sub
%>
![]() |
|||||||
|
<%
userKey = TRIM( Request.Cookies( "k" ) )
if userKey <> "" then
doAnyUpdatesFirst
upd_divider = INSTR( userkey, "p")
upd_userID = LEFT( userKey, upd_divider - 1 )
upd_secretKey = RIGHT( userKey, LEN( userKey ) - upd_divider )
Set upd_rs = Server.CreateObject("ADODB.Recordset")
upd_SQL = "SELECT * FROM users WHERE userid = " & userID & " AND secretKey = " & upd_secretKey
upd_rs.Open upd_SQL, Con
If Not (upd_rs.BOF AND upd_rs.EOF) Then 'User Exists
response.write("OK")
if not isnull(upd_rs("name")) then
response.write (" " & upd_rs("name"))
end if
if not isnull(upd_rs("lastlogin")) then
response.write(", you last logged in on " & FormatDateTime(upd_rs("lastlogin"),vbLongDate) & " ") set myFileObject = server.createObject("Scripting.FileSystemObject") set myFile = myFileObject.getFile(server.mapPath("whats_new.inc")) If myFile.DateLastModified > upd_rs("lastlogin") Then response.write(" There have been some changes since then. Here are the details we have about you. Anything you would like to change? <% Else response.write ("Cannot find your user details.") End If Else response.write ("You do not seem to be logged in.") End If %> |
|||||||
|