Вход Регистрация
Файл: _gladiators2_/gladiators2/gladiators/gladiators/system/class/main_class.php
Строк: 105
<?php

class DBconn
{
var 
$server;
var 
$username;
var 
$passwd;
var 
$db_table;
var 
$db_stream;
var 
$row;
var 
$num;

  function 
SetSettings($kingdom,$server_conf)
  {
    for(
$i=0;$i<=count($server_conf)-1;$i++)
    {
      if(
$server_conf[$i][0]==$kingdom)
      {
        
$this->server=$server_conf[$i][1];
        
$this->username=$server_conf[$i][2];
        
$this->passwd=$server_conf[$i][3];
        
$this->db_table=$server_conf[$i][4];
      }

    }
  }
  function 
Conn($kingdom,$server_conf)
  {
    
    
$this->SetSettings($kingdom,$server_conf);

    
$db = @mysql_connect($this->server,$this->username,$this->passwd);
    
$tb = @mysql_select_db($this->db_table);

    if(
$db && $tb) return 1;
      else return 
0;

  }

  function 
query($q)
  {
    
$this->db_stream=@mysql_query($q);

    if(
$this->db_stream) return 1;
      else return 
0;
  }

  function 
fetch_array()
  {
    
$this->row = @mysql_fetch_array($this->db_stream);
 
    if(
$this->row) return 1;
      else return 
0;
  }

  function 
num_rows()
  {
    
$this->num = @mysql_num_rows($this->db_stream);
 
    if(
$this->num) return 1;
      else return 
0;
  }

}
class 
SockConnect // Class is using to work with server consol program
{

var 
$srv_status=0;
var 
$srv_ip;
var 
$srv_port;
var 
$sock;
var 
$send_buff;
var 
$get_buff;
var 
$max_buff_len 10240;
var 
$errno;
var 
$errstr;

  function 
SetSettings($kingdom,$server_conf)
  {
    for(
$i=0;$i<=count($server_conf)-1;$i++)
    {
      if(
$server_conf[$i][0]==$kingdom)
      {
        
$this->srv_ip=$server_conf[$i][6];
        
$this->srv_port=$server_conf[$i][7];
      }

    }
  }

  function 
Connect($kingdom,$server_conf// Connecting to server through port 
  
{

    
$this->SetSettings($kingdom,$server_conf);

    
$this->sock=@fsockopen($this->srv_ip,$this->srv_port$this->errno$this->errstr30); 
    
$this->srv_status=1;
    if(
$this->sock)
    {
      return 
1;
    }
    else
    {
      return 
0;
    }
  } 
  
  function 
Send() // Sending buffer to server
  
{
    if(
$this->send_buff && $this->srv_status)
    {
      @
fputs($this->sock,$this->send_buff."");
      return 
1;
    }
    else
    {
      return 
0;
    }
  }

  function 
Get() //
  
{
    if(
$this->srv_status)
    {
      
$this->get_buff = @fgets($this->sock,$this->max_buff_len);

      if(
$this->get_buff)
      {
        return 
1;
      }
      else
      {
        return 
0;
      }
    }
    else
    {
      return 
0;
    }  
  }

  function 
Close()
  {
    if(
$this->srv_status==1)
    {
      
fclose($this->sock);
      
$this->srv_status 0;
    }
  }
}



class 
UserInfo
{

var 
$id;
var 
$login;
var 
$passwd;



 function 
LoadDate($q)
 {
   if(
$q)
   {
     
$mass explode(";",$q);
      
   }
   else
   {
     return 
0;
   }
 }

}


?>
Онлайн: 2
Реклама