Hello,
I have a basic class which verifies the login of a user and for most part it works.
The class I’m working on, basically cleans up the input fields and checks the user id/password against the database and so far this works.
after checking with the database I like to set the user name to a session variable. Here’s where its not working, the script itself is very basic nothing complicated either case I copy/pasted the part im having issues with it below.
if the user is confirmed the page is rerouted to another page which has a the following line of code to confirm the session variable
echo $_SESSION[‘test1’]; //testing
public function userLogin()
{ try
{ //database select statement which i took out for security reason but it was tested several time to make sure it works and it works.
if(empty($DBresults))
{ $this->errorStatus[] = 'user Not found'; // for testing
[B]$_SESSION['test1'] = "Not found"; // for testing[/B]
}
else
{ $this->errorStatus[] = 'found'; // for testing
[B] $_SESSION['test1'] = "found"; // for testing[/B]
}
}
catch(PDOException $e) { echo $e->getMessage(); }
}
the highlighted code should set the session variable based on the resluts but its not…
Can you not set a session variable within a class-> method, is it out of scope???