Update of /cvsroot/slugtalk/slugboards/slugtalk
In directory sc8-pr-cvs1:/tmp/cvs-serv1059
Modified Files:
CheckLogin.cs SQL.cs Thumbs.db login.aspx login.aspx.cs
messages.xsd messages.xsx post.aspx post.aspx.cs
post.aspx.resx register.aspx register.aspx.cs slugboards.aspx
slugboards.aspx.cs slugtalk.csproj slugtalk.suo style.css
user.aspx user.aspx.cs users.xsd users.xsx
Added Files:
Slugboards.cs bigX.gif blank.gif delete.aspx delete.aspx.cs
delete.aspx.resx error.aspx error.aspx.cs error.aspx.resx
logout.aspx logout.aspx.cs logout.aspx.resx newpass.aspx
newpass.aspx.cs newpass.aspx.resx password.gif
verify_delete.gif
Log Message:
More updates!
--- NEW FILE: Slugboards.cs ---
using System;
using System.Data;
using System.Web.UI;
public class Slugboards
{
//
// GenerateHTML()
//
// Generates HTML for the message board depending on the values of BoardID and TopicID
//
public string GenerateHTML(Page NewWebpage)
{
// Set the server object
Webpage = NewWebpage;
BoardID = Webpage.Request.QueryString.Get("BoardID");
TopicID = Webpage.Request.QueryString.Get("TopicID");
// See if the inputs are valid. If any are not, redirect the user to the
// error page
try
{
// Get BoardID query string
if(BoardID != null)
int.Parse(BoardID);
// Get TopicID query string
if(TopicID != null)
int.Parse(TopicID);
// Get TopicsPerPage query string
string TopicsPerPageString = Webpage.Request.QueryString.Get("TopicsPerPage");
if(TopicsPerPageString != null)
TopicsPerPage = int.Parse(TopicsPerPageString);
if(TopicsPerPageString == null || TopicsPerPage < 30)
TopicsPerPage = 30;
// Get PageNum query string
string PageNumString = Webpage.Request.QueryString.Get("PageNum");
if(PageNumString != null)
PageNum = int.Parse(PageNumString);
if(PageNumString == null || PageNum < 1)
PageNum = 1;
}
catch(System.Exception exception)
{
Webpage.Response.Redirect("error.aspx?Message=" + exception.Message);
return null;
}
// Generate a string to hold the HTML
string HtmlCode = "";
// Decide how to display the board
if(BoardID != null)
GenerateHTML_Board(BoardID, ref HtmlCode);
else if(TopicID != null)
GenerateHTML_Topic(TopicID, ref HtmlCode);
else
GenerateHTML_AllBoards(ref HtmlCode);
return HtmlCode;
}
//
// GenerateHTML_AllBoards()
//
// Generates HTML for the message board listing
//
private void GenerateHTML_AllBoards(ref string HtmlCode)
{
// Try to connect to the database
EzSqlConnection SqlConn = new EzSqlConnection(Webpage);
// Initialize tables
EzSqlTable Boards = new EzSqlTable(SqlConn, "Boards", Webpage.Server.MapPath("boards.xsd"));
EzSqlTable Users = new EzSqlTable(SqlConn, "Users", Webpage.Server.MapPath("users.xsd"));
EzSqlTable Groups = new EzSqlTable(SqlConn, "Groups", Webpage.Server.MapPath("groups.xsd"));
// Display table header
HtmlCode += "<P align=center><TABLE cellSpacing=\"1\" cellPadding=\"1\" width=\"95%\" border=\"0\">\n";
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD colSpan=5>Welcome <STRONG>" + Webpage.Session["Username"] + "</STRONG>. Last login was on " + ((DateTime)Webpage.Session["LastLogin"]).ToLongDateString() + ".</TD>\n";
HtmlCode += "\t</TR>\n";
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD width=\"1%\" bgColor=\"#ffff99\"></TD>\n";
HtmlCode += "\t\t<TD width=\"55%\" bgColor=\"#ffff99\">\n";
HtmlCode += "\t\t\t<P>Forum</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=\"8%\" bgColor=\"#ffff99\">\n";
HtmlCode += "\t\t\t<P>Posts</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=\"22%\" bgColor=\"#ffff99\">\n";
HtmlCode += "\t\t\t<P>Last Post</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=\"14%\" bgColor=\"#ffff99\">\n";
HtmlCode += "\t\t\t<P>Moderator</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t</TR>\n";
// Display groups
for(int GroupID = 0; ; GroupID++)
{
// If we can't read any more rows from the groups table, this GroupID does not
// exist
if(!Groups.Read("SELECT * FROM Groups WHERE GroupID='" + GroupID.ToString() + "'"))
break;
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD width=\"100%\" bgColor=\"#eeeeee\" colSpan=\"5\"><STRONG>" + Groups.GetColumn("Name") + "</STRONG></TD>\n";
HtmlCode += "\t</TR>\n";
Boards.Read("SELECT * FROM Boards WHERE GroupID='" + GroupID + "' ORDER BY ID");
// Now, display topics
for(int BoardNum = 0; BoardNum < Boards.GetNumRows(); BoardNum++)
{
Boards.SetCurrentRow(BoardNum);
Users.Read("SELECT * FROM Users WHERE ID='" + Boards.GetColumn("ModeratorID").ToString() + "'");
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD width=\"1%\" bgcolor=#eeffff><IMG src=\"blank.gif\"></TD>\n";
// Display board name...
HtmlCode += "\t\t<TD width=\"55%\" bgcolor=#ffffee><FONT size=\"2\"><A href=\"slugboards.aspx?BoardID=" + Boards.GetColumn("ID").ToString() + "\"><STRONG>" + Boards.GetColumn("Name") + "</STRONG></A><BR>";
// ...and board details
HtmlCode += "<EM>" + Boards.GetColumn("Description") + "</EM></FONT></TD>\n";
HtmlCode += "\t\t<TD align=\"center\" width=\"8%\" bgcolor=#eeffff><FONT size=\"2\">" + Boards.GetColumn("Posts").ToString() + "</FONT></TD>\n";
HtmlCode += "\t\t<TD align=\"center\" width=\"22%\" bgcolor=#ffffee><FONT size=\"2\">" + ((DateTime)Boards.GetColumn("LastUpdate")).ToLongDateString() + "</FONT><BR><FONT size=\"2\" color=red>" + ((DateTime)Boards.GetColumn("LastUpdate")).ToLongTimeString() + "</FONT></TD>\n";
HtmlCode += "\t\t<TD align=\"center\" width=\"14%\" bgcolor=#eeffff><FONT size=\"2\"><A href=\"user.aspx?UserID=" + Boards.GetColumn("ModeratorID").ToString() + "\">" + Users.GetColumn("Username") + "</A></FONT></TD>\n";
HtmlCode += "\t</TR>\n";
}
}
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD width=\"1%\" bgColor=\"#ffff99\"></TD>\n";
HtmlCode += "\t\t<TD width=\"55%\" bgColor=\"#ffff99\">\n";
HtmlCode += "\t\t\t<P>Forum</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=\"8%\" bgColor=\"#ffff99\">\n";
HtmlCode += "\t\t\t<P>Posts</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=\"22%\" bgColor=\"#ffff99\">\n";
HtmlCode += "\t\t\t<P>Last Post</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=\"14%\" bgColor=\"#ffff99\">\n";
HtmlCode += "\t\t\t<P>Moderator</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t</TR>\n";
// Finish off this bad boy
HtmlCode += "</TABLE></P>\n";
SqlConn.Close();
}
//
// GenerateHTML_Board()
//
// Generates HTML for a single message board
//
private void GenerateHTML_Board(string BoardID, ref string HtmlCode)
{
// Try to connect to the database
EzSqlConnection SqlConn = new EzSqlConnection(Webpage);
EzSqlTable Boards = new EzSqlTable(SqlConn, "Boards", Webpage.Server.MapPath("boards.xsd"));
EzSqlTable Topics = new EzSqlTable(SqlConn, "Topics", Webpage.Server.MapPath("topics.xsd"));
EzSqlTable Users = new EzSqlTable(SqlConn, "Users", Webpage.Server.MapPath("users.xsd"));
// Read the board name from the database
Boards.Read("SELECT * FROM Boards WHERE ID='" + BoardID + "'");
HtmlCode += "</span><P align=center><TABLE cellSpacing=1 cellPadding=1 width=95% border=0>\n";
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD colSpan=6>Welcome <STRONG>" + Webpage.Session["Username"] + "</STRONG>. Last login was on " + ((DateTime)Webpage.Session["LastLogin"]).ToLongDateString() + ".</TD>\n";
HtmlCode += "\t</TR>\n";
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD width=1% bgColor=#ffff99></TD>\n";
HtmlCode += "\t\t<TD width=40% bgColor=#ffff99>\n";
HtmlCode += "\t\t\t<P>Subject</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=8% bgColor=#ffff99>\n";
HtmlCode += "\t\t\t<P>Replies</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=7% bgColor=#ffff99>\n";
HtmlCode += "\t\t\t<P>Views</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=15% bgColor=#ffff99>\n";
HtmlCode += "\t\t\t<P>Topic Starter</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t\t<TD width=30% bgColor=#ffff99>\n";
HtmlCode += "\t\t\t<P>Last Post Date</P>\n";
HtmlCode += "\t\t</TD>\n";
HtmlCode += "\t</TR>\n";
Topics.Read("SELECT * FROM Topics WHERE BoardID='" + BoardID + "' ORDER BY LastUpdate DESC");
PageNum--;
int NumPages = (int)System.Math.Ceiling((double)Topics.GetNumRows() / (double)TopicsPerPage),
StartTopic = TopicsPerPage * PageNum,
EndTopic = System.Math.Min(StartTopic + TopicsPerPage, Topics.GetNumRows());
// Loop through all of the posts and output them to the HTML
for(int TopicNum = StartTopic; TopicNum < EndTopic; TopicNum++)
{
Topics.SetCurrentRow(TopicNum);
Users.Read("SELECT * FROM Users WHERE ID='" + Topics.GetColumn("UserID").ToString() + "'");
HtmlCode += "\t<TR>\n";
if((short)Webpage.Session["Type"] == 2)
HtmlCode += "\t\t<TD width=\"1%\" bgcolor=#eeffff><A href=\"delete.aspx?TopicID=" + Topics.GetColumn("ID").ToString() + "\"><IMG src=\"bigX.gif\" border=0></A></TD>\n";
else
HtmlCode += "\t\t<TD width=\"1%\" bgcolor=#eeffff><IMG src=\"blank.gif\"></TD>\n";
// Display topic subject
HtmlCode += "\t\t<TD width=\"40%\" bgcolor=#ffffee><FONT size=\"2\"><A href=\"slugboards.aspx?TopicID=" + Topics.GetColumn("ID").ToString() + "\">" + Topics.GetColumn("Subject") + "</A></TD>";
// Number of replies
HtmlCode += "\t\t<TD align=\"center\" width=\"8%\" bgcolor=#eeffff><FONT size=\"2\">" + Topics.GetColumn("Replies").ToString() + "</FONT></TD>\n";
// Number of views
HtmlCode += "\t\t<TD align=\"center\" width=\"7%\" bgcolor=#ffffee><FONT size=\"2\">" + Topics.GetColumn("Views").ToString() + "</FONT></TD>\n";
// Topic starter
HtmlCode += "\t\t<TD align=\"center\" width=\"15%\" bgcolor=#eeffff><FONT size=\"2\"><A href=\"user.aspx?UserID=" + Topics.GetColumn("UserID").ToString() + "\">" + Users.GetColumn("Username") + "</A></FONT></TD>\n";
// Last post date
HtmlCode += "\t\t<TD align=\"center\" width=\"30%\" bgcolor=#ffffee><FONT size=\"1\">" + ((DateTime)Topics.GetColumn("LastUpdate")).ToLongDateString() + "</FONT><FONT size=\"1\" color=red> " + ((DateTime)Topics.GetColumn("LastUpdate")).ToLongTimeString() + "</FONT></TD>\n";
HtmlCode += "\t</TR>\n";
}
// Display page numbers
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD colSpan=6 align=right>Pages: ";
for(PageNum = 1; PageNum <= NumPages; PageNum++)
{
HtmlCode += "<A href=\"slugboards.aspx?BoardID=" + BoardID + "&TopicsPerPage=" + TopicsPerPage + "&PageNum=" + PageNum.ToString() + "\">" + PageNum.ToString() + "</A>";
if(PageNum != NumPages)
HtmlCode += ", ";
}
HtmlCode += "\n\t</TR>\n";
// Finish off this bad boy
HtmlCode += "</TABLE></P>\n";
// Display return link
HtmlCode += "<P align=center><A href=\"slugboards.aspx\">Return to the boards</A><BR>\n";
// Display 'New Topic' button
HtmlCode += "<P align=center><A href=\"post.aspx?type=post&BoardID=" + BoardID + "\"><IMG src=\"post.gif\" border=0/></A><BR>\n";
SqlConn.Close();
}
//
// GenerateHTML_Topic()
//
// Generates HTML for a single topic
//
private void GenerateHTML_Topic(string TopicID, ref string HtmlCode)
{
// Connect to the boards database table
string BoardID;
// Try to connect to the database
EzSqlConnection SqlConn = new EzSqlConnection(Webpage);
// Initialize tables
EzSqlTable Boards = new EzSqlTable(SqlConn, "Boards", Webpage.Server.MapPath("boards.xsd"));
EzSqlTable Topics = new EzSqlTable(SqlConn, "Topics", Webpage.Server.MapPath("topics.xsd"));
EzSqlTable Messages = new EzSqlTable(SqlConn, "Messages", Webpage.Server.MapPath("messages.xsd"));
EzSqlTable Users = new EzSqlTable(SqlConn, "Users", Webpage.Server.MapPath("users.xsd"));
// Read the topic
Topics.Read("SELECT * FROM Topics WHERE ID='" + TopicID + "'");
// Get the BoardID
BoardID = Topics.GetColumn("BoardID").ToString();
// Read the board info
Boards.Read("SELECT * FROM Boards WHERE ID='" + BoardID + "'");
// One more topic viewing...
Topics.SetColumn("Views", (int)Topics.GetColumn("Views") + 1);
Topics.Update();
// Clear the HTML code
HtmlCode = "";
// Get the id of the first post
for(long MessageID = (long)Topics.GetColumn("FirstMessageID"); MessageID != -1;)
{
Messages.Read("SELECT * FROM Messages WHERE ID='" + MessageID.ToString() + "'");
Users.Read("SELECT * FROM Users WHERE ID='" + Messages.GetColumn("UserID").ToString() + "'");
HtmlCode += "<P align=center>\n";
HtmlCode += "<TABLE cellSpacing=1 cellPadding=3 width=95% border=0>\n";
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD width=50% bgColor=#ffff99>";
HtmlCode += Users.GetColumn("Username") + "</TD>\n";
// Only display the delete button if the user posted the message or the user is an admin
if((int)Users.GetColumn("ID") == (int)Webpage.Session["ID"] || (short)Webpage.Session["Type"] == 2)
{
HtmlCode += "\t\t<TD width=50% bgColor=#ffff99 align=right>";
HtmlCode += "<A href=\"user.aspx?UserID=" + Users.GetColumn("ID").ToString() + "\"><IMG src=\"userinfo.gif\" border=0></IMG></A>";
HtmlCode += "<IMG src=\"delete.gif\"></IMG></TD>\n";
}
else
{
HtmlCode += "\t\t<TD width=50% bgColor=#ffff99 align=right>";
HtmlCode += "<A href=\"user.aspx?UserID=" + Users.GetColumn("ID").ToString() + "\"><IMG src=\"userinfo.gif\" border=0></IMG></A></TD>\n";
}
HtmlCode += "\t</TR>\n";
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD width=100% colSpan=2 bgColor=#eeffff>";
HtmlCode += Messages.GetColumn("Subject") + "</TD>\n";
HtmlCode += "\t</TR>\n";
HtmlCode += "\t<TR>\n";
HtmlCode += "\t\t<TD width=100% colSpan=2 bgColor=#ffffee cellpadding=4>" + Messages.GetColumn("Text") + "<BR><BR></TD>\n";
HtmlCode += "\t</TR>\n";
HtmlCode += "</TABLE>\n";
HtmlCode += "<BR>\n";
MessageID = (long)Messages.GetColumn("NextMessageID");
}
HtmlCode += "<P align=center><A href=\"slugboards.aspx?BoardID=" + BoardID + "\">Return to " + Boards.GetColumn("Name") + "</A><BR>\n";
HtmlCode += "<P align=center><A href=\"post.aspx?type=reply&TopicID=" + TopicID + "#Post\"><IMG src=\"reply.gif\" border=0/></A><BR>\n";
SqlConn.Close();
}
private string BoardID,
TopicID;
private int TopicsPerPage,
PageNum;
private Page Webpage;
};
--- NEW FILE: bigX.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: blank.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: delete.aspx ---
<%@ Page language="C#" Codebehind="delete.aspx.cs" AutoEventWireup="false" Inherits="slugtalk.delete" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>delete</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="style.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<IMG src="slugboard.jpg">
<P align="center"><FONT size="6"> Delete</FONT></P>
<P align="center">
<asp:Label id="Message" runat="server"></asp:Label></P>
<P align="center">
<asp:ImageButton id="DeleteIt" runat="server" ImageUrl="verify_delete.gif"></asp:ImageButton></P>
<P align="center">
<asp:Label id="Message2" runat="server"></asp:Label></P>
</form>
</body>
</HTML>
--- NEW FILE: delete.aspx.cs ---
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace slugtalk
{
/// <summary>
/// Summary description for delete.
/// </summary>
public class delete : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Message;
protected System.Web.UI.WebControls.Label Message2;
protected System.Web.UI.WebControls.ImageButton DeleteIt;
private void Page_Load(object sender, System.EventArgs e)
{
TopicID = Request.QueryString.Get("TopicID");
MessageID = Request.QueryString.Get("MessageID");
try
{
if(TopicID != null)
int.Parse(TopicID);
else
throw(new System.Exception("TopicID required by delete.aspx"));
if(MessageID != null)
int.Parse(MessageID);
}
catch(System.Exception exception)
{
Response.Redirect("error.aspx?Message=" + exception.Message);
}
// Create a connection and two tables
EzSqlConnection SqlConn = new EzSqlConnection(this);
EzSqlTable Boards = new EzSqlTable(SqlConn, "Boards", Server.MapPath("boards.xsd"));
EzSqlTable Topics = new EzSqlTable(SqlConn, "Topics", Server.MapPath("topics.xsd"));
EzSqlTable Messages = null;
if(!Topics.Read("SELECT * FROM Topics WHERE ID='" + TopicID + "'"))
Response.Redirect("error.aspx?Message=Topic does not exist");
if(!Boards.Read("SELECT * FROM Boards WHERE ID='" + Topics.GetColumn("BoardID").ToString() + "'"))
Response.Redirect("error.aspx?Message=Unknown error");
// Deleting an entire topic?
if(MessageID == null)
{
Message.Text = "Are you sure you want to delete the topic '<STRONG>" +
Topics.GetColumn("Subject") + "</STRONG>'?";
}
// Deleting an message in a topic
else
{
Messages = new EzSqlTable(SqlConn, "Messages", Server.MapPath("messages.xsd"));
if(!Messages.Read("SELECT * FROM Messages WHERE ID='" + MessageID + "'"))
Response.Redirect("error.aspx?Message=Message does not exist");
Message.Text = "Are you sure you want to delete the message with subject <STRONG>" +
Messages.GetColumn("Subject") + "</STRONG> in the topic <STRONG>" + Topics.GetColumn("Subject") + "</STRONG>?";
}
// See if the user has proper authority to delete
if((short)Session["Type"] == 2 ||
(Messages != null && ((int)Messages.GetColumn("UserID") == (int)Session["ID"])) ||
((int)Boards.GetColumn("ModeratorID") == (int)Session["ID"]))
{
CanDelete = true;
}
else
{
Message.Text = "You do <STRONG>not</STRONG> have proper permissions to delete this topic and or message\n";
DeleteIt.Visible = false;
}
// Display return message
if(MessageID != null)
{
Message2.Text = "Please, <A href=\"slugboards.aspx?TopicID=" + TopicID + "\">return</A> me to the boards";
}
else
{
Message2.Text = "Please, <A href=\"slugboards.aspx?BoardID =" + Topics.GetColumn("BoardID").ToString() +
"\">return</A> me to the boards";
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.DeleteIt.Click += new System.Web.UI.ImageClickEventHandler(this.DeleteIt_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DeleteIt_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// First, check to see if the user has proper authority to be deleting this
// shiznit
if(!CanDelete)
return;
if(MessageID == null)
{
DeleteTopic();
}
else
{
DeleteMessage();
}
}
//
// DeleteTopic()
//
// Deletes a topic from the message board.
//
private void DeleteTopic()
{
EzSqlConnection SqlConn = new EzSqlConnection(this);
EzSqlTable Boards = new EzSqlTable(SqlConn, "Boards", Server.MapPath("boards.xsd"));
EzSqlTable Topics = new EzSqlTable(SqlConn, "Topics", Server.MapPath("topics.xsd"));
EzSqlTable Messages = new EzSqlTable(SqlConn, "Messages", Server.MapPath("messages.xsd"));
// First, read the topic and board from the database
if(!Topics.Read("SELECT * FROM Topics WHERE ID='" + TopicID + "'"))
Response.Redirect("error.aspx?Message=Topic no longer exists");
if(!Boards.Read("SELECT * FROM Boards WHERE ID='" + Topics.GetColumn("BoardID").ToString() + "'"))
Response.Redirect("error.aspx?Message=Unknown error");
// Now, delete the messages from the database table
long MessageID = (long)Topics.GetColumn("FirstMessageID");
while(MessageID != -1)
{
// Error in the messages, we don't want to crap out because we still
// want to delete the topic
if(!Messages.Read("SELECT * FROM Messages WHERE ID='" + MessageID + "'"))
break;
MessageID = (long)Messages.GetColumn("NextMessageID");
// Delete the message
Messages.Delete();
Messages.Update();
}
// Now, delete the topic
Topics.Delete();
Topics.Update();
Boards.SetColumn("Posts", (int)Boards.GetColumn("Posts") - 1);
Boards.SetColumn("LastUpdate", DateTime.Now);
Boards.Update();
Response.Redirect("slugboards.aspx?BoardID=" + Topics.GetColumn("BoardID").ToString());
}
//
// DeleteMessage()
//
// Deletes a message from the message board.
//
private void DeleteMessage()
{
}
private string TopicID,
MessageID;
private bool CanDelete = false;
};
}
--- NEW FILE: delete.aspx.resx ---
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.TrayAutoArrange" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
</root>
--- NEW FILE: error.aspx ---
<%@ Page language="c#" Codebehind="error.aspx.cs" AutoEventWireup="false" Inherits="slugtalk.error" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>error</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="style.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<IMG src="slugboard.jpg">
<P align="center"><FONT size="6">Error</FONT></P>
<P align=center>An error has occurred (Message:
<asp:Label id="Message" runat="server"></asp:Label>). Please
contact the system administrator.</P>
<P align=center>Click <A href="slugboards.aspx">here</A> to return to the message board home
page</P>
<P align=center> </P>
<P align=center><FONT size=2>© 2003 University of California at Santa Cruz. All
rights reserved.</FONT></P>
<P align=center>
<BR> </P>
</form>
</body>
</HTML>
--- NEW FILE: error.aspx.cs ---
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
// ERROR CODES
//
// 0 - Sql Connection Error
// 1 - URL Query String Error
// 999 - Unknown error
namespace slugtalk
{
/// <summary>
/// Summary description for error.
/// </summary>
public class error : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Message;
private void Page_Load(object sender, System.EventArgs e)
{
string MessageString;
MessageString = Request.QueryString.Get("Message");
if(MessageString == null)
MessageString = "Unknown";
Message.Text = MessageString;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
--- NEW FILE: error.aspx.resx ---
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.TrayAutoArrange" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
</root>
--- NEW FILE: logout.aspx ---
<%@ Page language="c#" Codebehind="logout.aspx.cs" AutoEventWireup="false" Inherits="slugtalk.logout" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>logout</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="style.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<IMG src="slugboard.jpg">
<P align="center"><FONT size="4"></FONT> </P>
<P align="center"><FONT size="4">Logging out... Please wait...</FONT></P>
<P align="center"> </P>
<P align="center"><FONT size="2">© 2003 University of California at Santa Cruz. All
rights reserved.</FONT></P>
</form>
</body>
</HTML>
--- NEW FILE: logout.aspx.cs ---
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace slugtalk
{
/// <summary>
/// Summary description for logout.
/// </summary>
public class logout : CheckLogin
{
private void Page_Load(object sender, System.EventArgs e)
{
Logout();
// Redirect to the login page
Response.Redirect("login.aspx");
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
--- NEW FILE: logout.aspx.resx ---
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.TrayAutoArrange" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
</root>
--- NEW FILE: newpass.aspx ---
<%@ Page language="c#" Codebehind="newpass.aspx.cs" AutoEventWireup="false" Inherits="slugtalk.newpass" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>newpass</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="style.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<IMG src="slugboard.jpg">
<P align="center"><FONT size="6">New Password Request</FONT></P>
<P align="center">Please, enter your Username and Email you registered with
and we will send you a new password.</P>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" align="center" border="0">
<TR>
<TD style="HEIGHT: 22px" align="center" colSpan="2"><asp:label id="Message" runat="server" Font-Bold="True" ForeColor="Red"></asp:label></TD>
</TR>
<TR>
<TD style="WIDTH: 126px; HEIGHT: 18px">Username:</TD>
<TD style="HEIGHT: 18px"><asp:textbox id="Username" runat="server" Width="144px"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 126px">Email:</TD>
<TD><asp:textbox id="Email" runat="server" TextMode="Password"></asp:textbox></TD>
</TR>
<TR>
<TD align="center" colSpan="2" rowSpan="1">
<P><asp:imagebutton id="Submit" runat="server" ImageUrl="password.gif"></asp:imagebutton></P>
</TD>
</TR>
</TABLE>
<P align="center"><FONT size="2">© 2003 University of California at Santa Cruz. All
rights reserved.</FONT></P>
</form>
</body>
</HTML>
--- NEW FILE: newpass.aspx.cs ---
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Mail;
namespace slugtalk
{
/// <summary>
/// Summary description for newpass.
/// </summary>
public class newpass : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Message;
protected System.Web.UI.WebControls.TextBox Username;
protected System.Web.UI.WebControls.TextBox Email;
protected System.Web.UI.WebControls.ImageButton Submit;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Submit.Click += new System.Web.UI.ImageClickEventHandler(this.Submit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Submit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
SmtpMail mail;
}
}
}
--- NEW FILE: newpass.aspx.resx ---
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.TrayAutoArrange" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
</root>
--- NEW FILE: password.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: verify_delete.gif ---
(This appears to be a binary file; contents omitted.)
Index: CheckLogin.cs
===================================================================
RCS file: /cvsroot/slugtalk/slugboards/slugtalk/CheckLogin.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CheckLogin.cs 4 Jan 2004 05:08:31 -0000 1.1
--- CheckLogin.cs 5 Jan 2004 11:54:13 -0000 1.2
***************
*** 23,33 ****
public bool CheckForLogin()
{
! // check to see if one of three things is true
! // (1) there is no username stored in the session
! // (2) there is no password stored in the session
! // (3) the username and/or password are invalid
! // if any of the above are true, return false
! if(Session["username"] == null || Session["password"] == null ||
! !TryLogin((string)Session["username"], (string)Session["password"]))
{
return false;
--- 23,33 ----
public bool CheckForLogin()
{
! // Check to see if one of three things is true
! // (1) There is no username stored in the session
! // (2) There is no password stored in the session
! // (3) The username and/or password are invalid
! // If any of the above are true, return false
! if(Session["Username"] == null || Session["Password"] == null ||
! !TryLogin((string)Session["Username"], (string)Session["Password"]))
{
return false;
***************
*** 44,88 ****
public bool TryLogin(string Username, string Password)
{
! bool retVal = false;
! EzSqlConnection sqlConn = new EzSqlConnection();
! EzSqlTable users = new EzSqlTable("Users", Server.MapPath("users.xsd"));
!
! // hash the password
string HashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(Password, "MD5");
! // open the SQL database
! sqlConn.Open();
!
! // let's run our query and fill a dataset
! if(users.Read(sqlConn.GetConnection(), "SELECT * FROM Users WHERE Username='" + Username + "'"))
{
! if((string)users.GetColumn("Password") == HashedPassword)
{
// Save all of the user information in the session object
Session["Username"] = Username;
Session["Password"] = Password;
! Session["Email"] = users.GetColumn("Email");
! Session["Name"] = users.GetColumn("Name");
! Session["Major"] = users.GetColumn("Major");
! Session["College"] = users.GetColumn("College");
! Session["Homepage"] = users.GetColumn("Homepage");
! Session["AIM"] = users.GetColumn("AIM");
! Session["ICQ"] = users.GetColumn("ICQ");
! Session["Yahoo"] = users.GetColumn("Yahoo");
! Session["MSN"] = users.GetColumn("MSN");
! Session["Birthdate"]= users.GetColumn("Birthdate");
! Session["Bio"] = users.GetColumn("Bio");
! Session["Type"] = users.GetColumn("Type");
! Session["UserInfo"] = users.GetColumn("UserInfo");
! Session["ID"] = users.GetColumn("ID");
! retVal = true;
}
}
! // close the connection
! sqlConn.Close();
! return retVal;
}
};
--- 44,110 ----
public bool TryLogin(string Username, string Password)
{
! bool RetVal = false;
!
! // Try to connect to the database
! EzSqlConnection SqlConn = new EzSqlConnection(this);
!
! // Hash the password
string HashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(Password, "MD5");
! // Let's run our query and fill a dataset
! EzSqlTable Users = new EzSqlTable(SqlConn, "Users", Server.MapPath("users.xsd"));
! if(Users.Read("SELECT * FROM Users WHERE Username='" + Username + "'"))
{
! if((string)Users.GetColumn("Password") == HashedPassword)
{
// Save all of the user information in the session object
Session["Username"] = Username;
Session["Password"] = Password;
! Session["Email"] = Users.GetColumn("Email");
! Session["Type"] = Users.GetColumn("Type");
! Session["UserInfo"] = Users.GetColumn("UserInfo");
! Session["LastLogin"]= Users.GetColumn("LastLogin");
! Session["ID"] = Users.GetColumn("ID");
! // Set the last login time
! Users.SetColumn("LastLogin", DateTime.Now);
! Users.Update();
!
! RetVal = true;
}
}
! SqlConn.Close();
! return RetVal;
}
+
+ //
+ // Logout()
+ //
+ public void Logout()
+ {
+ // Try to connect to the database
+ EzSqlConnection SqlConn = new EzSqlConnection(this);
+
+ // Let's run our query and fill a dataset
+ EzSqlTable Users = new EzSqlTable(SqlConn, "Users", Server.MapPath("users.xsd"));
+ if(Users.Read("SELECT * FROM Users WHERE Username='" + Session["Username"] + "'"))
+ {
+ // Remove all of the Session information
+ Session.Remove("Username");
+ Session.Remove("Password");
+ Session.Remove("Email");
+ Session.Remove("Type");
+ Session.Remove("UserInfo");
+ Session.Remove("LastLogin");
+ Session.Remove("ID");
+
+ // Store the datetime in the database
+ Users.SetColumn("LastLogin", DateTime.Now);
+ Users.Update();
+ }
+
+ SqlConn.Close();
+ }
};
Index: SQL.cs
===================================================================
RCS file: /cvsroot/slugtalk/slugboards/slugtalk/SQL.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SQL.cs 4 Jan 2004 05:08:31 -0000 1.1
--- SQL.cs 5 Jan 2004 11:54:13 -0000 1.2
***************
*** 2,5 ****
--- 2,6 ----
using System.Data.SqlClient;
using System.Web;
+ using System.Web.UI;
// EzSqlConnection
***************
*** 8,47 ****
class EzSqlConnection
{
! //
! // Open()
! //
! // Opens the connection.
! //
! public bool Open()
! {
! // !!!!make changes here to open a connection to a different SQL source!!!!
! sqlConn = new SqlConnection("data source=(local)\\ESQL;" +
! "database=slugboards;integrated security=false;user id=test;password=test;");
! sqlConn.Open();
!
! return true;
! }
! //
! // Close()
! //
! // Closes the connection.
! //
! public void Close()
! {
! sqlConn.Close();
! }
! //
! // GetConnection()
! //
! // Returns the SqlConnection object that corresponds to the connection.
! //
! public SqlConnection GetConnection()
! {
! return sqlConn;
! }
! private SqlConnection sqlConn; // the actual connection
};
--- 9,55 ----
class EzSqlConnection
{
! //
! // EzSqlConnection()
! //
! // Constructor for class EzSqlConnection
! ...
[truncated message content] |