|
|
|
ต้องการเก็บค่า text ที่รับมาจากไวแลส ลงฐานข้อมูล SQL ดังโค๊ต |
|
|
|
|
|
|
|
<?
$fp = fsockopen("192.168.0.11", 23, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
// $out .= "Host: 192.168.0.11\r\n";
// $out .= "Connection: Close\r\n\r\n";
$fpnew1 =@fopen ("c:\gh011.txt","w+") or die ("error");
fwrite($fp,$out);
echo fgets($fp,21);
$data1 = @fread($fp,21);
fwrite($fpnew1,$data1);
fclose($fp);
fclose($fpnew1);
}
?>
<?
$fp =@fopen ("c:\gh011.txt","r") or die ("error");
$fpnew1 =@fopen ("c:\gh022.txt","w") or die ("error");
while ($ln=@fread ($fp,21)){
$data1 = substr($ln,strpos($ln,"A")+1);
fwrite($fpnew1,$data1);
}
@fclose($fp);
@fclose($fpnew1);
?>
<?
$fp =@fopen ("c:\gh022.txt","r") or die ("error");
$fpnew1 =@fopen ("c:\gh033.txt","w") or die ("error");
while ($ln=@fread ($fp,12)){
$data2 = substr_replace($ln,"s",9,10);
fwrite($fpnew1,$data2);
}
@fclose($fp);
@fclose($fpnew1);
?>
<?
$fp =@fopen ("c:\gh033.txt","r") or die ("error");
$fpnew1 =@fopen ("c:\gh044.txt","w") or die ("error");
$ln=@fread ($fp,12) ;
$d1 = substr_replace($ln,"A#",0,0);
fwrite($fpnew1,$d1);
@fclose($fp);
@fclose($fpnew1);
?>
<?
$fp =@fopen ("c:\gh044.txt","r") or die ("error");
$fpnew1 =@fopen ("c:\gh055.txt","w") or die ("error");
$ln=@fread ($fp,15) ;
$d2 = substr_replace($ln,"#",4,0);
fwrite($fpnew1,$d2);
@fclose($fp);
@fclose($fpnew1);
?>
<?
$fp =@fopen ("c:\gh055.txt","r") or die ("error");
$fpnew1 =@fopen ("c:\gh066.txt","w") or die ("error");
$ln=@fread ($fp,15) ;
$d3 = substr_replace($ln,"#",7,0);
fwrite($fpnew1,$d3);
@fclose($fp);
@fclose($fpnew1);
?>
<?
$fp =@fopen ("c:\gh066.txt","r") or die ("error");
$fpnew1 =@fopen ("c:\gh077.txt","w") or die ("error");
$ln=@fread ($fp,20) ;
$d4 = substr_replace($ln,"#",10,0);
fwrite($fpnew1,$d4);
@fclose($fp);
@fclose($fpnew1);
?>
<?
$fp =@fopen ("c:\gh077.txt","r") or die ("error");
$fpnew1 =@fopen ("c:\gh01.txt","w") or die ("error");
$ln=@fread ($fp,20) ;
$d5 = substr_replace($ln,"#",13,0);
fwrite($fpnew1,$d5);
@fclose($fp);
@fclose($fpnew1);
?>
ค่าที่รับมามีดังนี้ 102030
ฐานข้อมูลมี 3 ฟิวก์
ต้องการเก็บ ฟิวก์ที่ 1 เก็บ 10
ฟิวก์ที่ 2 เก็บ 20
ฟิวก์ที่ 3 เก็บ 30
ช่วยหน่อยนะ งง งง งง งง งงมาก
Tag : - - - -
|
|
|
|
|
|
Date :
17 ก.พ. 2551 19:24:45 |
By :
น้องใหม่ |
View :
1465 |
Reply :
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|