Jump to content

[SOLVED] Are log in sessions what i'm looking for?


webmaster1

Recommended Posts

Hi All,

 

I'm building a basic CRM for work where I want users to:

 

  • be directed to a specific page based on their log in details.
  • remain logged in (no timing out of session).
     

 

Should I be using sessions for this or do I use something simpler such as the username and password in a php page?

 

Any reccomended tutorials would be apreciated too (yes, I do know how to google, just wondering if there is any specific tutorial some of you would reccomend  :P).

So you're saying the below code (its functional) would not time out until the browser is closed?

 

<?php
session_start();
    $valid_username = "user";
    $valid_password = "pass";

    $username = isset($_POST['username'])?$_POST['username']:"";
    $password = isset($_POST['password'])?$_POST['password']:"";

    if ($username == $valid_username && $password == $valid_password) {
          $_SESSION['logged'] = true;   
         header("Location: admin.php");
    }else {
             $_SESSION['logged'] = false;
             header("Location: loginfl.php");
    }?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.