PHP login script using session and session variables
P粉726133917
P粉726133917 2023-08-21 19:01:51
0
2
275
<p>I've just finished a complete login and registration system in PHP, but my problem is that I haven't used any sessions yet. I'm new to PHP and have never used sessions before. What I want to do is that after the user registers and fills out the login form, he still stays on the same page. So one part of the page will be if the session is logged in and the other part will be otherwise (the user is not logged in so the login form is shown). Can someone tell me how to get started? </p>
P粉726133917
P粉726133917

reply all(2)
P粉573809727

This is the simplest session code written in PHP. We used 3 files.

login.php

 window.open("home.php","_self");';            // 登录成功后重定向到home.php

        }

        else
        {
            echo "无效的用户名或密码";        
        }
}
 ?>



 登录页面   


用户名
密码

home.php




  
        主页 
  
退出 "; ?>

logout.php

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!