简体   繁体   中英

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 .

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 ();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM