Log In

over the last week or so I have been working on the Log in page, while working on it I ran into multiple problems but after long analysis and help from Kyle we finally got it working.

prntscrn

One of the first problems we found was that instead of including session.php I was starting a new session at the start of each page, which meant that instead of continuing the session as you browsed through the page it would start a new one meaning you wouldn’t be able to stay logged in as you clicked between different pages.

secondly, the line

$query = “SELECT * FROM user WHERE user_username='{$username}’ AND user_password='{$password}’ LIMIT 1”;

was originally,

$query = “SELECT * FROM user WHERE username='{$username}’ AND password='{$password}’ LIMIT 1”;

this was the simplest mistake I made and it too me so long to sort it because I kept over looking it  thinking the problem was more complex.

I had the same problem with;

$_SESSION[“user”] = $user[“user_username”];/*password start a session*/
$_SESSION[“user_id”] = $user[“user_id”];/*that uses the username an id*/
$_SESSION[“message”] = “Successfully logged in. Welcome back {$user[“user_username”]}.”;

where, again, the name of the database column that I entered was wrong.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: