<% Option Explicit %>
<!--#include file="../config.asp"-->
<!--#include file="../common.asp"-->
<!--#include file="main.asp"-->
<%
	PageHeader

	If Not Session("IsAdminLogin") Then
		PageLogin
		Response.End
	End If


	OpenConnection

	If Request.Querystring("Command") = "Delete" Then
		DBC.Execute("DELETE FROM History WHERE CID = " & Str2Num(Request.Querystring("CID")))
		DBC.Execute("DELETE FROM Campaigns WHERE CID = " & Str2Num(Request.Querystring("CID")))
	End If

	AdminPageBegin "Links List"
	LinksList
	AdminPageEnd



	Sub LinksList()
		Dim rs, i

		Set rs = DBC.Execute("SELECT * FROM Campaigns ORDER BY CID DESC")
%>
		<form>
		<table border=0 align=center bgcolor=black width=600 cellspacing=1 cellpadding=3>
		<col>
		<col>
		<col align=right>
		<col align=right>
		<col align=center>
		<col>
		<col align=center>
		<tr class=SelectedParent>
			<td>&nbsp;</td>
			<td align=center>Website</td>
			<td align=center>Visits</td>
			<td align=center>Visits Left</td>
			<td align=center>Approved</td>
			<td align=center>E-Gold</td>
			<td>&nbsp;</td>
		</tr>
<%
		i = 1

		Do While Not rs.EOF
%>
			<tr class=Odd>
				<td><%= i %>.</td>
				<td><a href="<%= rs("SiteURL") %>" target=_blank><%= rs("SiteTitle") %></a></td>
				<td><%= rs("Visits") %></td>
				<td><%= rs("VisitsLeft") %></td>
				<td><%= IIf(rs("Approved"), "<font color=green>Yes</font>", "<font color=red>No</font>") %></td>
				<td><%= rs("EGold") %></td>
				<td>
					<a href="mailto:<%= rs("EMail") %>">Send Mail</a>&nbsp;
					<a href="link_edit.asp?CID=<%= rs("CID") %>">Edit</a>&nbsp;
					<a href="javascript: Delete(<%= rs("CID") %>)">Delete</a>
				</td>
			</tr>
<%
			i = i + 1
			rs.MoveNext
		Loop
%>
		</table>
		</form>
		<br>

		<script language=JavaScript>
		<!--
		function Delete(ID)
		{
			if (confirm("This record will be delete. Do you want to proceed?"))
				document.location = "link_list.asp?Command=Delete&CID=" + ID;
		}
		//-->
		</script>
<%
	End Sub
%>