<% Option Explicit %>
<!--#include file="config.asp"-->
<!--#include file="common.asp"-->
<!--#include file="md5.asp"-->
<%
	Command = Request.QueryString("Command")

	If Command <> "Set" Then
		If IsValidPayment Then
			OpenConnection

			DBC.Execute("UPDATE Members SET Password = " & EscapeSQLData(Request("PAYER_ACCOUNT")) & " WHERE EGold = " & Request("PAYER_ACCOUNT"))

			Response.End
		End If
	End If


	If MemberID <> 0 Then
		Response.Redirect "memberaccount.asp"
	End If


	PageBegin
	If Command = "Show" Then
		Response.Write "<br><p align=center>Your password has been changed to your e-gold number.</p>"
	End If

	If Command = "PasswordForgot" Then
		PasswordForgotForm
	Else
		LoginForm
	End If

	PageEnd


	Sub LoginForm()
%>
	<table border=0 cellspacing=0 cellpadding=2 align=center>

	<form name=LF action='member.asp?Command=LogIn' method=post onsubmit='return EGoldPresent() && PasswordPresent()'>
	<tr>
		<td align=center class=Title colspan=2>
			Member's Area<br><br>
		</td>
	</tr>
	<tr class=Odd>
		<td align=right>E-Gold</td>
		<td>
			<input name=EGold size=10 maxlength=15 class=ClientText>
		</td>
	</tr>
	<tr class=Odd>
		<td align=right>
			<%= SiteName %> Password
		</td>
		<td>
			<input type=password name=Password size=10 maxlength=20 class=ClientText>
		</td>
	</tr>
	<tr class=Odd>
		<td align=center colspan=2>
			<input type=submit value="Log In" class=Button>
			<br><br>
			Your IP is logged: <%= Request.ServerVariables("REMOTE_HOST") %>
			<br><br>
			<a href="log.asp?Command=PasswordForgot">I have forgotten my password!</a>
		</td>
	</tr>
	</form>
	</table>

	<script language=JavaScript src=common.js></script>
<%
	End Sub


	Sub PasswordForgotForm()
%>
		<p align=center class=Title>
			Forgot your password?
		</p>
		<p align=center class=Odd>
			The system will change your account password to match Your e-gold number after a successful<br>
			spend to our account (<%= MyEGold %>). $ 0.005 worth of e-gold.<br><br>

			<form action="https://www.e-gold.com/sci_asp/payments.asp" method=post>
			<input type=hidden name=PAYEE_ACCOUNT value="<%= MyEGold %>">
			<input type=hidden name=PAYMENT_AMOUNT value="0.005">
			<input type=hidden name=PAYEE_NAME value="">
			<input type=hidden name=PAYMENT_UNITS value=1>
			<input type=hidden name=PAYMENT_METAL_ID value=1>
			<input type=hidden name=STATUS_URL value="<%= CurrentFile %>?Command=Set">
			<input type=hidden name=PAYMENT_URL value="<%= CurrentFile %>?Command=Show">
			<input type=hidden name=NOPAYMENT_URL value="<%= CurrentFile %>">
			<input type=hidden name=BAGGAGE_FIELDS value="MemberID">
			<input type=hidden name=MemberID value="<%= MemberID %>">
			<input type=hidden name=SUGGESTED_MEMO value="<%= SiteName %> - password recovery">
			<input type=submit name=PAYMENT_METHOD value="Set Password" class=Button>
			</form>
		</p>
<%
	End Sub
%>