Jump to content

[SOLVED] Login with session


azisnomarsa

Recommended Posts

<?php
session_start();
if ($_POST['vards'] == 'janis' && $_POST['PWND'] == 'parole' ) {

$_SESSION['auth'] = true;
header("Location: index.php");
}

    else{
   $_SESSION['auth'] = false;
   header("Location: login.php");
   }
?>

 

 

 

Well I made very simple login script. IMO if username and password is enterd right, I should be able to access the index.php, but if wrong I should be thrown back at login page. Problem is that even if I enter correct username and pwd I still get redirected back to the login page but not to index. It really beats me out.

Link to comment
https://forums.phpfreaks.com/topic/57434-solved-login-with-session/
Share on other sites

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.