<?php
// Connect to the Database, Replace the infromation with your own. "server","username","password"
@ $mwd = mysql_pconnect("localhost", "root", "password");
// if you can't connect gives you an error
if (!$mwd)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("mwd");
// delete a chat or guest (and the "related links)
if ($delete == 1)
{
if (cid != "")
$deletechat = mysql_query( "delete from chat where cid = '$cid'");
if (gid != "")
{
$deleteguest = mysql_query( "delete from guest where GID = '$gid'");
$deleterelated = mysql_query( "delete from related where GID = '$gid'");
}
}
// deactivate a chat (doesn't really do anything except moves it around on the moderate page
// It will eventually not allow people to just type in the cid of a chat ans see it
// I'm sure there are better ways... ;)
if ($deactive == 0)
$acdeactivate = mysql_query( "update chat set active = '$deactive' where CID = '$cid'");
// activate a chat - see note above
if ($deactive == 1)
$acdeactivate = mysql_query( "update chat set active = '$deactive' where CID = '$cid'");
// adds a guest to the guest table
if ($addguest == 1)
{
$gadd = mysql_query( "insert into guest (firstname, lastname, biourl, photourl, title) values ('$firstname', '$lastname', '$biourl', '$photourl', '$title')");
$gidnew = mysql_insert_id();
$gidadd = $gidnew;
$grladd = mysql_query( "insert into related (link, linkurl, gid) values ('$linktitle1', '$linkurl1', '$gidadd'), ('$linktitle2', '$linkurl2', '$gidadd'), ('$linktitle3', '$linkurl3', '$gidadd'), ('$linktitle4', '$linkurl4', '$gidadd'), ('$linktitle5', '$linkurl5', '$gidadd')");
}
// adds a chat
if ($addchat == 1)
$cadd = mysql_query( "insert into chat ( gid, date, time, title, description ) values ('$gid', '$date', '$time', '$title', '$description' )");
// edits a guest
if ($editguest == 1)
{
$gedit = mysql_query( "update guest set firstname = '$firstname', lastname = '$lastname', biourl = '$biourl', photourl = '$photourl', title = '$title' where GID = '$gid'");
if ( $linktitle1 != "" )
$grledit1 = mysql_query( "update related set link = '$linktitle1', linkurl = '$linkurl1' where RID = '$rid'");
if ( $linktitle2 != "" )
$grledit2 = mysql_query( "update related set link = '$linktitle2', linkurl = '$linkurl2' where RID = '$rid'");
if ( $linktitle3 != "" )
$grledit3 = mysql_query( "update related set link = '$linktitle3', linkurl = '$linkurl3' where RID = '$rid'");
if ( $linktitle4 != "" )
$grledit4 = mysql_query( "update related set link = '$linktitle4', linkurl = '$linkurl4' where RID = '$rid'");
if ( $linktitle5 != "" )
$grledit5 = mysql_query( "update related set link = '$linktitle5', linkurl = '$linkurl5' where RID = '$rid'");
}
// edits a chat
if ($editchat == 1)
$cadd = mysql_query( "update chat set gid = '$gid', date = '$date', time = '$time', title = '$title', description = '$description' where cid = '$cid'");
// active chats query
$acquery = "select CID, title, active from chat where active = 1";
$acresults = mysql_query($acquery);
$ac_num_results = mysql_num_rows($acresults);
// scheduled chats query
$scquery = "select CID, title, active from chat where active = 0";
$scresults = mysql_query($scquery);
$sc_num_results = mysql_num_rows($scresults);
// guest query
$gquery = "select GID, firstname, lastname from guest";
$gresults = mysql_query($gquery);
$g_num_results = mysql_num_rows($gresults);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/chat/library/css/global.css" type="text/css">
<style type="text/css">
<!--
.swchaptitle { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: CC6600}
.swchapauthor { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal}
.swchapteaser { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px}
.swchapresourcetitle { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal}
.swchapresources { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px}
.swtitle { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold; color: CC6600}
p { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px}
.swsubheader { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold}
-->
</style>
</head>
<body>
<?php include('library/includes/mainheader.ssi') ?>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="161" align="left" valign="top" rowspan="2">
<?php include('/library/includes/chatadminmenu.php'); ?>
</td>
<td rowspan="2" valign="top">
<p class="swtitle" align="center">MWD Administration</p>
<p>Welcome to the Moderated Web Descussion Administration Page.</p>
<br>
<?php
if ( $ac_num_results > 0 )
{
include('aclist.php');
echo "<br>";
}
if ( $sc_num_results > 0 )
{
include('sclist.php');
echo "<br>";
}
if ( $g_num_results > 0 )
{
include('glist.php');
echo "<br>";
}
?>
<p> </p>
<p>Editor's Note: Moderators retain editorial control
over Online discussions and choose the most relevant questions for
guests and hosts; guests and hosts can decline to answer questions. </p><?php echo $editguest ?>
</td>
<td valign="top" align="right" rowspan="2" width="100"> </td>
</tr>
<tr> </tr>
</table>
<br>
</body>
</html>