Hello,
I'm new to sessions and I know a little php, but don't use it enough to remember it. I'm trying to use sessions for a couple of reasons. I will explain as i go along.

My index.html is this (www.loveobjects.com) <-not porn my host uses version 4.0.6

<html>
<head>
<script language="javascript">
<!--
var cWidth=0, cHeight=0; fsize=12;
function clientSize() {
if( typeof( window.innerWidth ) == 'number' ) { //Non-IE
cWidth = window.innerWidth;
cHeight = window.innerHeight;
}
else {
if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode'
cWidth = document.documentElement.clientWidth;
cHeight = document.documentElement.clientHeight;
}
else {
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible
cWidth = document.body.clientWidth;
cHeight = document.body.clientHeight;
}
}
}
location.replace('http://www.loveobjects.com/test_1.php?w='+cWidth+'&h='+cHeight+'&fSize='+fsize);
}
-->
</script>
</head>
<body bgcolor="#006666"; onload="javascript:clientSize();"></body>
</html>

You can see that it gets the client window size and sets a default font size, then redirects, sending along the vars in the url string.


The test_1.php looks like this.

<?php
session_start();
header("Cache-control: private");
$HTTP_SESSION_VARS['width'] = $HTTP_GET_VARS['w'];
$HTTP_SESSION_VARS['height'] = $HTTP_GET_VARS['h'];
$HTTP_SESSION_VARS['fontS'] = $HTTP_GET_VARS['fSize'];
$HTTP_SESSION_VARS['fontC'] = $HTTP_GET_VARS['cFont'];
$HTTP_SESSION_VARS['id'] = session_id();
header("Location: http://www.loveobjects.com/test_2.php?id=".$HTTP_SESSION_VARS['id']);
?>

But, this gives me a 404.
I've tried to use a link instead of the header() such as:

print("<a href=\"/test_2.php?id=".$HTTP_SESSION_VARS['id'].">this</a>");

Which will create <a href="./test_2.php?id=b5c93c1f165018cda39d0d751d27d368>this</a> and show in the status bar as http://www.loveobjects.com/test_2.php?id=b5c93c1f165018cda39d0d751d27d368
but this gives me a 404 too. (The _ is there in test_2.php. in the above line. You just don't see it with the whole link underlined).

I don't want to pass along the client and font vars by means of the GET vars to test_2.php. I want them in the session vars. I want to be able to change the font size, or let the user change the font size. And I don't want a font size var hanging around in the url string. I also want to limit what info and be bookmarked. I also don't want to rely on cookies to send the session id and other stuff.

test_2.php looks like this:

<?php
session_start();
header("Cache-control: private");
require($_SERVER["DOCUMENT_ROOT"] . "Pagemaker.class");
$pagemaker = new Pagemaker;
$pagemaker->set_fontsize($HTTP_SESSION_VARS['fontC'],$HTTP_SESSION_VARS['FontC']);
$pagemaker->set_stdwidth($HTTP_SESSION_VARS['width']);
$pagemaker->set_stdheight($HTTP_SESSION_VARS['height']);
$pagemaker->find("test_1");
//print($pagemaker->Errno);
print($pagemaker->Error);
print($pagemaker->haltmsg);
print($pagemaker->contents);
?>

Pagemaker.class worked before I started wwith all this session stuff. (with different code ofcourse)

Please help. Any suggestions will be helpful.
Thanks
Noel




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to