Welcome, Guest
  • Author Topic: passing to SQL Table  (Read 1138 times)

    frank

    • Server what's that
    • *
    • Posts: 8
      • View Profile
      • Email
    passing to SQL Table
    « on: 04/03/04, 17:10 »
    Hay all!  ;D

    Im not sure if this is the right place to post !

    I have a PHP p2p client that connects to a chat server and exports the chat stats to a html file.

    This is the
    Code: [Select]

             
          function sendToPHPDc ($host,$method,$path,$data,$useragent=0) {
       if (empty($method)) {
         $method = 'GET';
       }
       $method = strtoupper($method);
       $fp = fsockopen($host,80);
       if ($fp) {
       if ($method == 'GET') {
         $path .= '?' . $data;
       }
       fputs($fp, "$method $path HTTP/1.0\r\n");
       fputs($fp, "Host: $host\r\n");
       fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
       fputs($fp, "Content-length: " . strlen($data) . "\r\n");
       if ($useragent)
          fputs($fp, "User-Agent: MSIE\r\n");
       fputs($fp, "Connection: close\r\n\r\n");
       if ($method == 'POST') {
         fputs($fp, $data);
       }
       while (!feof($fp))
          $buf .= fgets($fp,1024);
       fclose($fp);
       }
       return $buf;
    }

    function send_data () {

    $host      = "127.0.0.1";
    $method    = "POST";
    $path      = "data.php";
    $data      = "share=".$this->sendstats['share']."&hub=".$this->sendstats['hub']."&site_url=".$this->sendstats['site_url']."&users=".$this->sendstats['users']."";
    $useragent = 1;

    $buffer = $this->sendToPHPDc ($host,$method,$path,$data,$useragent);


    This is part of a working scriped!

    My problem is that i need to pass the above vars to a sql table named stats i have the correct valuse set but just cant seem to pass the $hub $users .ext, to the table,
    Can any one help me on this issue,

    It would be much apretiated.

    frank

    • Server what's that
    • *
    • Posts: 8
      • View Profile
      • Email
    Re:passing to SQL Table
    « Reply #1 on: 04/04/04, 18:10 »
    Hello again people!  ;D

    sorry if th topic was a bit lame lol

    Ive managed to resolve my problem though,By putting this
    Code: [Select]

                                    //--------------
          // Send To SQL
          //--------------
          
          require("util.php");
          $sql = new MySQL_class;
          $sql->Create("verlihub");
          
          echo("Database connection successful.\n");
          
          
          $sql->Update("update stats set Name = '{$hub}'");
          $affected_rows = $sql->a_rows;



    Into the class.php file. this outputs  the stats gatherd by the bot in the hub to the 'stats' table on row 'Name'

    if any one may ever need it  :D
    « Last Edit: 04/04/04, 18:12 by frank »