Ignore:
Timestamp:
Jan 14, 2008, 9:48:39 PM (17 years ago)
Author:
george
Message:

Upraveno: Změna přístupu k databázi na třídu rozšířenou mysqli.
Upraveno: Sjednocení
Upraveno: Změna kódování všech stránek na UTF-8.
Odstraňeno: Staré nepotřebné soubory.

Location:
www
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • www

    • Property svn:ignore set to
      config.php
      php_script_error.log
  • www/sunrisechat/sunrisechat2.php

    r1 r4  
    1 <?
     1<?php
    22
    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');
     3include_once('../global.php');
     4include_once('webchatsend.php');
    75 
    86$Debug = 0;
     
    108function Packet($Text2)
    119{
    12   global $Debug;
     10  global $Debug, $Database;
    1311  //echo("{".$Text2."}".ord($Text2[1]).".".strlen($Text2)."\n");
    1412  //echo($Text2.strlen($Text2)."\n");
     
    2927    $RoomType = $Parts[10];
    3028    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)
    3331    {
    34       $Row = DB_Row();
     32      $Row = $DbResult->fetch_array();
    3533      $Nick = $Row['nick'];
    3634    } else $Nick = '';
    3735    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,
    3937    'roomname' => $RoomName, 'roomtype' => $RoomType));
    4038  }
    4139  if($Command == 'Alive')
    4240  {
    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)
    4543    {
    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)); 
    4947  }
    5048  if($Command == 'GoOnline')
    5149  {
    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)
    5452    {
    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')); 
    5856  }
    5957  if($Command == 'GoAway')
    6058  {
    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)
    6361    {
    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')); 
    6765  }
    6866  if($Command == 'UserInfo')
     
    7068    $Nick = $Parts[7];
    7169    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)
    7472    {
    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]));
    7876  }
    7977  if($Command == 'WhoIs')   // for WebSunriseChat support
    8078  {
    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)
    8381    {
    84       $Row = DB_Row();
     82      $Row = $DbResult->fetch_array();
    8583      $_SESSION['DetailInfo'] = $Row['info'];
    8684      $Nick = $Row['nick'];
Note: See TracChangeset for help on using the changeset viewer.