Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Server list del mysql problemos

Parašė Mantvydas· 2008 Spa. 29 16:10:46
#1

Sveiki,

bandau sukurti serveriu lista, padarau subdomena, idedu reikiamus failus, bet ismeta klaida:
Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/*******/domains/******/public_html/serveriai/index.php on line 261

Gal kas buvot susidure su sia beda? Prasau padekit

Parašė tabux· 2008 Spa. 29 22:10:06
#2

o tai kas rasoma index.php 261 eiluteje?

Parašė Zixx· 2008 Spa. 29 22:10:37
#3

Errora issiversk: At reading initial - Kazkokia klaida nuskaitant inicial1-simbolĮ ,bent jau manau a

Parašė kiskiss· 2008 Spa. 29 22:10:38
#4

Klaida 261 eilutėje

Parašė Zixx· 2008 Spa. 29 22:10:42
#5

Žmogau, čia ir taip aišku.. Jis žalias.. Jam kad pasakei kur nieko nepadės..Viska ištrins ir klaidą paliks..
Įmesk savo tą eilutę čia, patvarkysim :)

Parašė Mantvydas· 2008 Spa. 30 10:10:02
#6

$db = mysql_connect($hostas, $useris, $passas) or die("<center><b>Laikinos serverio problemos</b></center>") or die("<center><b>Laikinos serverio problemos</b></center>");




Stai toji eilute, zinau kad cia klaida, bet nesuprantu kur.. Juk cia viskas atrodo gerai.

Redagavo Mantvydas· 2008 Spa. 30 10:10:14

Parašė Arnelis· 2008 Spa. 30 10:10:34
#7

Blogai gal suvedes duomenis esi mysql.

Parašė tabux· 2008 Spa. 30 10:10:05
#8

bandyk toki koda
$db = mysql_connect($hostas, $useris, $passas);
if(mysql_connect_error()){
printf("<center><b>Laikinos serverio problemos</b></center>");
exit();
}



Parašė Mantvydas· 2008 Spa. 30 10:10:57
#9

Dekui, bet neveikia, ismeta dar viena klaida del 262 eilutes

Parašė tabux· 2008 Spa. 30 10:10:49
#10

tai tu visa koda ikelk ir pasiziuresiu kas ten ne taip

Parašė Mantvydas· 2008 Spa. 30 11:10:57
#11

<html>
<head>
<title>Server List</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>

<body bgimage="bg.jpg" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#FFFFFF">
<center><img src=images/theme/head.jpg></center>
<?php
$starttime = microtime();
$startarray = explode(" ", $starttime);
$starttime = $startarray[1] + $startarray[0];
?>
<?php
include "configas.php";
error_log(0);
function show_server($ip, $port, $big, $blod){
   include "locale.php";
   $maxlongname       = 70;
   $maxlongnamesmall    = 40;
   if($server = @fsockopen("udp://".$ip,$port,$errno,$errstr)){
      
         $write = "\xFF\xFF\xFF\xFFTSource Engine Query\x00";
         socket_set_timeout($server,1);
         $time_in       = microtime_float();
         fwrite($server, $write);
           $server_response    = fread($server,4096);
                 $time_out       = microtime_float();
         if ($server_response) {
   $server_ping       = (int)(($time_out-$time_in)*1000);
   $server_response    = substr($server_response, 5);
   $server_address    = get_value_string($server_response);
    $server_host_name    = get_value_string($server_response);
    $map             = get_value_string($server_response);
   $gamedir          = get_value_string($server_response);
    $gamename          = get_value_string($server_response);
    $count_players       = get_value_byte($server_response);
   $maxplayers       = get_value_byte($server_response);
   $netver          = get_value_byte($server_response);
   $dedicated          = get_value_byte($server_response);
   $os             = get_value_byte($server_response);
   $pass             = get_value_byte($server_response);
   $skip            = get_value_byte($server_response);
   $skip            = get_value_string($server_response);
   $skip            = get_value_string($server_response);
   $skip            = get_value_string($server_response);
   $skip            = get_value_lint($server_response);
   $skip            = get_value_lint($server_response);
   $skip            = get_value_byte($server_response);
   $skip            = get_value_byte($server_response);
   $secure          = get_value_byte($server_response);
   $bots             = get_value_byte($server_response);
   
   $players          = "$count_players / $maxplayers";
   if($big == 1){
   if (file_exists("images/".$map.".jpg")){$map_image = "<img src='images/".$map.".jpg' class='img2'>";}else{$map_image = "<img src='images/nera.jpg'  class='img2'>";}
   echo "<br>\n";
   echo "<table class='bgbigo' width='700' align='center'>\n<tr>\n<td>\n";
   
   echo "<table width='100%' align='center' border='0'>\n";
   echo "<tr>\n";
   echo "<td rowspan='7' width='160'>\n";
   echo $map_image."\n";
   echo "</td>\n";
   echo "</tr>\n";
   
   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[pavadinimas];
   echo "</td>\n";
   echo "<td>\n";
   if (strlen($server_host_name) > $maxlongname){
   $server_host_namesmall = substr($server_host_name, 0, $maxlongname - 3) . "...";
   }else{
      $server_host_namesmall = $server_host_name;
   }
   echo $server_host_namesmall."\n";
   echo "</td>\n";
   echo "</tr>\n";
   
   echo "<tr>\n";
   echo "<td >";
   echo $locale[adresas];
   echo "</td>\n";
   echo "<td>\n";
   echo htmlspecialchars($ip).":".htmlspecialchars($port)."\n";
   echo "</td>\n";
   echo "</tr>\n";
   
   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[zaidejai];
   echo "</td\n>";
   echo "<td>\n";
   echo htmlspecialchars($players)."\n";
   echo "</td>\n";
   echo "</tr>\n";      
   
   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[zemelapis];
   echo "</td>\n";
   echo "<td >\n";
   echo htmlspecialchars($map)."\n";
   echo "</td>\n";
   echo "</tr>\n";

   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[pingas];
   echo "</td>\n";
   echo "<td>\n";
   echo htmlspecialchars($server_ping)."\n";
   echo "</td>\n";
   echo "</tr>\n";   
   
   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[protokolas];
   echo "</td>\n";
   echo "<td>\n";
   echo htmlspecialchars($netver)."\n";
   echo "</td>\n";
   echo "</tr>\n";   
   
   
   echo "</table>\n";
   
   echo "</td>\n</tr>\n</table>\n<br>\n";
   }
   
   if($big == 0){
      
   if (strlen($server_host_name) > $maxlongnamesmall){
   $server_host_namesmall = substr($server_host_name, 0, $maxlongnamesmall - 3) . "...";
   }else{
      $server_host_namesmall = $server_host_name;
   }
   echo "<tr>\n";      
   echo "<td class='list_row1'>\n";
   echo "<center><img src='images/theme/cstrike.gif'></center>\n";
   echo "</td>\n";
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo htmlspecialchars($server_host_namesmall)."\n";
   blodclose($blod);
   echo "</td>";
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo htmlspecialchars($ip).":".htmlspecialchars($port)."\n";
   blodclose($blod);
   echo "</td>\n";
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo htmlspecialchars($map)."\n";
   blodclose($blod);
   echo "</td>\n";   
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo "<center>".htmlspecialchars($players)."</center>\n";
   blodclose($blod);
   echo "</td>\n";
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo "<center>".htmlspecialchars($server_ping)."</center>\n";
   blodclose($blod);
   echo "</td>\n";
   echo "<tr>\n";


   }
   
}

      }
      
      
      
      
}

   function get_value_byte(&$data){
   $temp = $data[0];
   $data = substr($data, 1);
   return ord($temp);
}

function get_value_string(&$data){
   $temp = '';
   $i = 0;
   while (ord($data[$i]) != 0){
       $temp .= $data[$i];
       $i++;
   }
   $data = substr($data, $i+1);
   return $temp;
}

function get_value_sint(&$data){
   $temp = substr($data, 0, 2);
   $data = substr($data, 2);
   $array = @unpack('Sshort', $temp);
   return $array['short'];            
}

function get_value_lint(&$data){
   $temp = substr($data, 0, 4);
   $data = substr($data, 4);
   $array = @unpack('Lint', $temp);
   return $array['int'];
}

function get_value_float(&$data){
   $temp = substr($data, 0, 4);
   $data = substr($data, 4);
   $array = @unpack('ffloat', $temp);
   return $array['float'];
}
            
function microtime_float() {
   list($usec, $sec) = explode(" ", microtime());
   return ((float)$usec + (float)$sec);
}

   function blodopen($blod){
   if($blod == "1"){
      echo "<font color='#CC0000'><b>";
   }}
   
   
function blodclose($blod){
if($blod == "1"){
      echo "</font></b>";
   }}

//Gaunam serveriu duomenis is msql ir bandom juos isvesti xD

function dbarray($query) {
   $result = @mysql_fetch_assoc($query);
   if (!$result) {
      echo mysql_error();
      return false;
   } else {
      return $result;
   }
}


function dbcount($field,$table,$conditions="") {
   $cond = ($conditions ? " WHERE ".$conditions : "");
   $result = @mysql_query("SELECT Count".$field." FROM ".DB_PREFIX.$table.$cond);
   if (!$result) {
      echo mysql_error();
      return false;
   } else {
      $rows = mysql_result($result, 0);
      return $rows;
   }
}

$db = mysql_connect($hostas, $useris, $passas);
if(mysql_connect_error()){
printf("<center><b>Laikinos serverio problemos</b></center>");
exit();
}
mysql_select_db($dbas) or die("<center><b>Laikinos serverio problemos 2</b></center>");
$snddata = mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"));

$goas = mysql_query("DELETE FROM ".$fusionoprefixas."money_servers WHERE `galiojaiki` < '".$snddata."'");

$serveriai1 = mysql_query("SELECT * FROM ".$fusionoprefixas."money_servers WHERE `tipas` = 1 and `galiojaiki` > ".$snddata." ORDER BY galiojaiki DESC");
if(!$serveriai1)
{
   
}else{
while($serverio1 = dbarray($serveriai1))
{
   show_server($serverio1[serverip], $serverio1[serveroprt], "1", "0");
}
}
echo "<table cellpadding='3' cellspacing='0' class='list_table' width='700' align='center'>\n";
echo "<tr>\n<td class='list_row1'> </td>\n<td class='list_row1'><center>Serverio pavadinimas:</center></td>\n<td class='list_row1'><center>Ip:</center></td>\n<td class='list_row1'><center>Zemelapis:</center></td>\n<td class='list_row1'><center>Zaidejai:</center></td>\n<td class='list_row1'><center>Pingas:</center></td>\n</tr>\n";

$serveriai = mysql_query("SELECT * FROM ".$fusionoprefixas."money_servers WHERE `tipas` = '0' and `galiojaiki` > ".$snddata." ORDER BY galiojaiki DESC") or die("<center><b>Laikinos serverio problemos</b</center>");

while($serverio = dbarray($serveriai))
{
   show_server($serverio[serverip], $serverio[serveroprt], "0", "0");
}

mysql_close($db);
echo "</table>";
?>
<?php
$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,0);
?>
</body>
</html>
<br>
<center><font size="-4" color="#ffffff" face="Tahoma">© 2008. Visos teisės saugomos.<br></font><a href=""><font size="-4" color="#ffffff" face="Tahoma"></font></a></center>






Visas index.php

configas.php :

<?php
$hostas = "mysql.hostingas.in";
$useris = "***_servers";
$passas = "db_pass";
$dbas = "***_gmg";
$fusionoprefixas = "fusion_php";
?>



Parašė tabux· 2008 Spa. 30 11:10:15
#12

na ka bandyk dar karta
<html>
<head>
<title>Server List</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body bgimage="bg.jpg" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#FFFFFF">
<center><img src=images/theme/head.jpg></center>
<?php
$starttime = microtime();
$startarray = explode(" ", $starttime);
$starttime = $startarray[1] + $startarray[0];
?>

<?php
include "configas.php";
error_log(0);
function show_server($ip, $port, $big, $blod){
   include "locale.php";
   $maxlongname       = 70;
   $maxlongnamesmall    = 40;
   if($server = @fsockopen("udp://".$ip,$port,$errno,$errstr)){
     
         $write = "\xFF\xFF\xFF\xFFTSource Engine Query\x00";
         socket_set_timeout($server,1);
         $time_in       = microtime_float();
         fwrite($server, $write);
           $server_response    = fread($server,4096);
                 $time_out       = microtime_float();
         if ($server_response) {
   $server_ping       = (int)(($time_out-$time_in)*1000);
   $server_response    = substr($server_response, 5);
   $server_address    = get_value_string($server_response);
    $server_host_name    = get_value_string($server_response);
    $map             = get_value_string($server_response);
   $gamedir          = get_value_string($server_response);
    $gamename          = get_value_string($server_response);
    $count_players       = get_value_byte($server_response);
   $maxplayers       = get_value_byte($server_response);
   $netver          = get_value_byte($server_response);
   $dedicated          = get_value_byte($server_response);
   $os             = get_value_byte($server_response);
   $pass             = get_value_byte($server_response);
   $skip            = get_value_byte($server_response);
   $skip            = get_value_string($server_response);
   $skip            = get_value_string($server_response);
   $skip            = get_value_string($server_response);
   $skip            = get_value_lint($server_response);
   $skip            = get_value_lint($server_response);
   $skip            = get_value_byte($server_response);
   $skip            = get_value_byte($server_response);
   $secure          = get_value_byte($server_response);
   $bots             = get_value_byte($server_response);
   
   $players          = "$count_players / $maxplayers";
   if($big == 1){
   if (file_exists("images/".$map.".jpg"){$map_image = "<img src='images/".$map.".jpg' class='img2'>";}else{$map_image = "<img src='images/nera.jpg'  class='img2'>";}
   echo "<br>\n";
   echo "<table class='bgbigo' width='700' align='center'>\n<tr>\n<td>\n";
   
   echo "<table width='100%' align='center' border='0'>\n";
   echo "<tr>\n";
   echo "<td rowspan='7' width='160'>\n";
   echo $map_image."\n";
   echo "</td>\n";
   echo "</tr>\n";
   
   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[pavadinimas];
   echo "</td>\n";
   echo "<td>\n";
   if (strlen($server_host_name) > $maxlongname){
   $server_host_namesmall = substr($server_host_name, 0, $maxlongname - 3) . "...");
   }else{
      $server_host_namesmall = $server_host_name;
   }
   echo $server_host_namesmall."\n";
   echo "</td>\n";
   echo "</tr>\n";
   
   echo "<tr>\n";
   echo "<td>";
   echo $locale[adresas];
   echo "</td>\n";
   echo "<td>\n";
   echo htmlspecialchars($ip).":".htmlspecialchars($port)."\n";
   echo "</td>\n";
   echo "</tr>\n";
   
   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[zaidejai];
   echo "</td\n>";
   echo "<td>\n";
   echo htmlspecialchars($players)."\n";
   echo "</td>\n";
   echo "</tr>\n";     
   
   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[zemelapis];
   echo "</td>\n";
   echo "<td>\n";
   echo htmlspecialchars($map)."\n";
   echo "</td>\n";
   echo "</tr>\n";

   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[pingas];
   echo "</td>\n";
   echo "<td>\n";
   echo htmlspecialchars($server_ping)."\n";
   echo "</td>\n";
   echo "</tr>\n";   
   
   echo "<tr>\n";
   echo "<td>\n";
   echo $locale[protokolas];
   echo "</td>\n";
   echo "<td>\n";
   echo htmlspecialchars($netver)."\n";
   echo "</td>\n";
   echo "</tr>\n";   
   
   
   echo "</table>\n";
   
   echo "</td>\n</tr>\n</table>\n<br>\n";
   }
   
   if($big == 0){
     
   if (strlen($server_host_name) > $maxlongnamesmall){
   $server_host_namesmall = substr($server_host_name, 0, $maxlongnamesmall - 3) . "...";
   }else{
      $server_host_namesmall = $server_host_name;
   }
   echo "<tr>\n";     
   echo "<td class='list_row1'>\n";
   echo "<center><img src='images/theme/cstrike.gif'></center>\n";
   echo "</td>\n";
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo htmlspecialchars($server_host_namesmall)."\n";
   blodclose($blod);
   echo "</td>";
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo htmlspecialchars($ip).":".htmlspecialchars($port)."\n";
   blodclose($blod);
   echo "</td>\n";
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo htmlspecialchars($map)."\n";
   blodclose($blod);
   echo "</td>\n";   
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo "<center>".htmlspecialchars($players)."</center>\n";
   blodclose($blod);
   echo "</td>\n";
   echo "<td class='list_row1'>\n";
   blodopen($blod);
   echo "<center>".htmlspecialchars($server_ping)."</center>\n";
   blodclose($blod);
   echo "</td>\n";
   echo "<tr>\n";


   }
   
}

      }
     
     
     
     
}

   function get_value_byte(&$data){
   $temp = $data[0];
   $data = substr($data, 1);
   return ord($temp);
}

