[PAYH] $_SESSION not working now
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- [PAYH] $_SESSION not working now
[PAYH] $_SESSION not working now
11-12-2008 3:48 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Why is this not working on the PAYH platform?
I know it will have something to do with php version 5+
here is a bit of code that is working on the ccgi platform (php v4) but not on PAYH (php v5)
This bit is on my login page
if($name == $row['logon_name'] and $pwd == $row['pwd'])
{
session_start();
$_SESSION['username'] = $row['user_name'];
$_SESSION['password'] = $pwd;
$_SESSION['jobtitle'] = $row['job_title'];
$_SESSION['userisvalid'] = True;
header("Refresh: 0; url=admin/protected/index.php");
exit();
}else{
$badnameorpwd = "<p class='redalert'>Login credentials are not valid!";
$action = "fail";
}
This bit is on the receiving page
<?php
session_start();
if(!$_SESSION['userisvalid'])
{
header("Refresh: 0; url=../../login.php");
exit();
}
?>
Re: [PAYH] $_SESSION not working now
11-12-2008 6:23 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Gabe
Re: [PAYH] $_SESSION not working now
11-12-2008 7:10 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Does it attempt the redirect at all to admin/protected/index.php at all?
Re: [PAYH] $_SESSION not working now
12-12-2008 1:05 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
<?php
session_start();
if(!$_SESSION['userisvalid'])
{
header("Refresh: 0; url=../../login.php");
exit();
}
?>
It seems to be reading the value of $_SESSION['userisvalid'] as not true so it redirects you back to the login page.
This bit of code is the first few lines of all pages in my admin area.
Re: [PAYH] $_SESSION not working now
12-12-2008 2:09 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: [PAYH] $_SESSION not working now
12-12-2008 9:10 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Gabe
Re: [PAYH] $_SESSION not working now
12-12-2008 9:52 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Peter: The session_id is different on each page
Gabe: I'm not using any cookies
The code is identical for my live site on th PN ccgi platform and my trial site on the PAYH platform?
Re: [PAYH] $_SESSION not working now
12-12-2008 10:01 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Gabe
Re: [PAYH] $_SESSION not working now
12-12-2008 10:11 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Tried that and makes no difference.
Something must be different about php 4 and 5 thats causing this I'm sure but I dont know what.
My php v4 works perfectly well using the code i posted

Bri
Re: [PAYH] $_SESSION not working now
12-12-2008 10:18 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
none of the $_SESSION variables are being passed
I've demonstrated it with simple
echo "Session ID = ".session_id();
echo "User = ".$_SESSION['username'];
echo "Job = ".$_SESSION['jobdesc'];
echo "Nickname = ".$_SESSION['nickname'];
etc etc etc
Re: [PAYH] $_SESSION not working now
12-12-2008 10:23 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Gabe
Re: [PAYH] $_SESSION not working now
12-12-2008 10:33 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I haven't done anything with session cookies before.
When i first put a copy of my live site on the PAYH platform, i had to do loads of re-writing because v5 is so different. ie. In php v4.2, if you link to a page with something like ../leaguetables.php?divid=3 then the $divid variable is automatically created but in version 5 you have to do $divid=$_GET['divid']; or $_POST['divid']; if it comes from a textbox on a form etc
Is something different in v5 about the $_SESSION variables?
Re: [PAYH] $_SESSION not working now
12-12-2008 10:44 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Gabe
Re: [PAYH] $_SESSION not working now
12-12-2008 11:11 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I'm totally stumped

Why does it work on the PN ccgi platform???????
Re: [PAYH] $_SESSION not working now
12-12-2008 11:28 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
On the new site, you could try testing the page without the redirect. When the page is served without the redirect, do you see the session id in the uri, or a PHPSESSID cookie?
Gabe
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- [PAYH] $_SESSION not working now