Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: padekit

Parašė EHF· 2009 Lap. 7 18:11:02
#1

kas gali pasakyti kas cia blogaj kad meta tokia klaida:

Warning: require(/counterstrikeClass.php) [function.require]: failed to open stream: No such file or directory in W:\www\stat\Server.php on line 4

Fatal error: require() [function.require]: Failed opening required '/counterstrikeClass.php' (include_path='.;/usr/local/PHP/includes;/usr/local/PHP/pear') in W:\www\stat\Server.php on line 4




server.php
<?php
//Do not Edit Below this line!! (And next time i remember not to make any parse errors)
//*******************************************************************************************************
require('/counterstrikeClass.php');
?>

<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
<BODY bgcolor="<?php echo $bgcolor ?>">
</head>

<body background="achtergrondje.gif" leftmargin="0" topmargin="7" marginwidth="0" marginheight="0">
<div align="left">
  <table width="748" height="355" border="1" cellpadding="1" cellspacing="1" bordercolor="#000000" bgcolor="#F3F3F3">
    <tr>
      <td height="351" valign="top">
     <?php
// Get server Adress and port!
$serveradr ="$serv_ip";
$serverport="$serv_port";

// Get server info!
$csinfo=new CounterStrike;
$status=$csinfo->getServerInfo($serveradr,$serverport,1000);
    if ($status) {
   
// Get info about players, frags, timep!
$server = new CounterStrike;
$status=$server->getServerPlayers($serveradr,$serverport,1000);
if ($status) {


?>
  <TABLE>
    <TR>
      <TD width="598" height="196">
        <TABLE width="400">
          <TR>
            <TD width="75"><font color="<?php echo $font2 ?>" size="<?php echo $size2 ?>">Servername :</font></TD>
            <TD width="313"><font color="<?php echo $font3 ?>" size="<?php echo $size3 ?>">
              <?=$csinfo->m_servervars["servername"] ?>
              </font></TD>
          </TR>
          <TR>
            <TD><font color="<?php echo $font2 ?>" size="<?php echo $size2 ?>">Server ip :</font></TD>
            <TD><font color="<?php echo $font3 ?>" size="<?php echo $size3 ?>">
              <?=$csinfo->m_servervars["serveraddress"] ?>
              </font></TD>
          </TR>
          <TR>
            <TD><font color="<?php echo $font2 ?>" size="<?php echo $size2 ?>">Spelers :</font></TD>
            <TD><font color="<?php echo $font3 ?>" size="<?php echo $size3 ?>">
              <?=$csinfo->m_servervars["currentplayers"] ?>
              </font><font color="<?php echo $font2 ?>" size="<?php echo $size2 ?>">/</font>           <font color="<?php echo $font3 ?>" size="<?php echo $size3 ?>">
              <?=$csinfo->m_servervars["maxplayers"]?>
              </font></TD>
          </TR>
          <TR>
            <TD><font color="<?php echo $font2 ?>" size="<?php echo $size2 ?>">Map :</font></TD>
            <TD><font color="<?php echo $font3 ?>" size="<?php echo $size3 ?>">
              <?=$csinfo->m_servervars["mapname"]?>
              </font></TD>
          </TR>
          <TR>
            <TD COLSPAN="2">&nbsp;</TD>
          </TR>
          <TR>
            <TD height="106" COLSPAN="2" ALIGN="CENTER">
              <div align="left"><IMG
SRC="<?php
if(is_file($pics . $csinfo->m_servervars["mapname"] . ".gif")) { print $pics . $csinfo->m_servervars["mapname"] . ".gif"; }
else { print $pics . "cstrike_nopicture.gif"; } ?>" width="130"
height="100" ALT="<?=$csinfo->m_servervars["mapname"]?>">               </div></TD>
          </TR>
      </TABLE>     
        <table>
          <tr>
            <td width="85"><font color="<?php echo $font2 ?>" size="<?php echo $size2 ?>">Name</font></td>
            <td width="78"><font color="<?php echo $font2 ?>" size="<?php echo $size2 ?>">Frags</font></td>
            <td width="84"><font color="<?php echo $font2 ?>" size="<?php echo $size2 ?>">Time</font></td>
          </tr>
          <?php
     if (is_array($server->m_playerinfo)) {
         while (list(,$player) = each ($server->m_playerinfo)) {
?>
          <tr>
            <td><?=$player['name'];?></td>
            <td><?=$player['frags'];?></td>
            <td><?=$player['time'];?></td>
          </tr>
          <?php
         }
     } else {
?>
          <tr>
            <td class="error" colspan="3"><font color="<?php echo $font3 ?>" size="<?php echo $size13 ?>"><?php echo $players ?></font></td>
          </tr>
          <?php
     }
?>
        </table></TD>
    </TR>
    <?php } else {
   } ?>
  </TABLE>
   <?
} else {
?>
  <strong><font color="<?php echo $font1 ?>" size="<?php echo $size1 ?>"><?php echo $error ?></font></strong>
  <?php
}
?>
  <?php if($creator) { echo(" <font color='#FFFFFF' size='2'>Peter Huizenga CS status Script v1.0</font>"); } ?> </td>
    </tr>
  </table>