function get_value_string(&$data){
   $temp = '';
   $i = 0;
   while (ord($data[$i]) != 0){
       $temp .= $data[$i];
       $i++;
   }
   $data = substr($data, $i+1);
   return $temp;
}

function get_value_sint(&$data){
   $temp = substr($data, 0, 2);
   $data = substr($data, 2);
   $array = @unpack('Sshort', $temp);
   return $array['short'];           
}

function get_value_lint(&$data){
   $temp = substr($data, 0, 4);
   $data = substr($data, 4);
   $array = @unpack('Lint', $temp);
   return $array['int'];
}

function get_value_float(&$data){
   $temp = substr($data, 0, 4);
   $data = substr($data, 4);
   $array = @unpack('ffloat', $temp);
   return $array['float'];
}
           
function microtime_float() {
   list($usec, $sec) = explode(" ", microtime());
   return ((float)$usec + (float)$sec);
}

   function blodopen($blod){
   if($blod == "1"{
      echo "<font color='#CC0000'><b>";
   }}
   
   
function blodclose($blod){
if($blod == "1"{
      echo "</font></b>";
   }}

//Gaunam serveriu duomenis is msql ir bandom juos isvesti xD

function dbarray($query) {
   $result = @mysql_fetch_assoc($query);
   if (!$result) {
      echo mysql_error();
      return false;
   } else {
      return $result;
   }
}


function dbcount($field,$table,$conditions="") {
   $cond = ($conditions ? " WHERE ".$conditions : "";
   $result = @mysql_query("SELECT Count".$field." FROM ".DB_PREFIX.$table.$cond);
   if (!$result) {
      echo mysql_error();
      return false;
   } else {
      $rows = mysql_result($result, 0);
      return $rows;
   }
}

$db = mysql_connect($hostas, $useris, $passas);
if(mysql_connect_error()){
printf("<center><b>Laikinos serverio problemos</b></center>)";
exit();
}else{
mysql_select_db($dbas);
}
$snddata = mktime(date("H",date("i",date("s",date("m",date("d",date("Y");

$goas = mysql_query("DELETE FROM ".$fusionoprefixas."money_servers WHERE 'galiojaiki' < '".$snddata."'");

$serveriai1 = mysql_query("SELECT * FROM ".$fusionoprefixas."money_servers WHERE 'tipas' = 1 and 'galiojaiki' > ".$snddata." ORDER BY galiojaiki DESC");
if(!$serveriai1)
{
   
}else{
while($serverio1 = dbarray($serveriai1))
{
   show_server($serverio1[serverip], $serverio1[serveroprt], "1", "0";
}
}
echo "<table cellpadding='3' cellspacing='0' class='list_table' width='700' align='center'>\n";
echo "<tr>\n<td class='list_row1'> </td>\n<td class='list_row1'><center>Serverio pavadinimas:</center></td>\n<td class='list_row1'><center>Ip:</center></td>\n<td class='list_row1'><center>Zemelapis:</center></td>\n<td class='list_row1'><center>Zaidejai:</center></td>\n<td class='list_row1'><center>Pingas:</center></td>\n</tr>\n";

$serveriai = mysql_query("SELECT * FROM ".$fusionoprefixas."money_servers WHERE `tipas` = '0' and `galiojaiki` > ".$snddata." ORDER BY galiojaiki DESC" or die("<center><b>Laikinos serverio problemos</b</center>");

while($serverio = dbarray($serveriai))
{
   show_server($serverio[serverip], $serverio[serveroprt], "0", "0";
}

mysql_close($d);
echo "</table>";
?>
<?php
$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,0);
?>
</body>
</html>
<br>
<center><font size="-4" color="#ffffff" face="Tahoma">© 2008. Visos teises saugomos.<br></font><a href=""><font size="-4" color="#ffffff" face="Tahoma"></font></a></center>





Parašė Fucikijoooou· 2008 Spa. 30 11:10:28
#13

Cia tavo duombazes nustatymai klaidyngi paziurek ar viska gerai suvedei
gal prefix'ai skirtyngi ?

Parašė Rytis· 2008 Spa. 30 12:10:29
#14

$hostas = "mysql.hostingas.in";

???

Turėtų būti mysqlhost