<% Option Explicit %>
<!--#include file="config.asp"-->
<!--#include file="common.asp"-->
<!--#include file="md5.asp"-->
<%
	Dim Title, URL, BatchNumber, PAYMENT_AMOUNT, i

	If Len(Request.Form.Item) > 10 Then
		If IsValidPayment Then
			PAYMENT_AMOUNT	= Str2Float(Request.Form("PAYMENT_AMOUNT"))

			If PAYMENT_AMOUNT = CDbl(LinkCost4AMonth) Then
				Title		= Trim(Request.Form("Title"))
				URL			= Trim(Request.Form("URL"))
				BatchNumber	= Str2Num(Request.Form("PAYMENT_BATCH_NUM"))

				OpenConnection

				DBC.Execute("INSERT INTO Links (BatchNumber, Title, URL, ValidTo) " & _
						"VALUES (" &	BatchNumber				& ", " & _
										EscapeSQLData(Title)	& ", " & _
										EscapeSQLData(URL)		& ", " & _
										"'" & Date() + 30		& "')")

				Application("EGG_Links") = ""
			End If

			Response.End
		End If
	End If


	PageHeader
	PageBegin
	AddLink
	PageEnd


	Sub AddLink()
%>
		<script language="JavaScript">
		<!--
		function UpdateAccount()
		{
			if (document.F.Title.value == "")
			{
				alert ("Please enter your site's title.");
				document.F.Title.focus();
				return false;
			}

			if (document.F.URL.value.length < 10)
			{
				alert ("Please enter your site's URL.");
				document.F.URL.focus();
				return false;
			}

			return true;
		}
		//-->
		</script>

		<form name="F" action="https://www.e-gold.com/sci_asp/payments.asp" method="post" onsubmit="return UpdateAccount()">
		<input type="hidden" name="PAYEE_ACCOUNT" value="<%= MyEGold %>">
		<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 %>">
		<input type="hidden" name="PAYMENT_URL" value="<%= CurrentPath %>default.asp">
		<input type="hidden" name="NOPAYMENT_URL" value="<%= CurrentPath %>default.asp">
		<input type="hidden" name="BAGGAGE_FIELDS" value="Title URL">
		<input type="hidden" name="PAYMENT_AMOUNT" value="<%= LinkCost4AMonth %>">

		<br><br>
		<table border="0" width="300" cellspacing=1 cellpadding="2" align=center bgcolor=BBBBBB>
		<tr bgcolor=FFEFB2>
			<td align=center class="PageText">
				<b>Add link</b>
			</td>
		</tr>
		<tr>
			<td bgcolor=FFFAC6 class="PageText">
				<br>Site's title<br>
				<input name="Title" value="" size="45" maxlength="25" class="ClientText"><br><br>
				Site's URL<br>
				<input name="URL" value="" size="45" maxlength="100" class="ClientText"><br>
				<br>Monthly fee $<%= LinkCost4AMonth %>
				<p align=center>
					<input type="image" src="images/egold.gif" value="Pay through e-gold" WIDTH="88" HEIGHT="31"><br><br>
				</p>
			</td>
		</tr>
		</table>
		</form>
<%
	End Sub
%>