Update of /cvsroot/slugtalk/slugboards/slugtalk
In directory sc8-pr-cvs1:/tmp/cvs-serv25636
Added Files:
CheckLogin.cs HeaderFooter.cs SQL.cs Thumbs.db UCSC.cs
base.gif boards.xsd boards.xsx delete.gif groups.xsd
groups.xsx help.gif info.gif logout.gif messages.xsd
messages.xsx newtopic.gif on.gif post.aspx post.aspx.cs
post.aspx.resx register.gif reply.gif slugboards.aspx
slugboards.aspx.cs slugboards.aspx.resx stats.gif submit.gif
textbox.gif topics.xsd topics.xsx user.aspx user.aspx.cs
user.aspx.resx userinfo.gif users.xsd users.xsx
vs-76543744029610391_tmp.htm
Log Message:
New files.
--- NEW FILE: CheckLogin.cs ---
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
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.Security;
// Just derive a class from this class to add Login capabilities to your
// webpage! Awesome!
public class CheckLogin : System.Web.UI.Page
{
//
// CheckForLogin()
//
// Checks the Session state for a login.
//
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;
}
return true;
}
//
// TryLogin()
//
// Tries to login the user with the specified username and password.
//
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;
}
};
--- NEW FILE: HeaderFooter.cs ---
using System.Web.UI;
public class HeaderFooter
{
//
// WriteHeader
//
// Writes the HTML header for the page
//
public void WriteHeader(HtmlTextWriter output)
{
output.WriteLine(" <div id=\"top\">");
output.WriteLine(" <img src=\"slugboard.jpg\"><br/>");
output.WriteLine(" </div>");
output.WriteLine(" <div id=\"layer1\">");
output.WriteLine(" <table cellpadding=\"20\"/>");
output.WriteLine(" <tr>");
output.WriteLine(" <td valign='top'>");
output.WriteLine(" <a href=\"slugboards.aspx?topic=0\">Majors</a><br/>");
output.WriteLine(" <a href=\"slugboards.aspx?topic=1\">Colleges</a><br/>");
output.WriteLine(" <a href=\"slugboards.aspx?topic=2\">Organizations</a><br/>");
output.WriteLine(" <a href=\"slugboards.aspx?topic=3\">Recreation</a><br/>");
output.WriteLine(" <a href=\"slugboards.aspx?topic=4\">Incoming Students</a><br/>");
output.WriteLine(" <a href=\"slugboards.aspx?topic=5\">Dating</a><br/>");
output.WriteLine(" </td>");
output.WriteLine(" <td width='650'>");
}
//
// WriteFooter
//
// Writes the HTML footer for the page
//
public void WriteFooter(HtmlTextWriter output)
{
output.WriteLine(" </td>");
output.WriteLine(" </tr>");
output.WriteLine(" </table>");
output.WriteLine(" </div>");
}
};
--- NEW FILE: SQL.cs ---
using System.Data;
using System.Data.SqlClient;
using System.Web;
// EzSqlConnection
//
// Simplifies establishing an SQL connection
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
};
// EzSqlUsersTable
//
// Simplifies accessing SQL tables
class EzSqlTable
{
//
// EzSqlTable()
//
// Constructor for EzSqlTable. Initializes the name of the table that we are
// accessing.
//
public EzSqlTable(string NewTableName, string NewXMLSchema)
{
TableName = NewTableName;
XMLSchema = NewXMLSchema;
}
//
// Read()
//
// Reads a row from a table.
//
public bool Read(SqlConnection SqlConn, string Command)
{
// Let's run our query and fill a dataset
Adapter = new SqlDataAdapter(Command, SqlConn);
CommandBuilder = new SqlCommandBuilder(Adapter);
CommandBuilder.QuotePrefix = "[";
CommandBuilder.QuoteSuffix = "]";
// Reset the data set
DS = new DataSet();
DS.ReadXmlSchema(XMLSchema);
// Read the rows!
if(Adapter.Fill(DS, TableName) == 0)
{
// Since we weren't able to read the table or the row from the data source,
// create a new table and insert into it a default row
DS.Tables[TableName].Rows.Add(DS.Tables[TableName].NewRow());
return false;
}
return true;
}
//
// NewRow()
//
// Creates a new row in the table.
//
public void NewRow(SqlConnection SqlConn)
{
// Let's run our query and fill a dataset
Adapter = new SqlDataAdapter("SELECT * FROM " + TableName, SqlConn);
CommandBuilder = new SqlCommandBuilder(Adapter);
CommandBuilder.QuotePrefix = "[";
CommandBuilder.QuoteSuffix = "]";
// Reset the data set
DS = new DataSet();
DS.ReadXmlSchema(XMLSchema);
// Read the rows!
if(!DS.Tables.Contains(TableName))
DS.Tables.Add(TableName);
DS.Tables[TableName].Rows.Add(DS.Tables[TableName].NewRow());
}
//
// Write()
//
// Writes a row into the table.
//
public void Write()
{
// Update the database with the new data
Adapter.Update(DS, TableName);
}
//
// GetNumRows()
//
// Returns the number of rows in the datatable.
//
public int GetNumRows()
{
return DS.Tables[TableName].Rows.Count;
}
//
// SetCurrentRow()
//
// Sets the current row.
//
public void SetCurrentRow(int NewCurrentRow)
{
if(NewCurrentRow >= 0 && NewCurrentRow < DS.Tables[TableName].Rows.Count)
CurrentRow = NewCurrentRow;
}
//
// GetColumn()
//
// Returns a column from the table.
//
public object GetColumn(string ColName)
{
return DS.Tables[TableName].Rows[CurrentRow][ColName];
}
//
// SetColumn()
//
// Sets a column of the table.
//
public void SetColumn(string ColName, object NewValue)
{
DS.Tables[TableName].Rows[CurrentRow][DS.Tables[TableName].Columns[ColName]] = NewValue;
}
private string TableName;
private string XMLSchema;
private int CurrentRow = 0;
private DataSet DS = new DataSet(); // The data read in
private SqlDataAdapter Adapter;
private SqlCommandBuilder CommandBuilder;
};
--- NEW FILE: Thumbs.db ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: UCSC.cs ---
using System.Collections.Specialized;
class UCSCInfo
{
public UCSCInfo()
{
// Add the majors
Majors.Add("Undecided", "0");
Majors.Add("American Studies", "1");
Majors.Add("Anthropology", "2");
Majors.Add("Art", "3");
Majors.Add("Astrophysics", "4");
Majors.Add("Biochemistry and Molecular Biology", "5");
Majors.Add("Bioinformatics", "6");
Majors.Add("Biological Sciences", "7");
Majors.Add("Business Management Economics", "8");
Majors.Add("Chemistry and Biochemistry", "9");
Majors.Add("Classical Studies", "10");
Majors.Add("Community Studies", "11");
Majors.Add("Computer Engineering", "12");
Majors.Add("Computer Science", "13");
Majors.Add("Dual-Degree Engineering", "14");
Majors.Add("Earth Sciences", "15");
Majors.Add("East Asian Studies", "16");
Majors.Add("Ecology and Evolution", "17");
Majors.Add("Economics", "18");
Majors.Add("Education and Teaching", "19");
Majors.Add("Electrical Engineering", "20");
Majors.Add("Environmental Studies", "21");
Majors.Add("Field and Exchange Programs", "22");
Majors.Add("Film and Digital Media", "23");
Majors.Add("German Studies", "24");
Majors.Add("Global Economics", "25");
Majors.Add("Health Sciences", "26");
Majors.Add("History", "27");
Majors.Add("History of Art and Visual Culture", "28");
Majors.Add("Individual Study", "29");
Majors.Add("Information Systems Management", "30");
Majors.Add("Italian Studies", "31");
Majors.Add("Language Studies", "32");
Majors.Add("Latin American and Latino Studies", "33");
Majors.Add("Legal Studies", "34");
Majors.Add("Linguistics", "35");
Majors.Add("Literature", "36");
Majors.Add("Marine Biology", "37");
Majors.Add("Mathematics", "38");
Majors.Add("Molecular, Cell, and Developmental Biology", "39");
Majors.Add("Music", "39");
Majors.Add("Neuroscience and Behavior", "40");
Majors.Add("Ocean Sciences", "41");
Majors.Add("Philosophy", "42");
Majors.Add("Physics", "43");
Majors.Add("Plant Sciences", "44");
Majors.Add("Politics", "45");
Majors.Add("Prelaw", "46");
Majors.Add("Premedicine", "47");
Majors.Add("Psychology", "48");
Majors.Add("Sociology", "49");
Majors.Add("South and Southeast Asian Studies", "50");
Majors.Add("Theater Arts", "51");
Majors.Add("Women's Studies", "52");
Majors.Add("Writing", "53");
// Add the colleges
Colleges.Add("Unaffiliated", "0");
Colleges.Add("Cowell", "1");
Colleges.Add("Stevenson", "2");
Colleges.Add("Crown", "3");
Colleges.Add("Merrill", "4");
Colleges.Add("Porter", "5");
Colleges.Add("Kresge", "6");
Colleges.Add("Oakes", "7");
Colleges.Add("College 8", "8");
Colleges.Add("College 9", "9");
Colleges.Add("College 10", "10");
}
//
// GetNumColleges()
//
// Returns the number of colleges at the university
//
public int GetNumColleges()
{
return Colleges.Count;
}
//
// GetCollege()
//
// Returns the name of the college corresponding to the index.
//
public string GetCollege(int CollegeNum)
{
return Colleges.Keys.Get(CollegeNum);
}
//
// GetCollegeIndex()
//
// Returns the index that corresponds to the college that corresponds to index.
//
public string GetCollegeIndex(int CollegeNum)
{
return Colleges.Get(CollegeNum);
}
//
// GetNumMajors()
//
// Returns the number of majors at the university
//
public int GetNumMajors()
{
return Majors.Count;
}
//
// GetMajor()
//
// Returns the name of the major corresponding to the index.
//
public string GetMajor(int MajorNum)
{
return Majors.Keys.Get(MajorNum);
}
//
// GetMajorIndex()
//
// Returns the index that corresponds to the major that corresponds to index.
//
public string GetMajorIndex(int MajorNum)
{
return Majors.Get(MajorNum);
}
// List of majors
private NameValueCollection Majors = new NameValueCollection();
private NameValueCollection Colleges = new NameValueCollection();
};
--- NEW FILE: base.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: boards.xsd ---
<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Boards">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="0" />
<xs:element name="Description" type="xs:string" minOccurs="0" />
<xs:element name="Posts" type="xs:int" minOccurs="0" />
<xs:element name="ModeratorID" type="xs:int" minOccurs="0" />
<xs:element name="LastUpdate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ID" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
--- NEW FILE: boards.xsx ---
<?xml version="1.0" encoding="utf-8"?>
<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
<XSDDesignerLayout layoutVersion="2" viewPortLeft="-1082" viewPortTop="0" zoom="100">
<Boards_XmlElement left="-1032" top="1005" width="9366" height="4657" selected="0" zOrder="1" index="0" expanded="1" />
</XSDDesignerLayout>
--- NEW FILE: delete.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: groups.xsd ---
<?xml version="1.0" standalone="yes" ?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Groups">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="0" />
<xs:element name="GroupID" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
--- NEW FILE: groups.xsx ---
<?xml version="1.0" encoding="utf-8"?>
<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
<XSDDesignerLayout layoutVersion="2" viewPortLeft="0" viewPortTop="0" zoom="100">
<Groups_XmlElement left="317" top="254" width="5292" height="2963" selected="0" zOrder="1" index="0" expanded="1" />
</XSDDesignerLayout>
--- NEW FILE: help.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: info.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: logout.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: messages.xsd ---
<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Messages">
<xs:complexType>
<xs:sequence>
<xs:element name="Subject" type="xs:string" minOccurs="0" />
<xs:element name="Text" type="xs:string" minOccurs="0" />
<xs:element name="UserID" type="xs:int" minOccurs="0" />
<xs:element name="PostDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="NextMessageID" type="xs:long" minOccurs="0" />
<xs:element name="ID" type="xs:long" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
--- NEW FILE: messages.xsx ---
<?xml version="1.0" encoding="utf-8"?>
<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
<XSDDesignerLayout layoutVersion="2" viewPortLeft="-3119" viewPortTop="0" zoom="100">
<Messages_XmlElement left="-3069" top="265" width="12065" height="4656" selected="0" zOrder="1" index="0" expanded="1" />
</XSDDesignerLayout>
--- NEW FILE: newtopic.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: on.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: post.aspx ---
<%@ Page language="c#" Codebehind="post.aspx.cs" AutoEventWireup="false" Inherits="slugtalk.post" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>post</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">
<P align="left">
<IMG src="slugboard.jpg">
</P>
<P align="center"><FONT size="6">Post</FONT></P>
<P align="center">
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" border="0">
<TR>
<TD><A href="user.aspx"><IMG src="info.gif" border="0"></A></TD>
<TD><A href="stats.aspx"><IMG src="stats.gif" border="0"></A></TD>
<TD><A href="help.aspx"><IMG src="help.gif" border="0"></A></TD>
<TD><A href="logout.aspx"><IMG src="logout.gif" border="0"></A></TD>
</TR>
</TABLE>
</P>
<P>
<asp:Label id="HtmlCode" runat="server"></asp:Label></P>
<P align="center">
<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="500" border="0">
<TR>
<TD width="100%" align="left" bgColor="#ffffcc" colSpan="2">
<P align="center">
<asp:Label id="Message" runat="server" BackColor="#FFFFCC"></asp:Label></P>
</TD>
</TR>
<TR>
<TD style="WIDTH: 78px" align="left" bgColor="#ffffcc" colSpan="1" rowSpan="1">
<P align="left">Subject</P>
</TD>
<TD bgColor="#ffffcc">
<asp:TextBox id="Subject" runat="server" Width="247px"></asp:TextBox></TD>
</TR>
<TR>
<TD style="WIDTH: 78px" bgColor="#ccffff" vAlign="top" colSpan="1" rowSpan="1">Message</TD>
<TD bgColor="#ccffff">
<asp:TextBox id="Text" runat="server" Width="344px" Height="170px" TextMode="MultiLine"></asp:TextBox></TD>
</TR>
<TR>
</TR>
</TABLE>
</P>
<P align="center">
<asp:ImageButton id="Submit" runat="server" ImageUrl="submit.gif"></asp:ImageButton></P>
</form>
</body>
</HTML>
--- NEW FILE: post.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 post.
/// </summary>
public class post : CheckLogin
{
protected System.Web.UI.WebControls.TextBox Subject;
protected System.Web.UI.WebControls.Label Message;
protected System.Web.UI.WebControls.ImageButton Submit;
protected System.Web.UI.WebControls.Label HtmlCode;
protected string BoardID = null;
protected System.Web.UI.WebControls.TextBox Text;
protected string TopicID = null;
private void Page_Load(object sender, System.EventArgs e)
{
// Protect this page
if(!CheckForLogin())
{
Response.Redirect("login.aspx");
}
// Get the BoardID and TopicID from the URL
BoardID = Request.QueryString.Get("BoardID");
TopicID = Request.QueryString.Get("TopicID");
EzSqlConnection SqlConn = new EzSqlConnection();
// Connect to the SQL database
SqlConn.Open();
// Replying to a post
if(TopicID != null)
{
EzSqlTable Topics = new EzSqlTable("Topics", Server.MapPath("topics.xsd"));
Topics.Read(SqlConn.GetConnection(), "SELECT * FROM Topics WHERE ID='" + TopicID.ToString() + "'");
Message.Text = "User <B>" + Session["Username"] + "</B> replying to topic <B>" + Topics.GetColumn("Subject") + "</B>\n";
Subject.Text = "RE: " + Topics.GetColumn("Subject");
Page_DisplayTopic();
}
// Starting a new post
else
{
EzSqlTable Boards = new EzSqlTable("Boards", Server.MapPath("boards.xsd"));
Boards.Read(SqlConn.GetConnection(), "SELECT * FROM Boards WHERE ID='" + BoardID.ToString() + "'");
Message.Text = "User <B>" + Session["Username"] + "</B> posting to board <B>" + Boards.GetColumn("Name") + "</B>\n";
}
SqlConn.Close();
}
private void Page_DisplayTopic()
{
// Connect to the boards database table
EzSqlConnection SqlConn = new EzSqlConnection();
EzSqlTable Topics = new EzSqlTable("Topics", Server.MapPath("topics.xsd"));
EzSqlTable Messages = new EzSqlTable("Messages", Server.MapPath("messages.xsd"));
EzSqlTable Users = new EzSqlTable("Users", Server.MapPath("users.xsd"));
// Open the SQL connection
SqlConn.Open();
Topics.Read(SqlConn.GetConnection(), "SELECT * FROM Topics WHERE ID='" + TopicID + "'");
// Clear the HTML code
HtmlCode.Text = "";
// Get the id of the first post
for(long MessageID = (long)Topics.GetColumn("FirstMessageID"); MessageID != -1;)
{
Messages.Read(SqlConn.GetConnection(), "SELECT * FROM Messages WHERE ID='" + MessageID.ToString() + "'");
Users.Read(SqlConn.GetConnection(), "SELECT * FROM Users WHERE ID='" + Messages.GetColumn("UserID").ToString() + "'");
HtmlCode.Text += "<P align=center>\n";
HtmlCode.Text += "<TABLE cellSpacing=1 cellPadding=1 width=95% border=0>\n";
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=100% bgColor=#ffff99>";
HtmlCode.Text += Users.GetColumn("Username") + "</TD>\n";
HtmlCode.Text += "\t</TR>\n";
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=100% bgColor=#ccffff>";
HtmlCode.Text += "Subject: " + Messages.GetColumn("Subject") + "</TD>\n";
HtmlCode.Text += "\t</TR>\n";
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=100% border=1>" + Messages.GetColumn("Text") + "</TD>\n";
HtmlCode.Text += "\t</TR>\n";
HtmlCode.Text += "</TABLE>\n";
HtmlCode.Text += "<BR>\n";
MessageID = (long)Messages.GetColumn("NextMessageID");
}
// Close the SQL connection
SqlConn.Close();
}
#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)
{
// Are we posting a reply?
if(TopicID != null)
{
Post_Reply();
}
// No, we are posting a new topic
else
{
Post_NewTopic();
}
}
//
// Post_Reply()
//
// Posts a reply to the SQL database.
//
private void Post_Reply()
{
EzSqlConnection SqlConn = new EzSqlConnection();
EzSqlTable Topics = new EzSqlTable("Topics", Server.MapPath("topics.xsd"));
EzSqlTable Messages = new EzSqlTable("Messages", Server.MapPath("messages.xsd"));
// Open the connection
SqlConn.Open();
Topics.Read(SqlConn.GetConnection(), "SELECT * FROM Topics WHERE ID='" + TopicID + "'");
// Get the current date and time and convert it into an ID number
DateTime CurrentDateTime = DateTime.Now;
long ID = ((CurrentDateTime.Year & 0x000003FF) << 30) |
((CurrentDateTime.DayOfYear & 0x000001FF) << 21) |
((CurrentDateTime.Hour & 0x0000001F) << 16) |
((CurrentDateTime.Second & 0x0000003F) << 10) |
((CurrentDateTime.Millisecond & 0x000003FF));
// Update old last post
Messages.Read(SqlConn.GetConnection(), "SELECT * FROM Messages WHERE ID='" + Topics.GetColumn("LastMessageID").ToString() + "'");
Messages.SetColumn("NextMessageID", ID);
Messages.Write();
// Initialize post
Messages.NewRow(SqlConn.GetConnection());
Messages.SetColumn("Subject", Subject.Text);
Messages.SetColumn("Text", Text.Text);
Messages.SetColumn("UserID", Session["ID"]);
Messages.SetColumn("PostDate", CurrentDateTime);
Messages.SetColumn("NextMessageID", -1);
Messages.SetColumn("ID", ID);
Messages.Write();
// Update topic
Topics.SetColumn("LastMessageID", ID);
Topics.SetColumn("Replies", (int)Topics.GetColumn("Replies") + 1);
Topics.SetColumn("LastUpdate", CurrentDateTime);
Topics.Write();
SqlConn.Close();
// Redirect the user back to the boards
Response.Redirect("slugboards.aspx?BoardID=" + BoardID + "&TopicID=" + TopicID);
}
//
// Post_NewTopic()
//
// Posts a new topic to the SQL database.
//
private void Post_NewTopic()
{
EzSqlConnection SqlConn = new EzSqlConnection();
EzSqlTable Boards = new EzSqlTable("Boards", Server.MapPath("boards.xsd"));
EzSqlTable Topics = new EzSqlTable("Topics", Server.MapPath("topics.xsd"));
EzSqlTable Messages = new EzSqlTable("Messages", Server.MapPath("messages.xsd"));
// Open the connection to the SQL database
SqlConn.Open();
Boards.Read(SqlConn.GetConnection(), "SELECT * FROM Boards WHERE ID='" + BoardID + "'");
Topics.NewRow(SqlConn.GetConnection());
Messages.NewRow(SqlConn.GetConnection());
// Get the current date and time
DateTime CurrentDateTime = DateTime.Now;
long ID = ((CurrentDateTime.Year & 0x000003FF) << 30) |
((CurrentDateTime.DayOfYear & 0x000001FF) << 21) |
((CurrentDateTime.Hour & 0x0000001F) << 16) |
((CurrentDateTime.Second & 0x0000003F) << 10) |
((CurrentDateTime.Millisecond & 0x000003FF));
// Update board info
Boards.SetColumn("Posts", (int)Boards.GetColumn("Posts") + 1);
Boards.SetColumn("LastUpdate", CurrentDateTime);
Boards.Write();
// Initialize post
Messages.SetColumn("Subject", Subject.Text);
Messages.SetColumn("Text", Text.Text);
Messages.SetColumn("UserID", Session["ID"]);
Messages.SetColumn("PostDate", CurrentDateTime);
Messages.SetColumn("NextMessageID", -1);
Messages.SetColumn("ID", ID);
Messages.Write();
// Initialize board post
Topics.SetColumn("Subject", Subject.Text);
Topics.SetColumn("UserID", Session["ID"]);
Topics.SetColumn("Replies", 0);
Topics.SetColumn("Views", 0);
Topics.SetColumn("PostDate", CurrentDateTime);
Topics.SetColumn("LastUpdate", CurrentDateTime);
Topics.SetColumn("BoardID", int.Parse(BoardID));
Topics.SetColumn("FirstMessageID", ID);
Topics.SetColumn("LastMessageID", ID);
Topics.Write();
SqlConn.Close();
// Redirect the user back to the boards
Response.Redirect("slugboards.aspx?BoardID=" + BoardID);
}
}
}
--- NEW FILE: post.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: register.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: reply.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: slugboards.aspx ---
<%@ Page language="c#" Codebehind="slugboards.aspx.cs" AutoEventWireup="false" Inherits="slugtalk.slugboards" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Slugboards</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="style.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P align="left">
<IMG src="slugboard.jpg">
</P>
<P align="center"><FONT size="6">Slugboards</FONT></P>
<P align="center">
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" border="0">
<TR>
<TD><A href="user.aspx"><IMG src="info.gif" border="0"></A></TD>
<TD><A href="stats.aspx"><IMG src="stats.gif" border="0"></A></TD>
<TD><A href="help.aspx"><IMG src="help.gif" border="0"></A></TD>
<TD><A href="logout.aspx"><IMG src="logout.gif" border="0"></A></TD>
</TR>
</TABLE>
</P>
<P align="left">
<asp:Label id="HtmlCode" runat="server"></asp:Label></P>
</form>
</body>
</HTML>
--- NEW FILE: slugboards.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 slugboards.
/// </summary>
public class slugboards : CheckLogin
{
private string BoardID;
protected System.Web.UI.WebControls.Label HtmlCode;
private string TopicID;
private void Page_Load(object sender, System.EventArgs e)
{
// Check to see that the user is logged in
if(!CheckForLogin())
{
Response.Redirect("login.aspx");
}
// Get the BoardID and TopicID
if(Request.QueryString.Get("BoardID") != null)
BoardID = Request.QueryString.Get("BoardID");
if(Request.QueryString.Get("TopicID") != null)
TopicID = Request.QueryString.Get("TopicID");
if(BoardID != null && TopicID == null)
Page_DisplayBoard();
else if(BoardID != null && TopicID != null)
Page_DisplayTopic();
else
Page_DisplayAllBoards();
}
//
// Page_DisplayAllBoards()
//
// Displays all message boards
//
private void Page_DisplayAllBoards()
{
// Connect to the boards database table
EzSqlConnection SqlConn = new EzSqlConnection();
EzSqlTable Boards = new EzSqlTable("Boards", Server.MapPath("boards.xsd"));
EzSqlTable Users = new EzSqlTable("Users", Server.MapPath("users.xsd"));
EzSqlTable Groups = new EzSqlTable("Groups", Server.MapPath("groups.xsd"));
// Open the connection
SqlConn.Open();
// Display table header
HtmlCode.Text = "</span><TABLE cellSpacing=\"1\" cellPadding=\"1\" width=\"95%\" border=\"0\">\n";
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=\"1%\" bgColor=\"#ffff99\"></TD>\n";
HtmlCode.Text += "\t\t<TD width=\"55%\" bgColor=\"#ffff99\">\n";
HtmlCode.Text += "\t\t\t<P>Forum</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\t\t<TD width=\"8%\" bgColor=\"#ffff99\">\n";
HtmlCode.Text += "\t\t\t<P>Posts</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\t\t<TD width=\"22%\" bgColor=\"#ffff99\">\n";
HtmlCode.Text += "\t\t\t<P>Last Post</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\t\t<TD width=\"14%\" bgColor=\"#ffff99\">\n";
HtmlCode.Text += "\t\t\t<P>Moderator</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\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(SqlConn.GetConnection(), "SELECT * FROM Groups WHERE GroupID='" + GroupID.ToString() + "'"))
break;
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=\"100%\" bgColor=\"#ccffff\" colSpan=\"5\"><STRONG>" + Groups.GetColumn("Name") + "</STRONG></TD>\n";
HtmlCode.Text += "\t</TR>\n";
Boards.Read(SqlConn.GetConnection(), "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(SqlConn.GetConnection(), "SELECT * FROM Users WHERE ID='" + Boards.GetColumn("ModeratorID").ToString() + "'");
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=\"1%\"><IMG src=\"on.gif\"></TD>\n";
// Display board name...
HtmlCode.Text += "\t\t<TD width=\"55%\"><FONT size=\"2\"><A href=\"slugboards.aspx?BoardID=" + Boards.GetColumn("ID").ToString() + "\"><STRONG>" + Boards.GetColumn("Name") + "</STRONG></A><BR>";
// ...and board details
HtmlCode.Text += "<EM>" + Boards.GetColumn("Description") + "</EM></FONT></TD>\n";
HtmlCode.Text += "\t\t<TD align=\"center\" width=\"8%\"><FONT size=\"2\">" + Boards.GetColumn("Posts").ToString() + "</FONT></TD>\n";
HtmlCode.Text += "\t\t<TD align=\"center\" width=\"22%\"><FONT size=\"2\">" + ((DateTime)Boards.GetColumn("LastUpdate")).ToLongDateString() + "<BR>" + ((DateTime)Boards.GetColumn("LastUpdate")).ToLongTimeString() + "</FONT></TD>\n";
HtmlCode.Text += "\t\t<TD align=\"center\" width=\"14%\"><FONT size=\"2\"><A href=\"user.aspx?UserID=" + Boards.GetColumn("ModeratorID").ToString() + "\">" + Users.GetColumn("Username") + "</A></FONT></TD>\n";
HtmlCode.Text += "\t</TR>\n";
}
}
// Finish off this bad boy
HtmlCode.Text += "</TABLE>\n";
SqlConn.Close();
}
//
// Page_DisplayBoard()
//
// Displays a single message board
//
private void Page_DisplayBoard()
{
// Connect to the boards database table
EzSqlConnection SqlConn = new EzSqlConnection();
EzSqlTable Topics = new EzSqlTable("Topics", Server.MapPath("topics.xsd"));
EzSqlTable Users = new EzSqlTable("Users", Server.MapPath("users.xsd"));
// Open the SQL connection
SqlConn.Open();
HtmlCode.Text += "</span><TABLE cellSpacing=1 cellPadding=1 width=95% border=0>\n";
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=1% bgColor=#ffff99></TD>\n";
HtmlCode.Text += "\t\t<TD width=40% bgColor=#ffff99>\n";
HtmlCode.Text += "\t\t\t<P>Subject</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\t\t<TD width=8% bgColor=#ffff99>\n";
HtmlCode.Text += "\t\t\t<P>Replies</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\t\t<TD width=7% bgColor=#ffff99>\n";
HtmlCode.Text += "\t\t\t<P>Views</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\t\t<TD width=15% bgColor=#ffff99>\n";
HtmlCode.Text += "\t\t\t<P>Topic Starter</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\t\t<TD width=25% bgColor=#ffff99>\n";
HtmlCode.Text += "\t\t\t<P>Last Post Date</P>\n";
HtmlCode.Text += "\t\t</TD>\n";
HtmlCode.Text += "\t</TR>\n";
// Query the posts SQL table
Topics.Read(SqlConn.GetConnection(), "SELECT * FROM Topics WHERE BoardID='" + BoardID + "' ORDER BY LastUpdate DESC");
// Loop through all of the posts and output them to the HTML
for(int TopicNum = 0; TopicNum < Topics.GetNumRows(); TopicNum++)
{
Topics.SetCurrentRow(TopicNum);
Users.Read(SqlConn.GetConnection(), "SELECT * FROM Users WHERE ID='" + Topics.GetColumn("UserID").ToString() + "'");
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=\"1%\"><IMG src=\"on.gif\"></TD>\n";
// Display topic subject
HtmlCode.Text += "\t\t<TD width=\"50%\"><FONT size=\"2\"><A href=\"slugboards.aspx?BoardID=" + BoardID + "&TopicID=" + Topics.GetColumn("ID").ToString() + "\">" + Topics.GetColumn("Subject") + "</A></TD>";
// Number of replies
HtmlCode.Text += "\t\t<TD align=\"center\" width=\"8%\"><FONT size=\"2\">" + Topics.GetColumn("Replies").ToString() + "</FONT></TD>\n";
// Number of views
HtmlCode.Text += "\t\t<TD align=\"center\" width=\"7%\"><FONT size=\"2\">" + Topics.GetColumn("Views").ToString() + "</FONT></TD>\n";
// Topic starter
HtmlCode.Text += "\t\t<TD align=\"center\" width=\"15%\"><FONT size=\"2\"><A href=\"user.aspx?UserID=" + Topics.GetColumn("UserID").ToString() + "\">" + Users.GetColumn("Username") + "</A></FONT></TD>\n";
// Last post date
HtmlCode.Text += "\t\t<TD align=\"center\" width=\"30%\"><FONT size=\"2\">" + Topics.GetColumn("LastUpdate").ToString() + "</FONT></TD>\n";
HtmlCode.Text += "\t</TR>\n";
}
// Finish off this bad boy
HtmlCode.Text += "</TABLE>\n";
// Display 'New Topic' button
HtmlCode.Text += "<P align=center><A href=\"post.aspx?type=post&BoardID=" + BoardID + "\"><IMG src=\"post.gif\" border=0/></A><BR>\n";
// Close the SQL connection
SqlConn.Close();
}
private void Page_DisplayTopic()
{
// Connect to the boards database table
EzSqlConnection SqlConn = new EzSqlConnection();
EzSqlTable Topics = new EzSqlTable("Topics", Server.MapPath("topics.xsd"));
EzSqlTable Messages = new EzSqlTable("Messages", Server.MapPath("messages.xsd"));
EzSqlTable Users = new EzSqlTable("Users", Server.MapPath("users.xsd"));
// Open the SQL connection
SqlConn.Open();
Topics.Read(SqlConn.GetConnection(), "SELECT * FROM Topics WHERE ID='" + TopicID + "'");
// One more topic viewing...
Topics.SetColumn("Views", (int)Topics.GetColumn("Views") + 1);
Topics.Write();
// Clear the HTML code
HtmlCode.Text = "";
// Get the id of the first post
for(long MessageID = (long)Topics.GetColumn("FirstMessageID"); MessageID != -1;)
{
Messages.Read(SqlConn.GetConnection(), "SELECT * FROM Messages WHERE ID='" + MessageID.ToString() + "'");
Users.Read(SqlConn.GetConnection(), "SELECT * FROM Users WHERE ID='" + Messages.GetColumn("UserID").ToString() + "'");
HtmlCode.Text += "<P align=center>\n";
HtmlCode.Text += "<TABLE cellSpacing=0 cellPadding=0 width=95% border=0>\n";
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=50% bgColor=#ffff99>";
HtmlCode.Text += Users.GetColumn("Username") + "</TD>\n";
// Only display the delete button if the user posted the message
if((int)Users.GetColumn("ID") == (int)Session["ID"])
{
HtmlCode.Text += "\t\t<TD width=50% bgColor=#ffff99 align=right>";
HtmlCode.Text += "<A href=\"user.aspx?UserID=" + Users.GetColumn("ID").ToString() + "\"><IMG src=\"userinfo.gif\" border=0></IMG></A>";
HtmlCode.Text += "<IMG src=\"delete.gif\"></IMG></TD>\n";
}
else
{
HtmlCode.Text += "\t\t<TD width=50% bgColor=#ffff99 align=right>";
HtmlCode.Text += "<A href=\"user.aspx?UserID=" + Users.GetColumn("ID").ToString() + "\"><IMG src=\"userinfo.gif\" border=0></IMG></A></TD>\n";
}
HtmlCode.Text += "\t</TR>\n";
/* HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=100% colSpan=2 bgColor=#ccffff>";
HtmlCode.Text += "Subject: " + Messages.GetColumn("Subject") + "</TD>\n";
HtmlCode.Text += "\t</TR>\n";*/
HtmlCode.Text += "\t<TR>\n";
HtmlCode.Text += "\t\t<TD width=100% colSpan=2 border=1>" + Messages.GetColumn("Text") + "</TD>\n";
HtmlCode.Text += "\t</TR>\n";
HtmlCode.Text += "</TABLE>\n";
HtmlCode.Text += "<BR>\n";
MessageID = (long)Messages.GetColumn("NextMessageID");
}
HtmlCode.Text += "<P align=center><A href=\"post.aspx?type=reply&BoardID=" + BoardID + "&TopicID=" + TopicID + "\"><IMG src=\"reply.gif\" border=0/></A><BR>\n";
// Close the SQL connection
SqlConn.Close();
}
#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: slugboards.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.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<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>
</root>
--- NEW FILE: stats.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: submit.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: textbox.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: topics.xsd ---
<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Topics">
<xs:complexType>
<xs:sequence>
<xs:element name="Subject" type="xs:string" minOccurs="0" />
<xs:element name="UserID" type="xs:int" minOccurs="0" />
<xs:element name="Replies" type="xs:int" minOccurs="0" />
<xs:element name="Views" type="xs:int" minOccurs="0" />
<xs:element name="PostDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="LastUpdate" type="xs:dateTime" minOccurs="0" />
<xs:element name="BoardID" type="xs:int" minOccurs="0" />
<xs:element name="FirstMessageID" type="xs:long" minOccurs="0" />
<xs:element name="LastMessageID" type="xs:long" minOccurs="0" />
<xs:element name="ID" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
--- NEW FILE: topics.xsx ---
<?xml version="1.0" encoding="utf-8"?>
<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
<XSDDesignerLayout layoutVersion="2" viewPortLeft="0" viewPortTop="0" zoom="100">
<Topics_XmlElement left="317" top="254" width="5292" height="2963" selected="0" zOrder="1" index="0" expanded="1" />
</XSDDesignerLayout>
--- NEW FILE: user.aspx ---
<%@ Page language="c#" Codebehind="user.aspx.cs" AutoEventWireup="false" Inherits="slugtalk.user" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Slugboards - User Information</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<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">User Information</FONT></P>
<P title="Slugboards -- User Information" align="center"><asp:label id="Message" runat="server"></asp:label>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" border="0">
<TR>
<TD style="WIDTH: 97px">Name:</TD>
<TD><asp:textbox id="Name" runat="server" MaxLength="64"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 97px">Email:</TD>
<TD>
<asp:textbox id="Email" runat="server" MaxLength="64"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 97px; HEIGHT: 16px">Major:</TD>
<TD style="HEIGHT: 16px"><asp:dropdownlist id="Major" runat="server" Width="157px"></asp:dropdownlist></TD>
</TR>
<TR>
<TD style="WIDTH: 97px; HEIGHT: 24px">College:</TD>
<TD style="HEIGHT: 24px"><asp:dropdownlist id="College" runat="server" Width="157px"></asp:dropdownlist></TD>
</TR>
<TR>
<TD style="WIDTH: 97px">Homepage:</TD>
<TD><asp:textbox id="Homepage" runat="server" MaxLength="96"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 97px">
<P>AIM:</P>
</TD>
<TD><asp:textbox id="AIM" runat="server" MaxLength="50"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 97px; HEIGHT: 26px">ICQ:</TD>
<TD style="HEIGHT: 26px"><asp:textbox id="ICQ" runat="server" MaxLength="50"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 97px">Yahoo IM:</TD>
<TD><asp:textbox id="Yahoo" runat="server" MaxLength="50"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 97px">MSN:</TD>
<TD><asp:textbox id="MSN" runat="server" MaxLength="64"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 97px">Birthdate:</TD>
<TD>
<P>
<asp:textbox id="Birthdate" runat="server" MaxLength="32"></asp:textbox></P>
</TD>
</TR>
<TR>
<TD style="WIDTH: 97px">Bio:</TD>
<TD><asp:textbox id="Bio" runat="server" Width="286px" Height="144px" TextMode="MultiLine" MaxLength="1024"></asp:textbox></TD>
</TR>
<TR>
<TD align="center" colSpan="2">
<P><asp:imagebutton id="Submit" runat="server" ImageUrl="submit.gif"></asp:imagebutton></P>
</TD>
</TR>
</TABLE>
</P>
<P> </P>
</form>
</body>
</HTML>
--- NEW FILE: user.aspx.cs ---
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState...
[truncated message content] |