Validate a link to check a user login are not

In a website by clicking a link, if the user login in that website ,the page redirects to another page otherwise it redirects to login page how can we validate that page .can u give any solution for that.


you can done this with session. more detail about session : LINK

  if(isset($_SESSION['login'])) {  
    header ("Location:dashboard.php");
    header ("Location: login.php");

in this check if session is set then a user is login then redirect it to dashboard.php or if session is not set then it redirect to login.php page.

in login page set the session $_SESSION['login'] with 1 or 0 value. or also you can store a username .

In a website a user login is most of the time defined as a PHP-session. The answer for your question is to check if the session exists on the pages that need a login. If the session doesn't exist the user gets redirected to the login page


   header('location: login.php');
   //Do nothing because the user is logged in.

Need Your Help

Save cookie using jQuery

jquery cookies frontend

I'm trying to make some sort of switch. A radio button that when switched toggles a class on certain divs. At least thet's the idea. I can do this with jQuery easily but my problem is making it stay

Django: Link a field of one model to a field of another

python django database models

I'm working through the Tango with Django book and have decided to add some of my own functionality but have an issue.