Jump to content

Sessions Dieing after function


Asheeown

Recommended Posts

This is the function i'm currently using:

[code]
<?php
function Login($Variables,$FormValues) {
if($FormValues[Name] || $FormValues[Password]) {
echo "Logged in";
$_SESSION['Name'] = $FormValues[Name];
$_SESSION['LoggedIn'] = "1";
$_SESSION['UserGroup'] = "2";
echo $_SESSION['LoggedIn'];
} else {
echo "
<form id=\"form1\" name=\"form1\" method=\"post\" action=\"$PHP_SELF?Area=Login\">
<p>Your Name </p>
<p><label><input name=\"FormValues[Name]\" type=\"text\" id=\"Name\" /></label></p>
<p>Password</p>
<p><label><input name=\"FormValues[Password]\" type=\"password\" id=\"Password\" /></label></p>
<p><label><input type=\"submit\" name=\"Submit\" value=\"Submit\" /></label></p>
</form>
";
} // End of if($FormValues)
} // End of Function Login($Variables,$FormValues);
?>[/code]

Now...this is just a test before I add in calling to the database to actually verify the user...but their is one problem when you log in or enter your info into the form and post it, it reloads the page correctly and says Logged In[b]1[/b] now the 1 proves that the session LoggedIn registered but when I hit home I have one thing that tells me if i'm logged in or not and i'm not and all the sessions are cleared...any idea why?
Link to comment
https://forums.phpfreaks.com/topic/35266-sessions-dieing-after-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.