There's always more than one way to skin a cat.
Not sure how the PHP works, but you could use JavaScript to determine the
user's screen res, and then redirect the user to a page based upon it. This
has the advantage of being all client-side, ie: less load time. It'd
probably look something like this (inserted into the <head> of a page):
<script language="JavaScript"><!--
function redirectPage() {
var url = "http://foobar/index.php?res="
var 640x480 = url + "640480";
var 800x600 = url + "800600";
var 1024x768 = url + "1024768";
var 1152x864 = url + "1152864";
var 1280x1024 = url + "12801024";
if ((screen.width == 640) && (screen.height == 480));
window.location.href = 640x480;
if ((screen.width == 800) && (screen.height == 600));
window.location.href = 800x600;
if ((screen.width == 1024) && (screen.height == 768));
window.location.href = 1024x768;
if ((screen.width == 1152) && (screen.height == 864));
window.location.href = 1152x864;
if ((screen.width == 1280) && (screen.height == 1024));
window.location.href = 1280x1024;
if ((screen.width == 1600) && (screen.height == 1200));
window.location.href = 1600x1200;
}
redirectPage();
// -->
</script>
That _should_ work, anyway, long time since I've used it in a page. :)
Cheers,
Matt
----- Original Message -----
From: "Derek "Anti-Gremlin" Spranger" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 14, 2001 6:09 PM
Subject: [SLUG] php question
Howdy guys...
im not an expert when it comes to php.. you could say im a newbie =)
but this is what im trying to do...
i have a php file called index.php
the url someone may visit could be index.php?res=12801024
now what i want to do is grab the information in res
and with that open a certain file and display the file to the browser..
here is what i have atm...
<?php
$wfn = "main.$res.txt";
$wbs = @fopen ($wfn, "r");
if (!$wbs) { echo ("Unable to locate file requested. [Error Line:
4]<br>\n"); return; }
$wct = fread ($wbs, filesize ($wfn));
echo ($wct + "\n");
fclose ($wbs);
?>
all it seems to be outputting is '0' (if i tweak the .txt it sometimes
outputs '1')
example of the main.12801024.txt is:
<html>
<head>
<title>test</title>
</head>
<body></body>
BLAH!
</html>
if anyone out there can help me thanks heaps.
-----------------------------------------
Derek "Anti-Gremlin" Spranger
Managing Director, Hexidecimal © 2000, 2001
http://www.hexidecimal.com.au/
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug