As part of my attempt to create an ASP.net that has the same look and feel as an existing php application from another developer. (more about it can you read here: http://stackoverflow.com/questions/2544389/how-to-share-sessions-between-php-and-asp-net-application) I'm in the middle of the process of sharing userlogin state between my ASP.net and PHP application.
I have links like signin.aspx?foo=asdhhjkasd (ASP.net) and signin.php?foo=asdhhjkasd which tell the other application which user credentials should be used for authenticating a user.
Right now I'm stuck with PHPs session management: The existing php application consists of a index.php which includes several (some out of 100) other php files and performs its function. There is a sessionmanagement (session_start() involved et cetera.
What I want to do, is to call a page call signin.php with some parameters. Based on whether the used logged into the php application before or not, I simply want to redirect to the index.php, but I can't get a hold of the session variables.
How must my signin.php look like, to access the session variables used in the index.php. This is what I tried so far:
<?php
// session_start(); tried it with or without it
if($_SESSION['user_id'] != "")
{
header('Location:index.php');
}
else
{
echo "no redirect";
}
?>
I always get "no redirect" printed.
Or is my thinking wrong and it is not possible to access the session variables from another page in php when there is no post/get action involved?
Maybe I should say that my PHP abilities are a bit limited.