</div>
</body>
</html>




counsterstrikeClass.php
<?php
//***************************************************
// Peter Huizenga CS status Script v1.0
// This is an Counter Strike Server info script!
//
//
// This Script is Free and may not be for sale in any way!
// You can change it very easy to youre own will,
// and server info!
//
// Thanks Peter Huizenga
// webmaster@clandoa.tk
//***************************************************


// Edit below to youre own server info!

// Server info
$serv_ip = "89.36.173.222";                     // IP of the server
$serv_port = "27015";                        // Port of the server server

// Site style
$title = "Server Info and player stats";         // Title of the site
$players = "There are no players online!";         // If no players are on the server this message will apere
$pics = "/images/csmaps/";                     // Place of the map images!!
$error = "Can't connect to gameserver!<br>Server is down!!";   // Message if no connection to server!
$bgcolor = "#262d40";                        // Background color

$font1 = "#FF0000";                           // Color of the Error!
$font2 = "#FFFFFF";                           // Color of the Name
$font3 = "#f5d300";                           // Color of the information leters
$size1 = "10";                              // Size of the Error!
$size2 = "4";                              // Size of Name
$size3 = "2";                              // Size of the information leters

$copy = "#333333";                           // color for copyright
$border ="#000000";                           // colot tabelen

$tab1  = "#8898A8";                           // Tabellenkop
$tab2  = "#41556D";                           // Tabellenkleur 2

$creator = true;                           //true; or false; Support the Creator!


//Do not Edit Below this line!!
//*******************************************************************************************************

