PHP Web Host - Quality Web Hosting For All PHP Applications Clan Themes! We make clans look good!!
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 12:33 pm Reply with quote Back to top

Ok here a nice chalenge to any phpfreak....

I was using a bandwidth speedtest on my site for some time untill a member maild and said its not working.
So suprised as i was he was right... Sad

Yep maild the author,but no respons...
Then i searched for other sites who are using the script and i did found a few.
Strange to see that their versions were also dead.
Then i realised it had to do with the new php version.
So for some reason there was a change and now its dead.

So i was hoping if someone can see why its not working anymore....

THIS IS THE FILE THAT DOES THE WORK

Code:

<?php include_once("config.inc.php"); ?>
<html>
<head>
<title><?php echo $isp_name; ?> - Bandwidth Meter</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="Expires" CONTENT="Fri, Jun 12 1981 08:20:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><?php echo $header; ?></td>
 </tr>
</table>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td><br><br><br><br><br><br><font size=+1>
Conducting bandwidth tests...</font></td>
</tr>
</table>
<script>
<!--
time      = new Date();
starttime = time.getTime();
// -->
</scr   ipt>
<?php
$data_file = "payload.bin";
$fd = fopen ($data_file, "rb");
if (isset($_GET['kbps'])) {
$test_kbytes = ($_GET['kbps'] / 8) * 10;  //set the download to take 10 seconds
if ($test_kbytes > 3000) {
$test_kbytes = 3000;
}
} else {
$test_kbytes = $default_kbyte_test_size;
}
$contents = fread ($fd, $test_kbytes * 1024);
echo "<!-- $contents -->";
fclose ($fd);
?>
<sc     ript>
<!--
time          = new Date();
endtime       = time.getTime();
if (endtime == starttime)
{downloadtime = 0
}
else
{downloadtime = (endtime - starttime)/1000;
}
kbytes_of_data = <?php echo $test_kbytes; ?>;
linespeed     = kbytes_of_data/downloadtime;
kbps          = (Math.round((linespeed*8)*10*1.024))/10;
<?php
$nexturl = "results.php?kbps=' + kbps + '&downloadtime=' + downloadtime + '&KB=' + kbytes_of_data + '&recorded=1";
?>
nextpage='<?php echo $nexturl; ?>';
document.location.href=nextpage
// -->
</sc      ript>
<center>
</body>
</html>


So whatever the change was in the new php ,the above doesnt work anymore...

Anybody ?
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Jan 01, 2005 1:44 pm Reply with quote Back to top

If you mean 4.3.10 most problems are in the fact that the Zend Engine has changed a bit and requires that you be using the latest release of the Zend Optimizer.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 2:03 pm Reply with quote Back to top

oh ok,but at what point in the script do you see or have an idea where it goes wrong ?
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Jan 01, 2005 2:20 pm Reply with quote Back to top

Please post the config.inc.php code.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 2:23 pm Reply with quote Back to top

Thats this...

Code:

<?php
$mysql = True;
$database = array ( "host" => "localhost", "login" => "username", "password" => "userpassword", "database" => "dbname" );
/*******************************************************************************
 * The following options allow simple customization.  $isp_name shows up in the
 * title bar.
 ******************************************************************************/
$isp_name = getenv(SERVER_NAME);
$header = ""; //"Here is an optional header";
$footer = ""; //"Here is an optional footer";
/*******************************************************************************
 * Modify the following settings if you would like to change the name/speed of
 * services the meter compares the current connection to.
 ******************************************************************************/
 $services = array( "28.8" =>  array ( "name" => "modem", "image" => "1.gif")
                 , "33.6" =>  array ( "name" => "modem", "image" => "1.gif")
                 , "53.3" =>  array ( "name" => "modem", "image" => "1.gif")
                 , "56" =>    array ( "name" => "RNIS", "image" => "2.gif")
                 , "128"  =>  array ( "name" => "RNIS", "image" => "2.gif")
                 , "384"  =>  array ( "name" => "DSL", "image" => "3.gif")
                 , "768"  =>  array ( "name" => "DSL", "image" => "3.gif")
                 , "1000"  => array ( "name" => "DSL", "image" => "4.gif")
                 , "1500"  => array ( "name" => "DSL/T1/Modem Cable", "image" => "5.gif")
);
/*******************************************************************************
 * Determines the bar image that is shown for the current test.
 ******************************************************************************/
$user_graph_image = "you.gif";
/*******************************************************************************
 * Determines the heights of the bars (in pixels) in the graph display.
 ******************************************************************************/
$bar_height = 10;
/*******************************************************************************
 * When set to true, the bandwidthmeter performs a quick check then sends a
 * payload based on the estimated pipe size.
 ******************************************************************************/
$use_initialmeter = True;
/*******************************************************************************
 * When not using the initialmeter.php to calculate the payload size,
 * $default_kbyte_test_size will be used.  When linking to meter.php directly,
 * this file size is used.  When linking to initialmeter.php, initialmeter
 * decides the file size to send based on its estimate of the pipe size.
 ******************************************************************************/
$default_kbyte_test_size = 512;
?>
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Jan 01, 2005 2:26 pm Reply with quote Back to top

It's very hard to test when you don't include the entire script. It also requires these files:

payload.bin
results.php
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Jan 01, 2005 2:27 pm Reply with quote Back to top

Why don't you package the application, zip it, and provide a link?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 2:28 pm Reply with quote Back to top

yeah your right,

this is the file ,direct download link..
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Jan 01, 2005 2:39 pm Reply with quote Back to top

It runs perfectly on my servers (php v4.3.10)
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 2:45 pm Reply with quote Back to top

well thats weird,but i also have 4.3.10.
does it have anything to do with the few functions that are disabled on the server....(on other topic)
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 3:44 pm Reply with quote Back to top

gone again ?
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 4:18 pm Reply with quote Back to top

and what is weird is that if i run the initialmeter.php instead of the meter.php it shows..

bandwidthmeter/meter.php?kbps=3530.6 in the address bar.
But no images...
Any clue?
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Jan 01, 2005 4:19 pm Reply with quote Back to top

None at all since it works here.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 4:22 pm Reply with quote Back to top

well how come suddenly the whole image part doesnt work anymore ?
thats why i asked if it has anything to do with the 4 php functions that are disabled on the server...?

These..

system
exec
shell_exec
passthru
chown
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Jan 01, 2005 4:28 pm Reply with quote Back to top

None of those are used afaik. I can't answer your question since I can't reproduce it.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Sat Jan 01, 2005 4:39 pm Reply with quote Back to top

ok thanks,then il wait if that gambit idiot responds.
View user's profile Send private message
VinDSL
Life Cycles Becoming CPU Cycles


Joined: Jul 11, 2004
Posts: 617
Location: Arizona (USA) Admin: NukeCops.com Admin: Disipal Designs Admin: Lenon.com

PostPosted: Sun Jan 02, 2005 6:22 am Reply with quote Back to top

Hrm... Interesting script!

I got it working on my site, without much difficulty. The only thing I had to change was the path to the graphics.

Code:

<snip>

/*******************************************************************************
 * Modify the following settings if you would like to change the name/speed of
 * services the meter compares the current connection to.
 ******************************************************************************/
$services = array( "28.8" =>  array ( "name" => "dial-up"
                                   , "image" => "images/1.gif"
                                   )
                 , "33.6" =>  array ( "name" => "dial-up"
                                    , "image" => "images/1.gif"
                                   )
                 , "53.3" =>  array ( "name" => "dial-up"
                                    , "image" => "images/1.gif"
                                   )
                 , "56" =>    array ( "name" => "ISDN"
                                    , "image" => "images/2.gif"
                                   )
                 , "128"  =>  array ( "name" => "ISDN"
                                    , "image" => "images/2.gif"
                                   )
                 , "384"  =>  array ( "name" => "DSL"
                                    , "image" => "images/3.gif"
                                   )
                 , "768"  =>  array ( "name" => "DSL"
                                    , "image" => "images/3.gif"
                                   )
                 , "1000"  => array ( "name" => "DSL"
                                    , "image" => "images/4.gif"
                                   )
                 , "1500"  => array ( "name" => "DSL/T1/Cable"
                                    , "image" => "images/5.gif"
                                   )
          );

/*******************************************************************************
 * Determines the bar image that is shown for the current test.
 ******************************************************************************/
$user_graph_image = "images/you.gif";

<snip>



Here's a link, if you wanna check it out:
Only registered users can see links on this board!
Get registered or login to the forums!


I'm running PHP: 4.3.10 ...


Last edited by VinDSL on Sun Jan 16, 2005 7:14 am; edited 1 time in total
View user's profile Send private message Visit poster's website ICQ Number
VinDSL
Life Cycles Becoming CPU Cycles


Joined: Jul 11, 2004
Posts: 617
Location: Arizona (USA) Admin: NukeCops.com Admin: Disipal Designs Admin: Lenon.com

PostPosted: Sun Jan 02, 2005 10:16 pm Reply with quote Back to top

Found another bug...

At the bottom of 'results.php':

Change:
Code:

<?php

if ($mysql == True) {
    $link = mysql_connect($database["host"], $database["login"],
        $database["password"])
        or die("Could not connect");
    mysql_select_db($database["database"])
        or die("Could not select database");

    $ip = $_SERVER['REMOTE_ADDR'];
    $name = gethostbyaddr($ip);
    $query = "INSERT INTO readings (speed, ip, name) VALUES ($kbps, '$REMOTE_ADDR', '$name')";
    $result = mysql_query($query)
        or die("Query failed");
}

?>



To:


Quote:

<?php

if ($mysql == True) {
$link = mysql_connect($database["host"], $database["login"],
$database["password"])
or die("Could not connect");
mysql_select_db($database["database"])
or die("Could not select database");

$ip = $_SERVER['REMOTE_ADDR'];
$name = gethostbyaddr($ip);
$query = "INSERT INTO readings (speed, ip, name) VALUES ($kbps, '$ip', '$name')";
$result = mysql_query($query)
or die("Query failed");
}

?>

View user's profile Send private message Visit poster's website ICQ Number
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Mon Jan 03, 2005 7:06 am Reply with quote Back to top

thanks...
look into it...
View user's profile Send private message
VinDSL
Life Cycles Becoming CPU Cycles


Joined: Jul 11, 2004
Posts: 617
Location: Arizona (USA) Admin: NukeCops.com Admin: Disipal Designs Admin: Lenon.com

PostPosted: Mon Jan 03, 2005 5:57 pm Reply with quote Back to top

hitwalker wrote:
thanks...

Thank YOU! I'm having a lot of fun with this script!

I've been playing around with it, for the last couple of days, porting it over to Nuke. At first, I debugged the code, then I made a module out of it using @&$^%! iframe. It looked nice, but once I got it up 'n' running, and a few ppl beta tested it, I looked through the results in the sql db and I found out it was wildly inaccurate (at times), especially after doing a 'retest'. Then, it clicked...

I'm running a highly mod'ed version of PHP-Nuke 6.5 Final, using GZIP compression, caching, et cetera. Looking at the source code that the Bandwidthmeter module was generating in Nuke, I started wondering, "How the hell is this thing supposed to work in a compressed and cached environment?"

So, I tried running it in a stand-alone JavaScript popup window, and bada bing, bada boom, it started turning out consistent and highly accurate results.

I don't know if you're running this as a block, module, or popup, but the popup window is the only way to go, IMHO.

Here's the lastest version:
Only registered users can see links on this board!
Get registered or login to the forums!


See if it works for you... Wink


Last edited by VinDSL on Sun Jan 16, 2005 7:13 am; edited 1 time in total
View user's profile Send private message Visit poster's website ICQ Number
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Mon Jan 03, 2005 6:13 pm Reply with quote Back to top

hi ,

well it was running on my site...
btw i send you a private message today ?

Anyway....it just stopped working for some weird reason...
in my address bar i se the speed but images simply dont show...

as i wrote ...im beginning to believe this all somehow has to do something with my computer....im not sure...

i have the xp windows firewall off.
all normal configurations in norton 2005 ,never touched anything....

but also weird is that almost at same time i discovered that the database backup function doesnt work for me.

i download a file of 0.0 kb

so im wondering if this is all related...

(and i just tried yours again AND its NOT working...)
View user's profile Send private message
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Mon Jan 03, 2005 6:58 pm Reply with quote Back to top

I just used the one at VinDSL got a whopping 45.70kbps which is fairly accurate unfortunetly.
View user's profile Send private message
xfsunolesphp
Regular
Regular


Joined: Aug 23, 2003
Posts: 77

PostPosted: Mon Jan 03, 2005 7:00 pm Reply with quote Back to top

look my results is 1295.6 kbps
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Mon Jan 03, 2005 7:04 pm Reply with quote Back to top

well thats great but it doesnt give any answers to why i doesnt work for me.
i just tried his popup....
the images DONT show but i see at the statusbar that im downloading the file.
and when its done it stays black,and when i right click i get.....

kbps=1048.6

but no images.....
View user's profile Send private message
xfsunolesphp
Regular
Regular


Joined: Aug 23, 2003
Posts: 77

PostPosted: Mon Jan 03, 2005 7:09 pm Reply with quote Back to top

hitwalker wrote:
well thats great but it doesnt give any answers to why i doesnt work for me.
i just tried his popup....
the images DONT show but i see at the statusbar that im downloading the file.
and when its done it stays black,and when i right click i get.....

kbps=1048.6

but no images.....


have you check path of those image?
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum