Changeset 4 for www/sunrisechat
- Timestamp:
- Jan 14, 2008, 9:48:39 PM (17 years ago)
- Location:
- www
- Files:
-
- 4 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
www
-
Property svn:ignore
set to
config.php
php_script_error.log
-
Property svn:ignore
set to
-
www/sunrisechat/code.php
r1 r4 1 <? 1 <?php 2 2 /* 3 3 ISO8859-2 <-> UTF-8 conversion functions designed for use in PHP-GTK apps -
www/sunrisechat/history.php
r1 r4 1 <? 2 include_once('../is/db.php'); 3 include_once('../style.php'); 4 include_once('../global.php'); 1 <?php 2 3 include_once('../global.php'); 4 include_once('../style.php'); 5 ShowHeader('Výpis z historie SunriseChatu','Historie Sunrisechatu'); 6 7 if(array_key_exists('date',$_GET)) $Date = $_GET['date']; else $Date = date('Y-m-d'); 8 $DateParts = explode('-',$Date); 5 9 6 DB_Init('localhost','root','','is'); 7 DB_Query('SET CHARACTER SET latin2'); 8 ShowHeader('Výpis z historie SunriseChatu','Historie Sunrisechatu'); 9 10 if(array_key_exists('date',$_GET)) $Date = $_GET['date']; else $Date = date('Y-m-d'); 11 $DateParts = explode('-',$Date); 10 $DbResult = $Database->select('sunrisechat_history','MAX(time),MIN(time)'); 11 $RowTotal = $DbResult->fetch_array(); 12 12 13 DB_Select('sunrisechat_history','MAX(time),MIN(time)'); 14 $RowTotal = DB_Row(); 13 $StartDateTimeParts = explode(' ',$RowTotal['MIN(time)']); 14 $StartDateParts = explode('-',$StartDateTimeParts[0]); 15 $EndDateTimeParts = explode(' ',$RowTotal['MAX(time)']); 16 $EndDateParts = explode('-',$EndDateTimeParts[0]); 15 17 16 $StartDateTimeParts = explode(' ',$RowTotal['MIN(time)']); 17 $StartDateParts = explode('-',$StartDateTimeParts[0]); 18 $EndDateTimeParts = explode(' ',$RowTotal['MAX(time)']); 19 $EndDateParts = explode('-',$EndDateTimeParts[0]); 18 function dechexr($Num) 19 { 20 $Num = dechex($Num); 21 return(substr($Num,4,2).substr($Num,2,2).substr($Num,0,2)); 22 } 20 23 21 function dechexr($Num) 24 echo('<div style="font-size: small;">'); 25 for($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--) 26 { 27 echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$Year.'</div> 28 <div style="margin-left: 15px; margin-right: 15px;">'); 29 if($Year == $StartDateParts[0]) $StartMonth = ($StartDateParts[1]+0); else $StartMonth = 1; 30 if($Year == $EndDateParts[0]) $EndMonth = ($EndDateParts[1]+0); else $EndMonth = 12; 31 for($Month = $EndMonth; $Month >= $StartMonth; $Month--) 22 32 { 23 $Num = dechex($Num);24 return(substr($Num,4,2).substr($Num,2,2).substr($Num,0,2));25 }26 27 echo('<div style="font-size: small;">');28 for($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--)29 {30 echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$Year.'</div>31 <div style="margin-left: 15px; margin-right: 15px;">');32 if($Year == $StartDateParts[0]) $StartMonth = ($StartDateParts[1]+0); else $StartMonth = 1;33 if($Year == $EndDateParts[0]) $EndMonth = ($EndDateParts[1]+0); else $EndMonth = 12;34 for($Month = $EndMonth; $Month >= $StartMonth; $Month--)35 {36 33 // echo('<div><span>'); 37 38 39 40 41 42 34 echo('<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;">'.$MonthNames[$Month].' 35 <span style="position: absolute; left: 100px;">'); 36 if(($Year == $StartDateParts[0]) and ($Month == $StartDateParts[1])) $StartDay = ($StartDateParts[2]+0); else $StartDay = 1; 37 if(($Year == $EndDateParts[0]) and ($Month == $EndDateParts[1])) $EndDay = ($EndDateParts[2]+0); else $EndDay = date('t',mktime(0,0,0,$Month,0,$Year)); 38 for($Day = $StartDay; $Day <= $EndDay; $Day++) 39 { 43 40 // $Date = $Year.'-'.$Month.'-'.$Day; 44 41 //DB_Select('sunrisechat_history','COUNT(*)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." //23:59:59'"); 45 42 // $CR = DB_Row(); 46 43 // $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'('.$CR['COUNT(*)'].')</a> '; 47 $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'</a> '; 48 flush(); 49 if(($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong style="border-style: solid; border-width: 1; border-color: black; padding-left: 3px;">'.$Text.'</strong>'; 50 echo($Text); 51 } 52 echo('</span></div>'); 44 $Text = '<a href="history.php?date='.$Year.'-'.$Month.'-'.$Day.'">'.$Day.'</a> '; 45 flush(); 46 if(($DateParts[0] == $Year) and ($DateParts[1] == $Month) and ($DateParts[2] == $Day)) $Text = '<strong style="border-style: solid; border-width: 1; border-color: black; padding-left: 3px;">'.$Text.'</strong>'; 47 echo($Text); 53 48 } 54 echo('</ div>');49 echo('</span></div>'); 55 50 } 56 51 echo('</div>'); 52 } 53 echo('</div>'); 54 55 $DbResult = $Database->select('sunrisechat_history','nick,color,text,UNIX_TIMESTAMP(time)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." 23:59:59' ORDER BY time DESC"); 56 //echo('Výpis posledních 100 zpráv:<br>'); 57 echo('<div style="font-size: small;">'); 58 while($Row = $DbResult->fetch_array()) 59 { 60 $Text = $Row['text'];; 61 // StrTr($Row['text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 62 echo('['.date('d.m.Y H:i:s',$Row['UNIX_TIMESTAMP(time)']).'] <span style="color: #'.dechexr($Row['color']).'"><strong><'.$Row['nick'].'></strong> '.(htmlspecialchars($Text)).'</span><br>'); 63 flush(); 64 } 65 echo('</div>'); 57 66 58 DB_Select('sunrisechat_history','nick,color,text,UNIX_TIMESTAMP(time)',"roomtype=0 AND time>'".$Date." 00:00:00' AND time<'".$Date." 23:59:59' ORDER BY time DESC"); 59 //echo('Výpis posledních 100 zpráv:<br>'); 60 echo('<div style="font-size: small;">'); 61 while($Row = DB_Row()) 62 { 63 $Text = $Row['text'];; 64 // StrTr($Row['text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 65 echo('['.date('d.m.Y H:i:s',$Row['UNIX_TIMESTAMP(time)']).'] <span style="color: #'.dechexr($Row['color']).'"><strong><'.$Row['nick'].'></strong> '.(htmlspecialchars($Text)).'</span><br>'); 66 flush(); 67 } 68 echo('</div>'); 69 70 ShowFooter(); 67 ShowFooter(); 71 68 ?> -
www/sunrisechat/network.php
r1 r4 1 <? 2 include_once('../is/db.php'); 3 include_once('../global.php'); 4 include_once('code.php'); 5 DB_Init('localhost','root','','is'); 6 DB_Query('SET CHARACTER SET latin2'); 1 <?php 7 2 8 //include_once('../style.php'); 9 //ShowHeader('Obsah souboru Network.cfg Sunrisechatu','Soubor testu sítì Sunrisechatu'); 3 include_once('../global.php'); 4 include_once('code.php'); 10 5 11 12 DB_Select('users','*');13 while($Row = DB_Row())14 15 16 6 $User = array(0 => array('fullname' => '')); 7 $DbResult = $Database->select('users', '*'); 8 while($Row = $DbResult->fetch_array()) 9 { 10 $User[$Row['id']] = $Row; 11 } 17 12 18 DB_Select('hosts','*','1 ORDER BY id');19 while($Row = DB_Row())20 21 22 23 24 13 $DbResult = $Database->select('hosts','*','1 ORDER BY id'); 14 while($Row = $DbResult->fetch_array()) 15 { 16 $Row = $Row['id'].':'.$Row['parent'].':'.$Row['name'].':'.$Row['IP'].':'.$User[$Row['user']]['fullname'].':'.$Row['block']."\n"; 17 $Row = StrTr($Row, "\xA9\xAB\xAE\xB9\xBB\xBE", "\x8A\x8D\x8E\x9A\x9D\x9E"); 18 echo($Row); 19 } 25 20 26 //ShowFooter();27 21 ?> -
www/sunrisechat/sunrisechat.php
r1 r4 1 <? 2 include_once('/a/html/is/db.php'); 3 DB_Init('localhost','root','','is');4 DB_Query('SET CHARACTER SET latin2');1 <?php 2 3 include_once('../global.php'); 4 include_once('webchatsend.php'); 5 5 6 $Text2 = getenv('sunrisechat'); 6 $Debug = 0; 7 8 function Packet($Text2) 9 { 10 global $Debug, $Database; 11 //echo("{".$Text2."}".ord($Text2[1]).".".strlen($Text2)."\n"); 12 //echo($Text2.strlen($Text2)."\n"); 7 13 $Text = StrTr($Text2, "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 14 if(strlen($Text) > 1) 15 { 8 16 $Parts = explode('|',$Text); 17 $TargetIP = $Parts[1]; 18 $TargetID = $Parts[2]; 9 19 $SenderIP = $Parts[3]; 10 20 $SenderID = $Parts[4]; … … 16 26 $RoomName = $Parts[9]; 17 27 $RoomType = $Parts[10]; 18 echo('Message: '.$Text);19 DB_Select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"');20 if( DB_NumRows()>0)28 if($Debug == 1) echo('Message: '.$Text."\n"); 29 $DbResult = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 30 if($DbResult->num_rows > 0) 21 31 { 22 $Row = DB_Row();32 $Row = $DbResult->fetch_array(); 23 33 $Nick = $Row['nick']; 24 34 } else $Nick = ''; 25 DB_Insert('sunrisechat_history',array('time' => 'NOW()', 'nick' => addslashes($Nick), 'text' => addslashes(htmlspecialchars($Text)), 'color' => $Color, 35 echo('<'.$Nick.'>'.$Text." ".addslashes($Text)."\n"); 36 $Database->insert('sunrisechat_history',array('time' => 'NOW()', 'nick' => $Nick, 'text' => $Text, 'color' => $Color, 26 37 'roomname' => $RoomName, 'roomtype' => $RoomType)); 38 } 39 if($Command == 'Alive') 40 { 41 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 42 if($DbResult->num_rows() > 0) 43 { 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)); 47 } 48 if($Command == 'GoOnline') 49 { 50 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 51 if($DbResult->num_rows() > 0) 52 { 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')); 56 } 57 if($Command == 'GoAway') 58 { 59 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 60 if($DbResult->num_rows() > 0) 61 { 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')); 27 65 } 28 66 if($Command == 'UserInfo') 29 67 { 30 68 $Nick = $Parts[7]; 31 echo('UserInfo: '.$Nick );32 DB_Select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"');33 if( DB_NumRows()>0)69 echo('UserInfo: '.$Nick."\n"); 70 $Result = $Database->select('sunrisechat_onlinelist','*','sender_id='.$SenderID.' AND sender_ip="'.$SenderIP.'"'); 71 if($DbResult->num_rows() > 0) 34 72 { 35 $Row = DB_Row();36 DB_Update('sunrisechat_onlinelist','sender_ip="'.$SenderIP.'" AND sender_id='.$SenderID,array('lasttime' => 'NOW()', 'nick' => $Nick));37 } else DB_Insert('sunrisechat_onlinelist',array('lasttime' => 'NOW()', 'nick' => $Nick, 'sender_ip' => $SenderIP, 'sender_id' => $SenderID));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])); 38 76 } 77 if($Command == 'WhoIs') // for WebSunriseChat support 78 { 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) 81 { 82 $Row = $DbResult->fetch_array(); 83 $_SESSION['DetailInfo'] = $Row['info']; 84 $Nick = $Row['nick']; 85 $_SESSION['nick'] = $Nick; 86 $_SESSION['IP'] = $Row['sender_ip']; 87 $_SESSION['ID'] = $Row['sender_id']; 88 $_SESSION['sequence'] = $Row['sequence']; 89 Send('UserInfo',''); 90 if($Debug == 1) echo('UserInfo: '.$Nick."\n"); 91 } 92 } 93 } 94 //DB_Select('sunrisechat_onlinelist','UNIX_TIMESTAMP(lasttime)'); 95 //$Row = DB_Row(); 96 //echo($Row[0]-(time()-200)."\n"); 97 DB_Delete('sunrisechat_onlinelist','UNIX_TIMESTAMP(lasttime)<'.(time()-30)); 98 } 99 100 $Filename = '/tmp/sunrisechatout'; 101 $Filename2 = '/tmp/sunrisechatin'; 102 $File2 = fopen($Filename2,'w'); 103 while(1) 104 { 105 if(file_exists($Filename)) 106 { 107 $File = fopen($Filename,'r'); 108 $Data = fread($File,65000); 109 fclose($File); 110 unlink($Filename); 111 //echo($Data); 112 $Rows = explode("\n",$Data); 113 array_pop($Rows); 114 foreach($Rows as $Item) 115 { 116 Packet($Item); 117 //echo($Item."\n"); 118 } 119 } 120 sleep(5); 121 } 39 122 40 123 ?> -
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']; -
www/sunrisechat/webchat.php
r1 r4 1 <? 2 session_start(); 1 <?php 2 include_once('../global.php'); 3 3 include_once('../style.php'); 4 4 ShowHeader('Okno Sunrisechatu','Sunrisechatu'); 5 6 include_once('/a/html/is/db.php');7 DB_Init('localhost','root','','is');8 DB_Query('SET CHARACTER SET latin2');9 5 10 6 include_once('webchatsend.php'); … … 17 13 Send('Disconnect',''); 18 14 session_unregister('nick'); 19 echo('Byl jste odhlá ¹en.<br>');15 echo('Byl jste odhlášen.<br>'); 20 16 } 21 17 22 18 if(array_key_exists('nick',$_POST)) 23 19 { 24 DB_Select('sunrisechat_onlinelist','*'," nick='".$_POST['nick']."'");25 if( DB_NumRows()==0)20 $DbResult = $Database->select('sunrisechat_onlinelist','*'," nick='".$_POST['nick']."'"); 21 if($DbResult->num_rows == 0) 26 22 { 27 23 $_SESSION['nick'] = $_POST['nick']; … … 29 25 Send('UserInfo',''); 30 26 Send('Connect',''); 31 } else echo('P øezdívka ji¾ pou¾ita! Zvolte jinou pøezdívku.');27 } else echo('Přezdívka již použita! Zvolte jinou přezdívku.'); 32 28 } 33 29 … … 45 41 <tr><td>Výpis diskuse:<br> 46 42 <IFRAME MARGINWIDTH="0" MARGINHEIGHT="0" src="webchatframe.php?nick='.$_SESSION['nick'].'" width="100%" height="405" frameborder="0"></IFRAME> 47 </td><td width="150">U ¾ivatelé:<br>43 </td><td width="150">Uživatelé:<br> 48 44 <IFRAME MARGINWIDTH="0" MARGINHEIGHT="0" src="webchatframe2.php?nick='.$_SESSION['nick'].'" width="100%" height="405" frameborder="0"></IFRAME> 49 45 </td></tr><tr><td> … … 58 54 <table style="border-color: black; border-size: 1px; border-style: solid;" align="center"> 59 55 <tr><th colspan="2">WebSunriseChat</th></tr> 60 <tr><td align="center">P øezdívka:</td><td><input type="text" name="nick" size="20"></td></tr>56 <tr><td align="center">Přezdívka:</td><td><input type="text" name="nick" size="20"></td></tr> 61 57 <tr><td align="center">Celé jméno:</td><td><input type="text" name="name" size="20"></td></tr> 62 58 <tr><td align="center" colspan="2"><input type="submit" value="Vstoupit"></td></tr> -
www/sunrisechat/webchatframe.php
r1 r4 1 <? 2 header('Refresh: 5');3 session_start();1 <?php 2 include('../global.php'); 3 header('Refresh: 5'); 4 4 5 5 echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 6 6 <html><head><title>Chat frame</title> 7 8 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">9 7 <meta http-equiv="Content-Language" content="cs"> 8 <meta http-equiv="Content-Type" content="text/html; charset='.$Config['Web']['Charset'].'"> 9 </head><body>'); 10 10 11 if(array_key_exists('nick',$_GET)) 12 { 13 $_SESSION['nick'] = $_GET['nick']; 14 include_once('webchatsend.php'); 15 Send('Alive',''); 16 } 17 18 include_once('/a/html/is/db.php'); 19 DB_Init('localhost','root','','is'); 20 DB_Query('SET CHARACTER SET latin2'); 11 if(array_key_exists('nick',$_GET)) 12 { 13 $_SESSION['nick'] = $_GET['nick']; 14 include_once('webchatsend.php'); 15 Send('Alive',''); 16 } 21 17 22 23 18 $List = array(); 19 echo('<table style="height: 100; font-family: Arial;" width="100%" cellspacing="0" cellpadding="2" border="1" bgcolor="#d0d0d0"><tr><td bgcolor="#ffffff" width="90%" valign="top" style="font-size: 14px;">'); 24 20 25 DB_Select('sunrisechat_history','*,UNIX_TIMESTAMP(time)',' roomtype=0 ORDER BY time DESC LIMIT 0,24');26 while($List[] = DB_Row());27 28 29 30 31 32 33 34 35 36 37 21 $DbResult = $Database->select('sunrisechat_history','*,UNIX_TIMESTAMP(time)',' roomtype=0 ORDER BY time DESC LIMIT 0,24'); 22 while($List[] = $DbResult->fetch_array()); 23 array_pop($List); 24 $List = array_reverse($List); 25 foreach($List as $Row) 26 { 27 $Text = htmlspecialchars($Row['text']); 28 if(substr($Text,0,strlen($_SESSION['nick'])) == $_SESSION['nick']) $Text = '<strong><'.$Row['nick'].'> '.$Text.'</strong>'; 29 else $Text = '<'.$Row['nick'].'> '.$Text; 30 echo('['.date('H:i:s',$Row['UNIX_TIMESTAMP(time)']).'] <span style="color: #'.dechex($Row['color']).'">'.$Text.'</span><br>'); 31 } 32 echo('</td></tr></table> 33 </body></html>'); 38 34 ?> -
www/sunrisechat/webchatframe2.php
r1 r4 1 <? 2 header('Refresh: 5');3 session_start();1 <?php 2 include('../global.php'); 3 header('Refresh: 5'); 4 4 5 5 echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 6 6 <html><head><title>User list</title> 7 8 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">9 7 <meta http-equiv="Content-Language" content="cs"> 8 <meta http-equiv="Content-Type" content="text/html; charset='.$Config['Web']['Charset'].'"> 9 </head><body>'); 10 10 11 if(array_key_exists('nick',$_GET)) 12 { 13 $_SESSION['nick'] = $_GET['nick']; 14 include_once('webchatsend.php'); 15 Send('Alive',''); 16 } 17 18 include_once('/a/html/is/db.php'); 19 DB_Init('localhost','root','','is'); 20 DB_Query('SET CHARACTER SET latin2'); 11 if(array_key_exists('nick',$_GET)) 12 { 13 $_SESSION['nick'] = $_GET['nick']; 14 include_once('webchatsend.php'); 15 Send('Alive',''); 16 } 21 17 22 $List = array(); 23 echo('<table style="height: 100%; font-family: Arial;" width="100%" cellspacing="0" cellpadding="2" border="1" bgcolor="#d0d0d0"><tr> 24 <td bgcolor="#ffffff" valign="top" width="10%" style="font-size: 14px;">'); 25 DB_Select('sunrisechat_onlinelist','*'); 26 while($Row = DB_Row()) 27 { 28 if($Row['status'] == 'Away') echo('<img src="images/UserNotAvailable.png" alt="away icon">'); 29 else if($Row['status'] == 'Writting') echo('<img src="images/UserWritting.png" alt="writting icon">'); 30 else echo('<img src="images/UserOnline.png" alt="online icon">'); 31 echo($Row['nick'].'<br>'); 32 } 33 echo('</td></tr></table> 34 </body></html>'); 18 $List = array(); 19 echo('<table style="height: 100%; font-family: Arial;" width="100%" cellspacing="0" cellpadding="2" border="1" bgcolor="#d0d0d0"><tr> 20 <td bgcolor="#ffffff" valign="top" width="10%" style="font-size: 14px;">'); 21 $DbResult = $Database->select('sunrisechat_onlinelist','*'); 22 while($Row = $DbResult->fetch_array()) 23 { 24 if($Row['status'] == 'Away') echo('<img src="images/UserNotAvailable.png" alt="away icon">'); 25 else if($Row['status'] == 'Writting') echo('<img src="images/UserWritting.png" alt="writting icon">'); 26 else echo('<img src="images/UserOnline.png" alt="online icon">'); 27 echo($Row['nick'].'<br>'); 28 } 29 echo('</td></tr></table> 30 </body></html>'); 31 35 32 ?> -
www/sunrisechat/webchatsend.php
r1 r4 1 <? 1 <?php 2 2 3 3 function AddPart($Text) … … 37 37 AddPart($Color); // User text color 38 38 AddPart($Text); // Command data 39 $RoomName = 'V ¹ichni';39 $RoomName = 'Všichni'; 40 40 AddPart($RoomName); // Room name 41 41 AddPart(0); // Public or private room
Note:
See TracChangeset
for help on using the changeset viewer.