ayuda con un codigo!!!

S

superbigo

hola a todos... miren buscando por internet me encontre con esto

http://www.forosdelweb.com/showthread.php?t=330426

PHP:
 <?php 

// ####################### SET PHP ENVIRONMENT ########################### 
    error_reporting(E_ALL & ~E_NOTICE); 
    @set_time_limit( 0 ); 

// #################### DEFINE IMPORTANT CONSTANTS ####################### 
    define('NO_REGISTER_GLOBALS', 1); 
    define('THIS_SCRIPT', 'testdevelocidad'); 


// ######################### REQUIRE BACK-END ############################ 
    require_once('./global.php'); 
    require_once('./includes/functions_bigthree.php'); 
    require_once('./includes/functions_forumlist.php'); 


//------------------------------------------------------------------------------------------------- 
//  funciones 


    function getip() { 
        if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) 
            $ip = getenv("HTTP_CLIENT_IP"); 
        else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) 
            $ip = getenv("HTTP_X_FORWARDED_FOR"); 
        else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) 
            $ip = getenv("REMOTE_ADDR"); 
        else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) 
            $ip = $_SERVER['REMOTE_ADDR']; 
        else 
            ip = "desconocido"; 

        return($ip); 
} 


//------------------------------------------------------------------------------------------------- 
//  main 


    // get permissions to view 
    if (!($permissions['forumpermissions'] & CANVIEW)) { 
        print_no_permission(); 
    } 

    if( !empty($_REQUEST['b']) || !empty($_REQUEST['t']) ) { 
        globalize($_REQUEST, array( 'b' => INT, 't' => FLOAT)); 
        $b *= 1;$t *= 1; 
        if( $b===0 || $t===0 ) { 
            $str_res = "Oops!"; 
        } 
        else if( $b != 1048576 ) { 
            $str_res = "Oops!"; 
        } 
        else if( $t >= (10 * 60) ) { 
            $str_res = "Oops!"; 
        } 
        else if( $t < 0.1 ) { 
            $str_res = "Oops!"; 
        } 
        else { 

            $s_tests = " "; 
            $sql = $DB_site->query("UPDATE testdevelocidad SET tests=tests+1 WHERE id=1;");    // si OK, sql==1 
            if( $sql == 1 ) { 
                $sql = $DB_site->query("SELECT tests FROM testdevelocidad WHERE id=1;"); 
                $row = mysql_fetch_row($sql); 
                if (!$row) { 
                    $DB_site->query("INSERT INTO testdevelocidad VALUES (1,1);"); 
                    $tests = 1; 
                } 
                else { 
                    $tests = $row[0]; 
                } 
                $s_tests = " #$tests, "; 
            } 
                 

            define( 'kEspacios', 18 ); 


            $ips = $sp_ips = ""; 
            $ip = getip(); 
            $iphostname = @gethostbyaddr($ip); 
            if( $iphostname != $ip ) { 
                if( strrpos($iphostname, '.')    === false ) 
                    $ips = $iphostname; 
                else 
                    $ips = substr($iphostname, (strrpos( (substr($iphostname, 0, strrpos($iphostname, '.'))), '.' ))+1); 
                $sp_ips  = str_repeat( " ", (kEspacios - strlen($ip)) ); 
            } 
             
            $str_b = number_format($b, 0, ',', '.'); 
            $sp_str_b = str_repeat( " ", (kEspacios - strlen($str_b)) ); 

            $te = $t; 
            $str_te = number_format($te, 3, ',', '.'); 
            $sp_str_te = str_repeat( " ", (kEspacios - strlen($str_te)) ); 

            $t_KBs = $b / $te; 
            $str_t_KBs = number_format($t_KBs/1000, 2, ',', '.'); 
            $sp_str_t_KBs = str_repeat( " ", (kEspacios - strlen($str_t_KBs)) ); 

            $t_Kbps = 8 * $t_KBs; 
            $str_t_Kbps = number_format($t_Kbps/1000, 2, ',', '.'); 
            $sp_str_t_Kbps = str_repeat( " ", (kEspacios - strlen($str_t_Kbps)) ); 

            $uid = $bbuserinfo['userid']; 
            $str_res  = '<center><h2>Velocidad de Transferencia</h2></center><br>'; 
            $str_res .= "<pre>"; 
            $str_res .= $s_tests; 
            $str_res .= strftime( "%A %d de %B %Y a las %H:%M:%S", time() ) ." EST (GMT-5)<br>"; 
            $str_res .= "&nbsp;<br>"; 
            $str_res .= " IP/ISP de destino        " . $ip . $sp_ips . $ips . "<br>"; 
            $str_res .= " Bytes transferidos       " . $str_b . $sp_str_b . "bytes<br>"; 
            $str_res .= " Tiempo empleado          " . $str_te . $sp_str_te . "segundos<br>"; 
            $str_res .= " Velocidad Kbps           " . $str_t_Kbps . $sp_str_t_Kbps . "Kbps<br>"; 
            $str_res .= " Velocidad KBytes/sec     " . "<b>" . $str_t_KBs . "</b>" . $sp_str_t_KBs . "KBytes/sec<br>"; 
            $str_res .= "</pre>&nbsp;"; 
    } 

        eval(print_standard_error( $str_res, false)); 
    } 
    else { 
?>         
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html dir="ltr" lang="es-MX"> 
    <META NAME="ROBOTS" CONTENT="ALL"> 
    <META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT"> 
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">  
    <META name="keywords" content="speed test, internet speed test, download speed test, download test, test de velocidad, foro, politica, opinion, arte, literatura, juegos" /> 
    <META name="description" content="Test de Velocidad" /> 
    <title>Test de Velocidad</title> 

<style type="text/css"><!-- 
body                         { background: #D5D5D5 url(images/fondo.gif); color: #000020; font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; margin: 5px 10px 10px 10px; padding: 0px; } 
.tborder                { background-color: #7A7B69; color: #000000; border: 1px solid #0B198C; } 
.tcat                        { background-color: #7A7B69; color: #FFFF66; font: bold 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; } 
.panelsurround    { background: #D5D8E5 url(images/gradients/gradient_panelsurround.gif) repeat-x top left; color: #000000; } 
.panel                    { background: #E4E7F5 url(images/gradients/gradient_panel.gif) repeat-x top left; color: #000000; padding: 10px; border: 2px outset; } 
.button                    {    font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; } 
.page                        { background-color: ""; color: #000000; } 
.small                    { font: 12px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; } 
--></style> 

<center><table BORDER=0 CELLSPACING=0 CELLPADDING=10 WIDTH="75%" > 
<tr ALIGN=CENTER VALIGN=CENTER> 
<td ALIGN=CENTER VALIGN=CENTER> 
<center><a href="./"><img SRC="./images/pombo3.gif" border="0" alt="El Pombo"><a></center> 
</td> 
<td ROWSPAN="2"> 
<center><a href="./"><img SRC="./images/cafe.gif" border="0" alt="El Pombo"><a></center> 
</td> 
</tr> 
</table></center> 

<div align="center"> 
    <div class="page" style="width:92%; text-align:left"> 
        <div style="padding:0px 25px 0px 25px"> 
<br><br><br> 

<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="73%" align="center"> 
<tr> 
    <td class="tcat">El Pombo dice:</td> 
</tr> 
<tr> 
    <td class="panelsurround" align="center"> 
    <div class="panel"> 
        <div align="left" class="small"> 
            <!-- main message --> 
            <br> 
            <blockquote><p> 
            <b>Midiendo la velocidad de transferencia entre EEUU y su ordenador.</b> 
            <br><br> 
            Por favor, espere ... 
            <br><br> 
            </p></blockquote> 
            <!-- / main message -->             
        </div> 
    </div> 

    <div style="margin-top:6px"> 
        <input type="submit" class="button" value=" Cancelar " accesskey="s" onclick="history.back(1); return false" /> 
    </div> 

    </td> 
</tr> 
</table> 
<br> 
        </div>     
    </div> 
</div> 

<script language="javascript"> 
Hs=new Date(); 
beg=Hs.getTime()/1000.0; 
</script> 
<!--<? 
    $times = 1024; 
    $out = array(); 
    for( $i=0; $i<$times; $i++ ) {                    // llena el buffer 
        $linea = ""; 
        for( $m=0; $m<32; $m++ )                            // k, 1024 
            $linea .= md5(microtime());                    // md5 es 32 bytes 
        $out[$i] = $linea; 
    } 
    for ($i=0;$i<=$times;$i++) 
        echo $out[$i];                                                // Output 
?>--> 
<script language="javascript"> 
    var timeB=new Date(); 
    var stop=((timeB.getTime())/1000.0) - beg; 
    var dim=<? echo 1024 * $times; ?>; 
    document.write("</head>"); 
    document.write("<body onload=document.location.replace(\"testdevelocidad.php?b="+dim+"&t="+stop+"\")>");   
</script> 

</body> 
</html> 
<?php 
    } 
     
//------------------------------------------------------------------------------------------------- 
//  end 
?>

este codigo es para un medidor de velocidad de coneccion a internet que se usa con vbulletin pero no lopuedo echan a andar!!!!

quien le puede hechar un vistaso primero me tira error en la linea

ip = "desconocido";

la elimino peor puego me dice que no tengo permiso par ver la pagina...
esto creo que le interesa a todos... al hecharlo andar ganamos todos!!!
 
Arriba