Jump to content

Page redirection


Caligo

Recommended Posts

What language would I use if I wanted to find out what someone's connection speed is, if it is above a certain speed then if they have flash enabled and redirect based on the results?so basicallyif (connectionSpeed <= x) then (redirect to xhtml/css version)elseif (connectionSpeed > x) then (check if flash is enabled) if (flash is enabled) then (redirect to flash version)not nicely written, I know, but I figure it will get my point across.

Link to comment
Share on other sites

Maybe javascript? Im sure there some sort of function to check the speed. But who wants to use a flash version? Flash sucks for websites!P.S. Cron, why did you spam that random post?

Link to comment
Share on other sites

Maybe javascript? Im sure there some sort of function to check the speed. But who wants to use a flash version? Flash sucks for websites!P.S. Cron, why did you spam that random post?
I want to use flash....I personally like it, a pain it is to create, but I still like it. Besides, I am just starting to get into web design, going to college for it, and want to know how to do different things. Plus you cant do everything with javascript and stuff...or can you??
Link to comment
Share on other sites

oh, you can. They had this crazy cool maze thing posted on here earlier. They used the javascript canvas tag and it was pretty much like a flash maze but it was reallly slow in high detail. Worked great though!

Link to comment
Share on other sites

oh, you can. They had this crazy cool maze thing posted on here earlier. They used the javascript canvas tag and it was pretty much like a flash maze but it was reallly slow in high detail. Worked great though!
Would you be willing to help me out then?
Link to comment
Share on other sites

JavaScript can do lots of stuff but that doesn't always mean it is better than flash. Had that 3d maze been done in flash it would not have been slow since flash loads everything at the beginning not on the fly like JS.

Link to comment
Share on other sites

Maybe, maybe not lol. I have absolutely no knowledge of the canvas tag, but I can try to help you with redirection.
I have some stuff made up in photoshop to show what I want some stuff to look like if you'd like to take a look at that. I know how to make it do what I want in flash for the most part, but I don't know any javascript. Actually, the menu portion you might be able to help me with.If youd like me to give you links to the pictures and an explaination of what I want done let me know and ill give that stuff to you.
Link to comment
Share on other sites

You can't...javascript (or anything else) cannot detect the users hardware.you might be able to do this with C++ but I have no idea how.
No hense this earlier post. I did some searching and found nothing but hte naswer NO. Getting the connection speed would need to access the network which I don't know if PHP does that. I know with C++ and C# you have Sockets which allow you to access the network and other PC...Theoreticaly I suppose you could open a socket and connect to the user PC and measure how long it takes to get a response or maybe ping there ip and measure the response time but there is no cut and dry function AFAIK
Link to comment
Share on other sites

ok I found and a function to ping a ip and came up with this

<?php$startTime = time();$hostip = "xxx.xxx.xxx.xxx";$result = gethostbyaddr($hostip);$finishTime = time();print ($result); //if prints the ip then ping failed, if prints the hostname it was successful?>

You can use $startTime and $finishTime to do some calcualtions to see how long it took to ping the ip and determine what connection speed. you will have to test the cod eon multiple connections to get a good idea of how long each type of connection takes.HTH

Link to comment
Share on other sites

ok I found and a function to ping a ip and came up with this
<?php$startTime = time();$hostip = "xxx.xxx.xxx.xxx";$result = gethostbyaddr($hostip);$finishTime = time();print ($result); //if prints the ip then ping failed, if prints the hostname it was successful?>

You can use $startTime and $finishTime to do some calcualtions to see how long it took to ping the ip and determine what connection speed. you will have to test the cod eon multiple connections to get a good idea of how long each type of connection takes.HTH

awesome, thanks, ill mess around with next week sometime. Dont have any time right now, kinda just surf the forums as I work :)
Link to comment
Share on other sites

Ping isn't the best measure of connection speed, since it's only one packet and operates on a different port (not that port really matters). The way places like this calculate connection speed is by sending the user noncompressible files of various sizes. They start with small files, and if they get transferred quickly, they use larger and larger files until the wait gets to a certain point.Connection speed is not a static value, and is not known by either the client or the server. A lot of factors influence connection speed, including the time of day they are online. The only way to reliably check what the speed is is to send files to the client and see how long it takes them to download. It's not the easiest thing to do, most of the places use Java applets to accomplish that, and it takes up to around a minute. Not something you want your users to sit through before your site loads, because they won't wait for it.As far as detecting the presence of the Flash player, look into scalable Inman Flash replacement (sIFR). It is a Javascript library that will detect the presence of Flash, and render various headlines and things in an anti-aliased font of your choice, rather than a default client-side font. Because of the overhead, sIFR is only used for small pieces of text, but it has the code in it you need to detect the player. Here's the example page for sIFR, you can enable it or disable it in the column on the left. Refresh after clicking yes or no:http://www.mikeindustries.com/blog/files/sifr/2.0/Do a Google search for sIFR for more information about it.

Link to comment
Share on other sites

HTML with CSS is fast and use PHP for server siding.
That is true but doesn't relate to the question at all.I think the best solution (if it is possible with your design) is to ask the user what there connection is (even just a simple dial-up or high speed question).@justsomeguy...you are probably right but wouldn't the ping time differ enough for you at least to determine dial-up or some form of high speed?
Link to comment
Share on other sites

you are probably right but wouldn't the ping time differ enough for you at least to determine dial-up or some form of high speed?
I don't know, that's a good question. It would be worth setting up a test page. But I suspect that transmission speed for a single packet will not be a good indication of transmission for 1mb, for example.A Google search turned up this page:http://www.emanueleferonato.com/2006/05/31...speed-with-php/He tests with a minimum of 512kb of data (actually, just text, which is compressible and doesn't give a good indication anyway). He claims that anything less than 512kb gives innaccurate results. He's clocking my T1 at 38kb/s. Comment #1 on the page is "it doesn’t reflect true values".You might be able to get away with testing something like 10kb or something like that, but it wouldn't be very precise. It would require some testing to figure out where the threshold between modem and cable is.
Link to comment
Share on other sites

here is a test page http://nsbb.awardspace.com/ping.php with the following code

<?php   $mtime = microtime();   $mtime = explode(" ",$mtime);   $mtime = $mtime[1] + $mtime[0];   $starttime = $mtime;$hostip = "xxx.xxx.xxx.xxx";$result = gethostbyaddr($hostip);$connected = 'FALSE';if($result != $hostip)  $connected = 'TRUE';   $mtime = microtime();   $mtime = explode(" ",$mtime);   $mtime = $mtime[1] + $mtime[0];   $endtime = $mtime;   $totaltime = ($endtime - $starttime);echo "Connected: " . $connected . "<br>";echo "Execution Time: " . $totaltime;?>

I got results ranging from 0.3 - 0.002 seconds. I am on a cable internet connection. Could someone on dial-up or even DSL and ISDN connections test this out and post your results.Hopefully there will be a noticeable different at least between dial-up and other high speed connections.

Link to comment
Share on other sites

I'm not getting it to load at all. That isn't connecting from the client though, it looks like just a server contacting another server. If you sent a request to $_SERVER['REMOTE_ADDR'], it should ping the user.Wait, I'm confused. How does it connect to the user at all?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...