Changeset 4 for www/sunrisechat/sunrisechat2.php
- Timestamp:
- Jan 14, 2008, 9:48:39 PM (17 years ago)
- Location:
- www
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
www
-
Property svn:ignore
set to
config.php
php_script_error.log
-
Property svn:ignore
set to
-
www/sunrisechat/sunrisechat2.php
r1 r4 1 <? 1 <?php 2 2 3 include_once('/a/html/is/db.php'); 4 include_once('/a/html/sunrisechat/webchatsend.php'); 5 DB_Init('localhost','root','','is'); 6 DB_Query('SET NAMES latin2'); 3 include_once('../global.php'); 4 include_once('webchatsend.php'); 7 5 8 6 $Debug = 0; … … 10 8 function Packet($Text2) 11 9 { 12 global $Debug ;10 global $Debug, $Database; 13 11 //echo("{".$Text2."}".ord($Text2[1]).".".strlen($Text2)."\n"); 14 12 //echo($Text2.strlen($Text2)."\n"); … … 29 27 $RoomType = $Parts[10]; 30 28 if($Debug == 1) echo('Message: '.$Text."\n"); 31 DB_Select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"');32 if( DB_NumRows()>0)29 $DbResult = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 30 if($DbResult->num_rows > 0) 33 31 { 34 $Row = DB_Row();32 $Row = $DbResult->fetch_array(); 35 33 $Nick = $Row['nick']; 36 34 } else $Nick = ''; 37 35 echo('<'.$Nick.'>'.$Text." ".addslashes($Text)."\n"); 38 DB_Insert('sunrisechat_history',array('time' => 'NOW()', 'nick' => $Nick, 'text' => $Text, 'color' => $Color,36 $Database->insert('sunrisechat_history',array('time' => 'NOW()', 'nick' => $Nick, 'text' => $Text, 'color' => $Color, 39 37 'roomname' => $RoomName, 'roomtype' => $RoomType)); 40 38 } 41 39 if($Command == 'Alive') 42 40 { 43 DB_Select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"');44 if( DB_NumRows()>0)41 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 42 if($DbResult->num_rows() > 0) 45 43 { 46 $Row = DB_Row();47 DB_Update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()'));48 } else DB_Insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'sender_ip' => $SenderIP, 'sender_id' => $SenderID));44 $Row = $DbResult->fetch_array(); 45 $Database->update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()')); 46 } else $Database->insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'sender_ip' => $SenderIP, 'sender_id' => $SenderID)); 49 47 } 50 48 if($Command == 'GoOnline') 51 49 { 52 DB_Select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"');53 if( DB_NumRows()>0)50 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 51 if($DbResult->num_rows() > 0) 54 52 { 55 $Row = DB_Row();56 DB_Update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()', 'status' => 'Online'));57 } else DB_Insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'sender_ip' => $SenderIP, 'sender_id' => $SenderID, 'status' => 'Online'));53 $Row = $DbResult->fetch_array(); 54 $Database->update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()', 'status' => 'Online')); 55 } else $Database->insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'sender_ip' => $SenderIP, 'sender_id' => $SenderID, 'status' => 'Online')); 58 56 } 59 57 if($Command == 'GoAway') 60 58 { 61 DB_Select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"');62 if( DB_NumRows()>0)59 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 60 if($DbResult->num_rows() > 0) 63 61 { 64 $Row = DB_Row();65 DB_Update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()', 'status' => 'Away'));66 } else DB_Insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'sender_ip' => $SenderIP, 'sender_id' => $SenderID, 'status' => 'Away'));62 $Row = $DbResult->fetch_array(); 63 $Database->update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()', 'status' => 'Away')); 64 } else $Database->insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'sender_ip' => $SenderIP, 'sender_id' => $SenderID, 'status' => 'Away')); 67 65 } 68 66 if($Command == 'UserInfo') … … 70 68 $Nick = $Parts[7]; 71 69 echo('UserInfo: '.$Nick."\n"); 72 DB_Select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"');73 if( DB_NumRows()>0)70 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 71 if($DbResult->num_rows() > 0) 74 72 { 75 $Row = DB_Row();76 DB_Update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()', 'nick' => $Nick, 'operating_system' => $Parts[12], 'status' => $Parts[10]));77 } else DB_Insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'nick' => $Nick, 'sender_ip' => $SenderIP, 'sender_id' => $SenderID, 'operating_system' => $Parts[12], 'status' => $Parts[10]));73 $Row = $DbResult->fetch_array(); 74 $Database->update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()', 'nick' => $Nick, 'operating_system' => $Parts[12], 'status' => $Parts[10])); 75 } else $Database->insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'nick' => $Nick, 'sender_ip' => $SenderIP, 'sender_id' => $SenderID, 'operating_system' => $Parts[12], 'status' => $Parts[10])); 78 76 } 79 77 if($Command == 'WhoIs') // for WebSunriseChat support 80 78 { 81 DB_Select('sunrisechat_onlinelist','*','sender_id='.$TargetID.' AND sender_ip="'.$TargetIP.'" AND operating_system="Fedora Core 2"');82 if( DB_NumRows()>0)79 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$TargetID.' AND sender_ip="'.$TargetIP.'" AND operating_system="Fedora Core 2"'); 80 if($DbResult->num_rows() > 0) 83 81 { 84 $Row = DB_Row();82 $Row = $DbResult->fetch_array(); 85 83 $_SESSION['DetailInfo'] = $Row['info']; 86 84 $Nick = $Row['nick'];
Note:
See TracChangeset
for help on using the changeset viewer.