<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>The Aggie Review (v1.0)</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="stylesheet.css" type="text/css" />
</head>
<body topmargin="0">

<!--#include file="functions.asp" -->
<!--   THIS IS THE CONFIG PAGE -->
<%
Call Logon()
Call GetAdminStatus()

' DELETE ARTICLE?
    delete = Request("delete")
    IF delete = "YES" then
    ID = Request("ID")
    Response.write("Deleting # " & ID)
    sql = "delete from articles where ID = " & ID & ""
    set rs=Server.CreateObject("ADODB.recordset")
    rs.Open sql, conn
    Response.redirect("config.asp")
    END IF
%>


<table width="80%" border="1" height="581">
<tr bgcolor="#8CAAE7">
<td colspan="3"><!--server side include numero uno -->
<!--#include file="titleINC.asp" -->
</td>
</tr>

<tr bgcolor="#0066CC">
<td colspan="3" height="38" class="quicklink">
<!--server side include numero dos -->
<!--#include file="topINC.asp" -->
</td>
</tr>

<tr>
<td width="10%" height="413" class="left" valign="top"
bgcolor="#EFF3FF"><!--server side include numero tres -->
<!--#include file="contentsINC.asp" -->
</td>
<td width="70%" height="413" valign="top" bgcolor="white">
<!--                     BODY                -->
<%

' Find out if Displaying All Topics or just Default or Custom

'Set Query based on articles selected
	tmpGenre = Request.Cookies("user")("DefaultGenre")	            
'	Response.Write("<br>TMP cookie CUSTOM: " & tmpGenre)
If Request("Genre") <> "" AND Request("Genre") <> "All" THEN 
	tmpGenre = ""
	tmpGenre = Request("Genre")
	'Response.Write("<br>Genre CUSTOM: " & Request("Genre"))
'	Response.Write("<br>TMP CUSTOM: " & tmpGenre)
END IF

IF Request("Genre") = "All" THEN 
	tmpGenre = ""
END IF
	
If tmpGenre <> "" AND tmpGenre <> "Show All" AND tmpGenre <> "ALL" THEN 
	'Response.write("<br>Using Custom SQL Query")
	testsql =CountGenre(tmpGenre) ' Custom query
	if testsql = "" then
		checker = "false"

	else
		sql = testsql
		   checker = "true"

	end if
ELSE
'      	 Response.write("<br>Using Generic SQL Query:") 
       	 sql="SELECT Title, UserName, Genre, Intro, ID, Date, Time FROM articles ORDER BY ID DESC"
		 checker = "true"
END IF   
  
  
If checker = "true" THEN  ' IF THERE IS ANYTHING TO SHOW

set rs = Server.CreateObject("ADODB.recordset")
rs.Open sql, conn
	   
rs.MoveFirst
Do until rs.EOF
%>
<hr />
<span class="title"><%= rs("Title").Value %></span> <span class="article"><br />
<%= rs("Intro").Value %></span><br />
<h5><a href="fullstory.asp?ID=<%=rs("ID").Value%>" target="_blank">Read the rest...</a></h5>
<h4><%= rs("Genre").Value %> story written by <%= rs("UserName").Value %> on <%= rs("Date").Value %> at <%= rs("Time").Value %></h4>
      <a href="addarticle.asp?edit=YES&ID=<%=rs("ID").Value%>">EDIT 
      ARTICLE</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="config.asp?delete=YES&amp;ID=<%=rs("ID").Value%>"><i><font color="#FF0000">DELETE</font></i></a>!!!</h4> 
      <%
 	  rs.MoveNext
      Loop
      rs.close
END IF  
%>
<!--                END     BODY                -->
</td>
<td width="10%" height="413" class="right" valign="top"
bgcolor="#D7DEF8"><!--server side include five? -->
<!--#include file="rightside.asp" -->
</td>
</tr>

<tr bgcolor="#8CAAE7">
<td colspan="3" height="71" class="quicklink">
<!--server side include numero quatro -->
<!--#include file="bottomINC.asp" -->
</td>
</tr>
</table>

<%
    'close connections
    conn.close
    %>
</body>
</html>

