[Openfirst-cvscommit] messenger inbox.php,1.4,1.5 index.php,1.4,1.5 messenger.php,1.5,1.6 newmsg.php
Brought to you by:
xtimg
From: <xt...@us...> - 2003-08-23 20:32:01
|
Update of /cvsroot/openfirst/messenger In directory sc8-pr-cvs1:/tmp/cvs-serv14220 Modified Files: inbox.php index.php messenger.php newmsg.php viewmsg.php Log Message: Replace mysql functions with new database functions, allowing multiple database types to be used easily. Index: inbox.php =================================================================== RCS file: /cvsroot/openfirst/messenger/inbox.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** inbox.php 20 Aug 2003 00:40:28 -0000 1.4 --- inbox.php 23 Aug 2003 20:31:57 -0000 1.5 *************** *** 36,40 **** // If querystring delete is set with a value then delete the specified recordset if (isset($_GET['DELETE'])) { ! mysql_query("DELETE FROM ofirst_messenger_messages WHERE ID = '".$_GET['DELETE']."'") or die(mysql_error()); echo "<br><p>Message has been removed, thank you! [ <a href='inbox.php'>Inbox</a> ]</p><br>"; die(include($footer)); --- 36,40 ---- // If querystring delete is set with a value then delete the specified recordset if (isset($_GET['DELETE'])) { ! ofirst_dbquery("DELETE FROM ofirst_messenger_messages WHERE ID = '".$_GET['DELETE']."'") or die(ofirst_dberror()); echo "<br><p>Message has been removed, thank you! [ <a href='inbox.php'>Inbox</a> ]</p><br>"; die(include($footer)); *************** *** 43,47 **** // If user specifies to delete all messesges then delete them if (isset($_POST['deleteall'])) { ! mysql_query("DELETE FROM ofirst_messenger_messages WHERE Receiver = '".$user->user."'") or die(mysql_error()); echo "<br><p>All messages have been deleted, thank you! [ <a href='inbox.php'>Inbox</a> ]</p><br>"; die(include($footer)); --- 43,47 ---- // If user specifies to delete all messesges then delete them if (isset($_POST['deleteall'])) { ! ofirst_dbquery("DELETE FROM ofirst_messenger_messages WHERE Receiver = '".$user->user."'") or die(ofirst_dberror()); echo "<br><p>All messages have been deleted, thank you! [ <a href='inbox.php'>Inbox</a> ]</p><br>"; die(include($footer)); *************** *** 49,56 **** // Retrieve Messages relating to the users IP address then loop through them ! $query = mysql_query("SELECT * FROM ofirst_messenger_messages WHERE Receiver = '".$user->user."'"); ?> <h1>Visitor Inbox for Messaging</h1> ! <p>You have (<?php echo mysql_num_rows($query); ?>) messages within your inbox.</p> <table width="661"> <tr> --- 49,56 ---- // Retrieve Messages relating to the users IP address then loop through them ! $query = ofirst_dbquery("SELECT * FROM ofirst_messenger_messages WHERE Receiver = '".$user->user."'"); ?> <h1>Visitor Inbox for Messaging</h1> ! <p>You have (<?php echo ofirst_dbnum_rows($query); ?>) messages within your inbox.</p> <table width="661"> <tr> *************** *** 62,66 **** </tr> <?php ! while($messages = mysql_fetch_object($query)){ ?> <tr> --- 62,66 ---- </tr> <?php ! while($messages = ofirst_dbfetch_object($query)){ ?> <tr> *************** *** 84,88 **** <?php } ! if(mysql_num_rows($query) == 0){ echo "<tr><td>--</td><td>--</td><td>No new messages!</td><td>--</td><td>--</td></tr>"; } --- 84,88 ---- <?php } ! if(ofirst_dbnum_rows($query) == 0){ echo "<tr><td>--</td><td>--</td><td>No new messages!</td><td>--</td><td>--</td></tr>"; } Index: index.php =================================================================== RCS file: /cvsroot/openfirst/messenger/index.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.php 20 Aug 2003 00:40:28 -0000 1.4 --- index.php 23 Aug 2003 20:31:57 -0000 1.5 *************** *** 40,45 **** // Find user online records in the database ! $query = mysql_query("SELECT * FROM ofirst_messenger_usersonline"); ! while($userinf = mysql_fetch_object($query)){ ?> <tr> --- 40,45 ---- // Find user online records in the database ! $query = ofirst_dbquery("SELECT * FROM ofirst_messenger_usersonline"); ! while($userinf = ofirst_dbfetch_object($query)){ ?> <tr> Index: messenger.php =================================================================== RCS file: /cvsroot/openfirst/messenger/messenger.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** messenger.php 20 Aug 2003 00:40:28 -0000 1.5 --- messenger.php 23 Aug 2003 20:31:57 -0000 1.6 *************** *** 33,37 **** // 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_messenger_usersonline WHERE IPAddress = '".$IP."'"); if(ISSET($user->user)){ --- 33,37 ---- // Check if a record for the persons IP is made if not then create it or else update current record info ! $query = ofirst_dbquery("SELECT * FROM ofirst_messenger_usersonline WHERE IPAddress = '".$IP."'"); if(ISSET($user->user)){ *************** *** 41,70 **** } ! if (mysql_num_rows($query) == 0){ $timeout = $TIME+30; ! mysql_query("INSERT INTO ofirst_messenger_usersonline (IPAddress,Location,Timestamp,Member) values( '".$IP."' ,'".$SCRIPT."' ,'".$timeout."' ! ,'".$memberinf."')") or die("INSERT: ".mysql_error()); } else { $timeout = $TIME + 480; ! mysql_query("UPDATE ofirst_messenger_usersonline SET Timestamp = '".$timeout."', Member = '".$memberinf."', Location = '".$SCRIPT."' WHERE IPAddress = '".$IP."'") or die("UPDATE: ".mysql_error()); } // Delete all records that are overdue the Timestamp expiry amount based on current time ! mysql_query("DELETE FROM ofirst_messenger_usersonline WHERE Timestamp < '".$TIME."'") or die("DELETE: ".mysql_error()); // Check how many records of users are available and put in user usable variable ! $query = mysql_query("SELECT * FROM ofirst_messenger_usersonline"); ! $usersonline = "There are currently <b>".mysql_num_rows($query)."</b> persons on this website! [ <a href='./'>View List</a> ]"; // Check how many people are previewing the same exact script location and put in user usable variable ! $page_query = mysql_query("SELECT * FROM ofirst_messenger_usersonline WHERE Location = '".$SCRIPT."'"); ! $usersonpage = "There are currently <b>".mysql_num_rows($page_query)."</b> viewing this page!"; if(isset($user->user)){ --- 41,70 ---- } ! if (ofirst_dbnum_rows($query) == 0){ $timeout = $TIME+30; ! ofirst_dbquery("INSERT INTO ofirst_messenger_usersonline (IPAddress,Location,Timestamp,Member) values( '".$IP."' ,'".$SCRIPT."' ,'".$timeout."' ! ,'".$memberinf."')") or die("INSERT: ".ofirst_dberror()); } else { $timeout = $TIME + 480; ! ofirst_dbquery("UPDATE ofirst_messenger_usersonline SET Timestamp = '".$timeout."', Member = '".$memberinf."', Location = '".$SCRIPT."' WHERE IPAddress = '".$IP."'") or die("UPDATE: ".ofirst_dberror()); } // Delete all records that are overdue the Timestamp expiry amount based on current time ! ofirst_dbquery("DELETE FROM ofirst_messenger_usersonline WHERE Timestamp < '".$TIME."'") or die("DELETE: ".ofirst_dberror()); // Check how many records of users are available and put in user usable variable ! $query = ofirst_dbquery("SELECT * FROM ofirst_messenger_usersonline"); ! $usersonline = "There are currently <b>".ofirst_dbnum_rows($query)."</b> persons on this website! [ <a href='./'>View List</a> ]"; // Check how many people are previewing the same exact script location and put in user usable variable ! $page_query = ofirst_dbquery("SELECT * FROM ofirst_messenger_usersonline WHERE Location = '".$SCRIPT."'"); ! $usersonpage = "There are currently <b>".ofirst_dbnum_rows($page_query)."</b> viewing this page!"; if(isset($user->user)){ *************** *** 72,81 **** // Check if the user has any new Messages ! $query = mysql_query("SELECT * FROM ofirst_messenger_messages WHERE Status = 'New' AND Receiver = '".$user->user."'") or die(mysql_error()); ! $messages = mysql_num_rows($query); // Update Message status so they don't show after the person requests the next page ! mysql_query("UPDATE ofirst_messenger_messages SET Status = 'Read' WHERE Receiver = '".$user->user."'") or die(mysql_error()); // If there are one ore more then one Messages then preview the Message box --- 72,81 ---- // Check if the user has any new Messages ! $query = ofirst_dbquery("SELECT * FROM ofirst_messenger_messages WHERE Status = 'New' AND Receiver = '".$user->user."'") or die(ofirst_dberror()); ! $messages = ofirst_dbnum_rows($query); // Update Message status so they don't show after the person requests the next page ! ofirst_dbquery("UPDATE ofirst_messenger_messages SET Status = 'Read' WHERE Receiver = '".$user->user."'") or die(ofirst_dberror()); // If there are one ore more then one Messages then preview the Message box Index: newmsg.php =================================================================== RCS file: /cvsroot/openfirst/messenger/newmsg.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** newmsg.php 20 Aug 2003 16:07:45 -0000 1.7 --- newmsg.php 23 Aug 2003 20:31:57 -0000 1.8 *************** *** 37,41 **** if (isset($_POST['send'])) { ! mysql_query("INSERT INTO ofirst_messenger_messages (Sender,Receiver,Subject,Body, Status, Date) values( '".$user->user."' ,'".$_POST['recip']."' --- 37,41 ---- if (isset($_POST['send'])) { ! ofirst_dbquery("INSERT INTO ofirst_messenger_messages (Sender,Receiver,Subject,Body, Status, Date) values( '".$user->user."' ,'".$_POST['recip']."' *************** *** 43,52 **** ,'".$_POST['body']."' ,'New' ! ,'".time()."')") or die("INSERT ERROR: ".mysql_error()); // Get information about the receiver ! $query = mysql_query("SELECT * FROM ofirst_members WHERE user = '".$_POST['recip']."'") or die(mysql_error()); ! $receiver = mysql_fetch_object($query); // Send mail notification to use via multipart mail function if the function exists already --- 43,52 ---- ,'".$_POST['body']."' ,'New' ! ,'".time()."')") or die("INSERT ERROR: ".ofirst_dberror()); // Get information about the receiver ! $query = ofirst_dbquery("SELECT * FROM ofirst_members WHERE user = '".$_POST['recip']."'") or die(ofirst_dberror()); ! $receiver = ofirst_dbfetch_object($query); // Send mail notification to use via multipart mail function if the function exists already *************** *** 80,85 **** if (ISSET($_GET['RECIP'])){ ! $query = mysql_query("SELECT * FROM ofirst_messenger_usersonline WHERE ID = '".$_GET['RECIP']."'"); ! $recipient = mysql_fetch_object($query); echo "<input type='hidden' name='recip' value='".$recipient->Member."'>"; --- 80,85 ---- if (ISSET($_GET['RECIP'])){ ! $query = ofirst_dbquery("SELECT * FROM ofirst_messenger_usersonline WHERE ID = '".$_GET['RECIP']."'"); ! $recipient = ofirst_dbfetch_object($query); echo "<input type='hidden' name='recip' value='".$recipient->Member."'>"; *************** *** 88,95 **** echo "<select name='recip' id='recip'>"; ! $query = mysql_query("SELECT * FROM ofirst_messenger_usersonline"); echo $recipient->Member; ! while($recipient = mysql_fetch_object($query)){ if($recipient->Member != "none"){ echo "<option>".$recipient->Member."<option>"; --- 88,95 ---- echo "<select name='recip' id='recip'>"; ! $query = ofirst_dbquery("SELECT * FROM ofirst_messenger_usersonline"); echo $recipient->Member; ! while($recipient = ofirst_dbfetch_object($query)){ if($recipient->Member != "none"){ echo "<option>".$recipient->Member."<option>"; Index: viewmsg.php =================================================================== RCS file: /cvsroot/openfirst/messenger/viewmsg.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** viewmsg.php 20 Aug 2003 00:40:28 -0000 1.4 --- viewmsg.php 23 Aug 2003 20:31:57 -0000 1.5 *************** *** 36,46 **** // Retrieve recordset based on querystring ID data, then preview the information ! $query = mysql_query("SELECT * FROM ofirst_messenger_messages WHERE ID='".$_GET['ID']."'") or die("SELECT: ".mysql_error()); ! $msg = mysql_fetch_object($query); // Retrieve user information based Message information ! $qsend = mysql_query("SELECT * FROM ofirst_messenger_usersonline WHERE IPAddress='".$msg->Sender."'") or die("SELECT: ".mysql_error()); ! $sender = mysql_fetch_object($qsend); ?> <h1>Viewing Message</h1> --- 36,46 ---- // Retrieve recordset based on querystring ID data, then preview the information ! $query = ofirst_dbquery("SELECT * FROM ofirst_messenger_messages WHERE ID='".$_GET['ID']."'") or die("SELECT: ".ofirst_dberror()); ! $msg = ofirst_dbfetch_object($query); // Retrieve user information based Message information ! $qsend = ofirst_dbquery("SELECT * FROM ofirst_messenger_usersonline WHERE IPAddress='".$msg->Sender."'") or die("SELECT: ".ofirst_dberror()); ! $sender = ofirst_dbfetch_object($qsend); ?> <h1>Viewing Message</h1> |