简体   繁体   English

PHP:会话检查用户

[英]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. 现在,我的问题是,在检查用户是否登录后,它停止在我的文件上执行其余的php。 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). 我也遇到了显示个人资料图片的问题,我在数据库中设置了默认图片,该图片是路径(path_to_image.png)。

If you want a full look of the code, check this . 如果您想全面了解代码,请检查

Use {...} ! 使用{...} (Lines 73-75 in your code) (您的代码中的第73-75行)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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