Page 2 of 3
Posted: Fri Oct 06, 2006 3:00 pm
by RobertGonzalez
Is javascript turned on for your computer?
Posted: Fri Oct 06, 2006 3:03 pm
by volka
Code: Select all
<?php session_start(); ?>
<html>
<head><title>session test</head>
<body>
<?php echo 'time: ', date('H:i:s'), ' | id:', session_id(); ?>
<br />
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">reload</a>
</body>
</html>
If you click the link to reload the page does only the time change or the id as well?
Posted: Fri Oct 06, 2006 3:07 pm
by Stephen Bungert
Yes, JavaScript is on. I use it all the time.
volka, Your script shows an empty page. Not even the title is in the title path of the browser, just the actuall physical path on the server: '
http://localhost/php_test_2.php'
Posted: Fri Oct 06, 2006 3:10 pm
by Stephen Bungert
Volka, when I was doing test on my own php login system (before starting my thread here) I noticed that every time I refereshed the page I got a new Session ID, if this helps diagnose my problem. Can't get your code to work.
I never thought anything about the changing ID, it was the first time that I'd tried using sessions... I thought it must be supposed to change like that so I never mentioned it before.
Posted: Fri Oct 06, 2006 3:10 pm
by volka
very strange, there are no syntax errors in the script. Please check again.
Does your browser reject all cookies?
Posted: Fri Oct 06, 2006 3:11 pm
by RobertGonzalez
Try this one:
Code: Select all
<?php session_start(); ?>
<html>
<head><title>session test</head>
<body>
<p><?php echo 'time: ' . date('H:i:s'); ?></p>
<p><?php echo 'id:' . session_id(); ?></p>
<p><a href="<?php echo basename($_SERVER['SCRIPT_FILENAME']); ?>">reload</a></p>
</body>
</html>
Posted: Fri Oct 06, 2006 3:13 pm
by Stephen Bungert
Volka, your test works now in Firefox but not IE - I only used IE before. Maybe it has something to do with IE?
In firefox the time stays the same and the id changes when I refresh the browser
Posted: Fri Oct 06, 2006 3:15 pm
by Stephen Bungert
everah, yours doesn't work in IE either, but in firefox it works like volkas. The time stays the same (except for the seconds) and the session ID changes.
Posted: Fri Oct 06, 2006 3:16 pm
by volka
I forgot to close the title tag.
Code: Select all
<?php session_start(); ?>
<html>
<head><title>session test</title></head>
<body>
<?php echo 'time: ', date('H:i:s'), ' | id:', session_id(); ?>
<br />
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">reload</a>
</body>
</html>
If the session_id changes every time then a
new session is started every time, new session->no data.
Does your browser reject all cookies?
Posted: Fri Oct 06, 2006 3:17 pm
by RobertGonzalez
Browsers should have nothing to do with it, but it appears that your server is not setting the session id. I would guess there may be a problem with the session.save_path directive in your php.ini (or your permissions on that folder).
Posted: Fri Oct 06, 2006 3:22 pm
by Stephen Bungert
session.save_path = "C:/Dokumente und Einstellungen/Stephen/Lokale Einstellungen/Temp"
; Whether to use cookies.
session.use_cookies = 1
I found this in the php ini.
there are lots of files in "C:/Dokumente und Einstellungen/Stephen/Lokale Einstellungen/Temp" that start with 'sess' so I guess these must be to do with the php sessions. I've never seen files named like this before.
Posted: Fri Oct 06, 2006 3:27 pm
by volka
Does your browser reject all cookies?
Posted: Fri Oct 06, 2006 3:30 pm
by Stephen Bungert
No, I accept all cookies.
Posted: Fri Oct 06, 2006 3:35 pm
by volka
Code: Select all
<?php session_start(); ?>
<html>
<head><title>session test<title></head>
<body>
<p><?php echo 'time: ', date('H:i:s'); ?></p>
<p><?php echo 'id:', session_id(); ?></p>
<p><?php echo 'name:', session_name(); ?></p>
<p><php echo 'use_cookie: ', ini_get('session.use_cookies'); ?></p>
<p><php echo 'use_only_cookie: ', ini_get('session.use_only_cookies'); ?></p>
<p><php echo 'session.use_trans_sid: ', ini_get('session.use_trans_sid'); ?></p>
<pre><?php print_r($_COOKIE); ?></p>
<div><a href="<?php echo $_SERVER['PHP_SELF']; ?>">reload</a></div>
</body>
</html>
please reload this script several times and then post the last output here.
Posted: Fri Oct 06, 2006 3:37 pm
by Stephen Bungert
In IE I don't see anything, in Firefox I see:
time: 22:36:32
id:qtcgo0k49b7up5vu7kekit63o2
name:PHPSESSID
Array
(
)
reload