Kaizokupuffball
Kaizokupuffball

Reputation: 2833

PHP: Sessions check user

I'm trying to make a small web society. I already got the user registration and log in scripts.

When i log in, i check if the user is logged in with this:

if ($_SESSION['username'])
{
}
else die();

Now, my problem is that after it has checked if the user is logged in, it stops executing the rest of the php on my file. I can't see my included footer at the bottom for example.

I also got this problem with getting the profile picture to show, i have set a default picture in the database that is a path (path_to_image.png).

If you want a full look of the code, check this.

Upvotes: 0

Views: 127

Answers (1)

Naftali
Naftali

Reputation: 146302

Use {...}! (Lines 73-75 in your code)

else {
        echo '<div class="box_square"><div class="form_error">Du må være logget inn for å se denne siden!<br><br>Logg inn <a href="">her</a>.</div></div>';
        die ();
}

Upvotes: 5

Related Questions