[Openfirst-cvscommit] messenger inbox.php,1.2,1.3 index.php,1.2,1.3 messenger.php,1.2,1.3 newmsg.php
Brought to you by:
xtimg
From: <xt...@us...> - 2003-06-28 16:09:22
|
Update of /cvsroot/openfirst/messenger In directory sc8-pr-cvs1:/tmp/cvs-serv15113 Modified Files: inbox.php index.php messenger.php newmsg.php viewmsg.php Removed Files: messenger.sql Log Message: Update messenger to comply with openFIRST coding standards. Index: inbox.php =================================================================== RCS file: /cvsroot/openfirst/messenger/inbox.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** inbox.php 21 Jun 2003 13:03:51 -0000 1.2 --- inbox.php 28 Jun 2003 16:09:19 -0000 1.3 *************** *** 1,3 **** ! <?php /* * openFIRST.messenger - inbox.php --- 1,3 ---- ! <?php /* * openFIRST.messenger - inbox.php *************** *** 28,59 **** include("../config/globals.php"); include($header); ! mysql_select_db($sqldatabase,$sqlconnection); ! // If querystring delete is set with a value then delete the specified recordset ! if (ISSET($_GET['DELETE'])){ mysql_query("DELETE FROM ofirst_messages WHERE ID='".$_GET['DELETE']."'") or die(mysql_error()); ! die("<br><br><br><center>Message has been removed, thank you! [ <a href='inbox.php'>Inbox</a> ]"); } ! ?> <h1>Visitor Inbox for Messaging</h1> ! <p>[ <a href="inbox.php">Current Messages For You </a>] [ <a href="newmsg.php">Compose Message </a>] [ <a href="./">Online ! Users </a>] <br><br><br><center><?php echo $usersonline."<br>".$usersonpage; ?><br> ! <br></center> ! <table width="100%" border="1" cellpadding="6" cellspacing="0" bordercolor="#999999"> ! <tr bgcolor="#999999"> ! <td></td> ! <td width="40%"><div align="center"><font color="#FFFFFF">Subject</font></div></td> ! <td width="20%"><div align="center"><font color="#FFFFFF">Date</font></div></td> ! <td width="21%"><div align="center"><font color="#FFFFFF">Sender</font></div></td> ! <td width="19%"><div align="center"><font color="#FFFFFF">Option</font></div></td> </tr> <?php ! // Retrieve Messages relating to the users IP address then loop through them ! $query = mysql_query("SELECT * FROM ofirst_messages WHERE Receiver = '$IP'"); ! while($Messages = mysql_fetch_object($query)){ ! $queryuser = mysql_query("SELECT * FROM ofirst_usersonline WHERE IPAddress = '".$Messages->Sender."'"); ! $senderinfo = mysql_fetch_object($queryuser); ?> <tr> --- 28,55 ---- include("../config/globals.php"); include($header); ! // If querystring delete is set with a value then delete the specified recordset ! if (isset($_GET['DELETE'])) { mysql_query("DELETE FROM ofirst_messages WHERE ID='".$_GET['DELETE']."'") or die(mysql_error()); ! die("<p>Message has been removed, thank you! [ <a href='inbox.php'>Inbox</a> ]</p>"); } ! ?> <h1>Visitor Inbox for Messaging</h1> ! <table> ! <tr> ! <th></th> ! <th>Subject</th> ! <th>Date</th> ! <th>Sender</th> ! <th>Option</th> </tr> <?php ! // Retrieve Messages relating to the users IP address then loop through them ! $query = mysql_query("SELECT * FROM ofirst_messages WHERE Receiver = '$IP'"); ! while($Messages = mysql_fetch_object($query)){ ! $queryuser = mysql_query("SELECT * FROM ofirst_usersonline WHERE IPAddress = '".$Messages->Sender."'"); ! $senderinfo = mysql_fetch_object($queryuser); ?> <tr> *************** *** 62,70 **** <?php ! if (empty($Messages->Subject)){ ! echo "< No Subject >"; ! }else{ ! echo $Messages->Subject; ! } ?> --- 58,66 ---- <?php ! if (empty($Messages->Subject)){ ! echo "< No Subject >"; ! } else { ! echo $Messages->Subject; ! } ?> *************** *** 77,79 **** <?php } ?> </table> ! <?php include($footer); ?> --- 73,77 ---- <?php } ?> </table> ! <?php ! include($footer); ! ?> \ No newline at end of file Index: index.php =================================================================== RCS file: /cvsroot/openfirst/messenger/index.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.php 21 Jun 2003 13:03:51 -0000 1.2 --- index.php 28 Jun 2003 16:09:19 -0000 1.3 *************** *** 1,3 **** ! <?php /* * openFIRST.messenger - index.php --- 1,3 ---- ! <?php /* * openFIRST.messenger - index.php *************** *** 28,59 **** include("../config/globals.php"); include($header); ! mysql_select_db($sqldatabase,$sqlconnection); ! ?> <h1>Current Online Users</h1> ! <p>[ <a href="inbox.php">Current Messages For You </a>] [ <a href="newmsg.php">Compose Message </a>] [ <a href="./">Online Users </a>] ! <br><br> ! <center><?php echo $usersonline."<br>".$usersonpage; ?></center> ! <br><br> ! <table width="100%" border="1" cellpadding="6" cellspacing="0" bordercolor="#999999"> ! <tr bgcolor="#999999"> ! <td></td> ! <td width="33%"><div align="center"><font color="#FFFFFF">User Level</font></div></td> ! <td width="34%"><div align="center"><font color="#FFFFFF">Previewing</font></div></td> ! <td width="33%"><div align="center"><font color="#FFFFFF">Options</font></div></td> </tr> <?php ! // Find user online records in the database ! $query = mysql_query("SELECT * FROM ofirst_usersonline"); ! while($user = mysql_fetch_object($query)){ ?> <tr> <td><img src="visitors.png" alt="Visitor"></td> ! <td><?php if ($user->Member = "none"){ echo "Visiting Guest #".$user->ID; }else{ echo $user->Member; } ?></td> <td><?php echo $user->Location; ?></td> ! <td>[ <a href="newmsg.php?REPLY=<?php echo $user->ID; ?>"> Message User</a> ]</td> </tr> ! <?php } ?> </table> ! <?php include($footer); ?> --- 28,64 ---- include("../config/globals.php"); include($header); ! ?> <h1>Current Online Users</h1> ! <table> ! <tr> ! <th></th> ! <th>User Level</th> ! <th>Previewing</th> ! <th>Options</th> </tr> <?php ! // Find user online records in the database ! $query = mysql_query("SELECT * FROM ofirst_usersonline"); ! while($user = mysql_fetch_object($query)){ ?> <tr> <td><img src="visitors.png" alt="Visitor"></td> ! <td><?php ! if ($user->Member = "none") { ! echo "Visiting Guest #".$user->ID; ! } else { ! echo $user->Member; ! } ! ?></td> <td><?php echo $user->Location; ?></td> ! <td>[ <a href="newmsg.php?REPLY=<?php echo $user->ID; ?>"> Message User</a> ]</td> </tr> ! <?php ! } ! ?> </table> ! <?php ! include($footer); ! ?> \ No newline at end of file Index: messenger.php =================================================================== RCS file: /cvsroot/openfirst/messenger/messenger.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** messenger.php 21 Jun 2003 13:03:51 -0000 1.2 --- messenger.php 28 Jun 2003 16:09:19 -0000 1.3 *************** *** 1,3 **** ! <?php /* * openFIRST.messenger - messenger.php --- 1,3 ---- ! ga<?php /* * openFIRST.messenger - messenger.php *************** *** 26,30 **** * */ - mysql_select_db($sqldatabase,$sqlconnection); // Declare information to be used in all messenger files $IP = $_SERVER['REMOTE_ADDR']; --- 26,29 ---- *************** *** 34,51 **** // Check if a record for the persons IP is made if not then create it or else update current record info $query = mysql_query("SELECT * FROM ofirst_usersonline WHERE IPAddress = '".$IP."'"); ! if (mysql_num_rows($query) == 0){ ! $timeout = $TIME+30; ! mysql_query("INSERT INTO ofirst_usersonline (IPAddress,Location,Timestamp,Member) values( '".$IP."' ,'".$SCRIPT."' ,'".$timeout."' ,'none')") or die("INSERT: ".mysql_error()); ! }else{ ! $timeout = $TIME + 480; ! mysql_query("UPDATE ofirst_usersonline SET Timestamp = '".$timeout."', Location = '".$SCRIPT."' WHERE IPAddress = '".$IP."'") or die("UPDATE: ".mysql_error()); } - // Delete all records that are overdue the Timestamp expiry amount based on current time --- 33,49 ---- // Check if a record for the persons IP is made if not then create it or else update current record info $query = mysql_query("SELECT * FROM ofirst_usersonline WHERE IPAddress = '".$IP."'"); ! if (mysql_num_rows($query) == 0){ ! $timeout = $TIME+30; ! mysql_query("INSERT INTO ofirst_usersonline (IPAddress,Location,Timestamp,Member) values( '".$IP."' ,'".$SCRIPT."' ,'".$timeout."' ,'none')") or die("INSERT: ".mysql_error()); ! } else { ! $timeout = $TIME + 480; ! mysql_query("UPDATE ofirst_usersonline SET Timestamp = '".$timeout."', Location = '".$SCRIPT."' WHERE IPAddress = '".$IP."'") or die("UPDATE: ".mysql_error()); } // Delete all records that are overdue the Timestamp expiry amount based on current time *************** *** 72,89 **** // If there are one ore more then one Messages then preview the Message box ! if($Messages >= 1){ ?> ! <table style="position: absolute; left: 306px; top: 64px; width: 384px; height: 19px" width="400" border="1" cellpadding="4" cellspacing="0" bordercolor="#666666" bgcolor="#CCCCCC"> ! <tr> ! <td height="25" bgcolor="#999999"><div align="center"><font color="#FFFFFF">Private ! Messaging System Alert</font></div></td> </tr> <tr> ! <td height="25"><p align="center"><br> ! <img src="<?php echo $home; ?>/messenger/msg.png" alt="Message" width="28" height="25"> <br> ! You have <b><?php echo $Messages; ?></b> new Messages(s) in your visitor inbox!<br> <br> ! [ <a href="<?php echo $home; ?>/messenger/inbox.php">Visitor Inbox</a> ]<br> <br> </p></td> --- 70,85 ---- // If there are one ore more then one Messages then preview the Message box ! if ($Messages >= 1) { ?> ! <table style="position: absolute; left: 306px; top: 64px; width: 384px; height: 19px" width="400"> ! <tr> ! <th>Private Messaging System Alert</th> </tr> <tr> ! <td height="25"><img src="<?php echo $basepath; ?>/messenger/msg.png" alt="New Message"> <br> ! You have <b><?php echo $Messages; ?></b> new Messages(s) in your visitor inbox!<br> <br> ! [ <a href="<?php echo $basepath; ?>/messenger/inbox.php">Visitor Inbox</a> ]<br> <br> </p></td> Index: newmsg.php =================================================================== RCS file: /cvsroot/openfirst/messenger/newmsg.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** newmsg.php 21 Jun 2003 13:03:51 -0000 1.2 --- newmsg.php 28 Jun 2003 16:09:19 -0000 1.3 *************** *** 1,3 **** ! <?php /* * openFIRST.messenger - newmsg.php --- 1,3 ---- ! <?php /* * openFIRST.messenger - newmsg.php *************** *** 28,36 **** include("../config/globals.php"); include($header); - mysql_select_db($sqldatabase,$sqlconnection); // If the user has posted a send command then insert the Message into the database ! ! if (ISSET($_POST['send'])){ mysql_query("INSERT INTO ofirst_messages (Sender,Receiver,Subject,Body, Status, Date) values( '".$IP."' --- 28,35 ---- include("../config/globals.php"); include($header); // If the user has posted a send command then insert the Message into the database ! ! if (isset($_POST['send'])) { mysql_query("INSERT INTO ofirst_messages (Sender,Receiver,Subject,Body, Status, Date) values( '".$IP."' *************** *** 41,93 **** ,'".time()."')") or die("INSERT ERROR: ".mysql_error()); ! echo("<br><br><br><center>Message has been sent! [ <a href='inbox.php'>Inbox</a> ]"); ! die(include($footer)); } ! ?> <form method="POST" action="newmsg.php"> <h1>Visitor Inbox for Messaging</h1> ! <p>[ <a href="inbox.php">Current Messages For You </a>] [ <a href="newmsg.php">Compose Message </a>] [ <a href="./">Online ! Users </a>] <br> ! <br> ! <center> ! <?php echo $usersonline; ?> ! <br> ! <br> ! </center> ! <table width="53%" border="0" cellspacing="0" cellpadding="6"> ! <tr> ! <td><div align="right">Recipient:</div></td> <td> <select name="recip" id="recip"> <?php ! // Set the reply based on a regular member or visitor (David Notes: Coding to be changed later) ! if (ISSET($_GET['REPLY'])){ ! $query = mysql_query("SELECT * FROM ofirst_usersonline WHERE ID = '".$_GET['REPLY']."'"); ! $replyuser = mysql_fetch_object($query); ! if (! $replyuser->Member = "None"){ ! echo "<option value='".$replyuser->IPAddress."'>".$replyuser->Member." (REPLY MSG)</option>"; ! }else{ ! echo "<option value='".$replyuser->IPAddress."'>Visitor #".$replyuser->ID." (REPLY MSG)</option>"; } ! }else{ ! $query = mysql_query("SELECT * FROM ofirst_usersonline"); ! while($user = mysql_fetch_object($query)){ ! if (! $user->Member = "None"){ ! echo "<option value='".$user->IPAddress."'>".$user->Member."</option>"; ! }else{ ! echo "<option value='".$user->IPAddress."'>Visitor #".$user->ID."</option>"; } } - } ?> </select></td> </tr> ! <tr> ! <td><div align="right">Subject:</div></td> ! <td><input name="subject" type="text" id="subject" size="50" value="<?php if (ISSET($_GET['SUBJECT'])){ echo $_GET['SUBJECT']; } ?>"></td> </tr> <tr> ! <td><div align="right">Body:</div></td> <td> <textarea name="body" cols="50" rows="10" id="body"></textarea> --- 40,84 ---- ,'".time()."')") or die("INSERT ERROR: ".mysql_error()); ! echo("<br><br><br><center>Message has been sent! [ <a href='inbox.php'>Inbox</a> ]"); ! die(include($footer)); } ! ?> <form method="POST" action="newmsg.php"> <h1>Visitor Inbox for Messaging</h1> ! <table> ! <tr> ! <th>Recipient</th> <td> <select name="recip" id="recip"> <?php ! // Set the reply based on a regular member or visitor (David Notes: Coding to be changed later) ! if (ISSET($_GET['REPLY'])){ ! $query = mysql_query("SELECT * FROM ofirst_usersonline WHERE ID = '".$_GET['REPLY']."'"); ! $replyuser = mysql_fetch_object($query); ! if (! $replyuser->Member = "None"){ ! echo "<option value='".$replyuser->IPAddress."'>".$replyuser->Member." (REPLY MSG)</option>"; ! } else { ! echo "<option value='".$replyuser->IPAddress."'>Visitor #".$replyuser->ID." (REPLY MSG)</option>"; } ! } else { ! $query = mysql_query("SELECT * FROM ofirst_usersonline"); ! while($user = mysql_fetch_object($query)){ ! if (! $user->Member = "None"){ ! echo "<option value='".$user->IPAddress."'>".$user->Member."</option>"; ! } else { ! echo "<option value='".$user->IPAddress."'>Visitor #".$user->ID."</option>"; ! } } } ?> </select></td> </tr> ! <tr> ! <th>Subject</th> ! <td><input name="subject" type="text" id="subject" size="50" value="<?php if (isset($_GET['SUBJECT'])) { echo $_GET['SUBJECT']; } ?>"></td> </tr> <tr> ! <th>Body</th> <td> <textarea name="body" cols="50" rows="10" id="body"></textarea> *************** *** 95,99 **** <font size="2">(HTML Messages enabled)</font></td> </tr> ! <tr> <td></td> <td><input name="send" type="submit" value="Send Message"></td> --- 86,90 ---- <font size="2">(HTML Messages enabled)</font></td> </tr> ! <tr> <td></td> <td><input name="send" type="submit" value="Send Message"></td> *************** *** 101,103 **** </table> </form> ! <?php include($footer); ?> --- 92,96 ---- </table> </form> ! <?php ! include($footer); ! ?> \ No newline at end of file Index: viewmsg.php =================================================================== RCS file: /cvsroot/openfirst/messenger/viewmsg.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** viewmsg.php 21 Jun 2003 13:03:51 -0000 1.2 --- viewmsg.php 28 Jun 2003 16:09:19 -0000 1.3 *************** *** 28,32 **** include("../config/globals.php"); include($header); - mysql_select_db($sqldatabase,$sqlconnection); // Retrieve recordset based on querystring ID data, then preview the information --- 28,31 ---- *************** *** 39,67 **** $qsend = mysql_query("SELECT * FROM ofirst_usersonline WHERE IPAddress='".$msg->Sender."'") or die("SELECT: ".mysql_error()); $sender = mysql_fetch_object($qsend); ! ?> <h1>Viewing Message</h1> ! <p>[ <a href="inbox.php">Current Messages For You </a>] [ <a href="newmsg.php">Compose Message </a>] [ <a href="./">Online ! Users </a>] <br><br><br><center><?php echo $usersonline; ?><br> ! <br></center> ! <table width="100%" border="1" cellpadding="6" cellspacing="0" bordercolor="#999999"> ! <tr bgcolor="#999999"> ! <td width="25%"> </td> ! <td width="75%"><font color="#FFFFFF">Current Message</font></td> </tr> ! <tr> ! <td><div align="right">Sender:</div></td> <td>Visitor <?php echo $sender->ID; ?></td> </tr> ! <tr> ! <td><div align="right">Subject:</div></td> <td><?php echo $msg->Subject; ?></td> </tr> <tr> ! <td><div align="right">Body:</div></td> <td><?php echo $msg->Body; ?></td> </tr> </table> ! <p>[ <a href='inbox.php?DELETE=<?php echo $msg->ID; ?>'> Delete </a> ] [ ! <a href="newmsg.php?REPLY=<?php echo $sender->ID; ?>&SUBJECT=Re:%20<?php echo $msg->Subject; ?>">Reply</a> ]</p> ! <?php include($footer); ?> --- 38,65 ---- $qsend = mysql_query("SELECT * FROM ofirst_usersonline WHERE IPAddress='".$msg->Sender."'") or die("SELECT: ".mysql_error()); $sender = mysql_fetch_object($qsend); ! ?> <h1>Viewing Message</h1> ! <table> ! <tr> ! <th> </th> ! <th>Current Message</th> </tr> ! <tr> ! <th>Sender</th> <td>Visitor <?php echo $sender->ID; ?></td> </tr> ! <tr> ! <th>Subject</th> <td><?php echo $msg->Subject; ?></td> </tr> <tr> ! <th>Body</th> <td><?php echo $msg->Body; ?></td> </tr> </table> ! <p>[ <a href='inbox.php?DELETE=<?php echo $msg->ID; ?>'> Delete </a> ] [ ! <a href="newmsg.php?REPLY=<?php echo $sender->ID; ?>&SUBJECT=Re:%20<?php echo $msg->Subject; ?>">Reply</a> ]</p> ! <?php ! include($footer); ! ?> \ No newline at end of file --- messenger.sql DELETED --- |