File: D:/web/homefly/vsadmin/inc/inclogin.asp
<%
'This code is copyright (c) Internet Business Solutions SL, all rights reserved.
'The contents of this file are protect under law as the intellectual property
'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying
'of any kind without the express and written permission of Internet Business
'Solutions SL is forbidden.
'Author: Vince Reid, vince@virtualred.net
if Session("loggedon") <> "virtualstore" then response.end
Dim sSQL,rs,alldata,alladmin,success,cnn,errmsg
success=true
Set rs = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
sSQL = "SELECT adminEmail, adminStoreURL, adminUser, adminPassword FROM admin WHERE adminID=1"
rs.Open sSQL,cnn,0,1
alladmin=rs.getrows
rs.Close
if request.form("posted")="1" then
if Trim(request.form("pass")) <> Trim(request.form("pass2")) then
success = false
errmsg="Sorry, your password confirmation did not match."
else
sSQL = "UPDATE admin SET adminUser='"&request.form("user")&"',adminPassword='"&request.form("pass")&"' WHERE adminID=1"
on error resume next
cnn.Execute(sSQL)
if err.number<>0 then
success=false
errmsg = "There was an error writing to the database.<br>"
if err.number = -2147467259 then
errmsg = errmsg & "Your database does not have write permissions."
else
errmsg = errmsg & err.description
end if
else
response.write "<meta http-equiv=""refresh"" content=""3; url=admin.asp"">"
end if
on error goto 0
end if
end if
cnn.Close
%>
<table border="0" cellspacing="<%=maintablespacing%>" cellpadding="<%=maintablepadding%>" width="<%=maintablewidth%>" bgcolor="<%=maintablebg%>" align="center">
<% if request.form("posted")="1" AND success then %>
<tr>
<td width="100%">
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="2" align="center"><br><b>Update Successful !</b><br><br>You will now be forwarded
to the admin home page.<br><br>
If that does not happen automatically then please <A href="admin.asp"><b>click
here</b></a>.<br>
<br>
<img src="../images/clearpixel.gif" width="350" height="3">
</td>
</tr>
</table></td>
</tr>
<% else %>
<tr>
<form method="POST" action="adminlogin.asp">
<td width="100%">
<input type="hidden" name="posted" value="1">
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="2" align="center"><br><b>Please enter your new username and password.</b>
</td>
</tr>
<% if not success then %>
<tr>
<td width="100%" colspan="2" align="center"><br><font color="#FF0000"><%=errmsg%></font>
</td>
</tr>
<% end if %>
<tr>
<td width="50%" align="right"><b>Username: </b>
</td>
<td width="50%" align="left"><input type="text" name="user" size="20" value="<%=alladmin(2,0)%>">
</td>
</tr>
<tr>
<td width="50%" align="right"><b>Password: </b>
</td>
<td width="50%" align="left"><input type="password" name="pass" size="20" value="<%=alladmin(3,0)%>">
</td>
</tr>
<tr>
<td width="50%" align="right"><b>Confirm Password: </b>
</td>
<td width="50%" align="left"><input type="password" name="pass2" size="20" value="<%=alladmin(3,0)%>">
</td>
</tr>
<tr>
<td width="100%" colspan="2" align="center"><br><input type="submit" value="Submit"><br>
<img src="../images/clearpixel.gif" width="350" height="3"></td>
</tr>
</table></td>
</form>
</tr>
<% end if %>
</table>