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

	If Len(Request.Form.Item) > 10 Then
		If IsValidPayment Then
			Title	= Trim(Request.Form("Title"))
			URL		= Trim(Request.Form("URL"))

			OpenConnection

			DBC.Execute("INSERT INTO Links (BatchNumber, " & _
					"FromEGold, Title, URL, ValidTo) " & _
					"VALUES (" &	Str2Num(Request.Form("PAYMENT_BATCH_NUM"))	& ", " & _
									Str2Num(Request.Form("PAYER_ACCOUNT"))		& ", " & _
									EscapeSQLData(Title)						& ", " & _
									EscapeSQLData(URL)							& ", " & _
									"'" & Date() + 30 & "')")

			Response.End
		End If
	End If


	PageHeader
	PageBegin "Add Link"
	AddLink
	PageEnd
%>
	</body>
	</html>
<%

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

		if (document.F.URL.value.length < 10)
		{
			alert ('Please enter your site 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="<%= CurrentFile %>">
	<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 %>">

	<table border="0" cellpadding="3" cellspacing="1" align="center">
	<tr class="Title">
		<td align="center" colspan="2">
			<font face="Tahoma" color="555555" size="3">Link Information</font>
		</td>
	</tr>
	<tr class="PageText">
		<td>Your site title</td>
		<td>
			<input name="Title" value size="40" maxlength="25" class="ClientText">
		</td>
	</tr>
	<tr class="PageText">
		<td>Your site URL</td>
		<td>
			<input name="URL" value size="40" maxlength="100" class="ClientText">
		</td>
	</tr>
	<tr class="PageText">
		<td>Link cost for a month</td>
		<td>
			$<%= LinkCost4aMonth %>
		</td>
	</tr>
	<tr class="PageText">
		<td>&nbsp;</td>
		<td valign="top">
			<br><input type="image" name="PAYMENT_METHOD" src="images/egold.gif" alt="Pay with e-gold" WIDTH="88" HEIGHT="31">
		</td>
	</tr>
	</table>
	</form>
<%
	End Sub
%>