function fragsort ($a, $b) {
     if ($a["frags"] == $b["frags"]) return 0;
     if ($a["frags"] > $b["frags"]) {
          return -1;
     } else {
          return 1;
     }
}
Class CounterStrike {
     var $m_playerinfo   ="";                      // Info about players
     var $m_servervars   ="";                      // Info about the server current map, players etc
     var $m_serverrules  ="";                      // Serverrules

//
// Get exact time, used for timeout counting
//
     function timenow() {
          return doubleval(ereg_replace('^0\.([0-9]*) ([0-9]*)$','\\2.\\1',microtime()));
     }

//
// Read raw data from server
//
     function getServerData($command,$serveraddress,$portnumber,$waittime) {
          $serverdata    ="";
          $serverdatalen =0;

          if ($waittime< 500) $waittime= 500;
          if ($waittime>2000) $waittime=2000;
          $waittime=doubleval($waittime/1000.0);

          if (!$cssocket=fsockopen("udp://".$serveraddress,$portnumber,$errnr)) {
               $this->errmsg="No connection";
               return "";
          }

          socket_set_blocking($cssocket,true);
//socket_set_timeout($cssocket,0,500000);
          fwrite($cssocket,$command,strlen($command));
// Mark
          $starttime=$this->timenow();
          do {
               $serverdata.=fgetc($cssocket);
               $serverdatalen++;
               $socketstatus=socket_get_status($cssocket);
               if ($this->timenow()>($starttime+$waittime)) {
                    $this->errmsg="Connection timed out";
                    fclose($cssocket);
                    return "";
               }
          } while ($socketstatus["unread_bytes"] );
          fclose($cssocket);
          return $serverdata;
     }

     function getnextstring(&$data) {
          $temp="";
          $counter=0;
          while (ord($data[$counter++])!=0) $temp.=$data[$counter-1];
          $data=substr($data,strlen($temp)+1);
          return $temp;
     }
     function getnextbytevalue(&$data) {
          $temp=ord($data[0]);
      $data=substr($data,1);
      return $temp;
     }
     function getnextfragvalue(&$data) {
          $frags=ord($data[0])+(ord($data[1])<<8)+(ord($data[2])<<16)+(ord($data[3])<<24);
          if ($frags>=4294967294) $frags-=4294967296;
          $data=substr($data,4);
          return $frags;
     }
     function getnextplaytime(&$data) {
          $decnumber=ord($data[0])+(ord($data[1])<<8)+(ord($data[2])<<16)+(ord($data[3])<<24);
          $binnumber=base_convert($decnumber,10,2);
          while (strlen($binnumber) < 32) $binnumber="0".$binnumber;
          $exp=abs(base_convert(substr($binnumber,1,8),2,10))-127;
          if (substr($binnumber,0,1)=="1") $exp=0-$exp;
          $man=1;$manadd=0.5;
          for ($counter=9;$counter<32;$counter++) {
               if (substr($binnumber,$counter,1)=="1") $man+=$manadd;
               $manadd=$manadd/2;
          }
          $time=round(pow(2,$exp)*$man);
          $playtime="";
          if ($time>3600) {
               $playtime=sprintf("%2dh",$time/3600);
          }
          $time%=3600;
          $playtime=$playtime.sprintf("%2dm",$time/60);
          $time%=60;
          $playtime=$playtime.sprintf("%2ds",$time);
          $data=substr($data,5);
          return $playtime;
     }
//
// getServerRules
// Read rules/setup from the gameserver into m_serverrules
// Return true if successful
//
     function getServerRules($serveraddress,$portnumber,$waittime) {
          $cmd="\xFF\xFF\xFF\xFFrules\x00";
          $serverdata=$this->getServerData($cmd,$serveraddress,$portnumber,$waittime)    ;
// Check length of returned data, if < 5 something went wrong
          if (strlen($serverdata)<5) return false;
// Figure out how many rules there are
          $rules=(ord($serverdata[5]))+(ord($serverdata[6])*256);
          if ($rules!=0) {
// Strip OOB data
               $serverdata=substr($serverdata,7);
               for ($i=1;$i<=$rules;$i++) {
                    $rulename      =$this->getnextstring($serverdata);
                    $rulevalue     =$this->getnextstring($serverdata);
                    $this->m_serverrules[$rulename]=$rulevalue;
               }
               return true;
          } else {
               return false;
          }
     }

//
// getServerinfo
// Read information about the gameserver into m_servervars
// Serveraddress,servername,current map etc etc
// Return true if successful
//
     function getServerInfo($serveraddress,$portnumber,$waittime) {
          $cmd="\xFF\xFF\xFF\xFFinfo\x00";
          $serverdata=$this->getServerData($cmd,$serveraddress,$portnumber,$waittime)    ;
// Check length of returned data, if < 5 something went wrong
          if (strlen($serverdata)<5) return false;
// Strip OOB data
          $serverdata=substr($serverdata,5);
          $this->m_servervars["serveraddress"]     =$this->getnextstring($serverdata);
          $this->m_servervars["servername"]        =$this->getnextstring($serverdata);
          $this->m_servervars["mapname"]           =$this->getnextstring($serverdata);
          $this->m_servervars["game"]              =$this->getnextstring($serverdata);
          $this->m_servervars["gamename"]          =$this->getnextstring($serverdata);
          $this->m_servervars["currentplayers"]    =$this->getnextbytevalue($serverdata);
          $this->m_servervars["maxplayers"]        =$this->getnextbytevalue($serverdata);
          return true;
}
//
// Get Playerinfo
// Read information about the players into m_playerinfo
// Name,frags,playtime
// Return true if successful
//
     function getServerPlayers($serveraddress,$portnumber,$waittime) {
// Servercommand
          $cmd="\xFF\xFF\xFF\xFFplayers\x00";
          $serverdata=$this->getServerData($cmd,$serveraddress,$portnumber,$waittime);

// Check length of returned data, if < 5 something went wrong
          if (strlen($serverdata)<5) return false;

// Check number of players to read data for
          $players=ord($serverdata[5]);

// Strip OOB data and other stuff
          $serverdata=substr($serverdata,7);
          for ($i=1;$i<=$players;$i++) {
               $playername                                      =htmlspecialchars($this->getnextstring($serverdata));
               $frags                                           =$this->getnextfragvalue($serverdata);
               $playtime                                        =$this->getnextplaytime($serverdata);
               $this->m_playerinfo[$i] =array("name"=>$playername,"frags"=>$frags,"time"=>$playtime);
          }
// Sort players in fragorder
          if ($players>1) usort($this->m_playerinfo,"fragsort");
          return true;
     }
}
?>



Redagavo EHF· 2009 Lap. 9 18:11:50