Re: Re: More questions about SESSION use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Show the code where your session vars are written and I would prefer using
> isset() instead of empty() if you want to check if this var is set or not.
>
> -eddy
>
Hi All, here is the index page where users login and the sessions are set:

<?php
//start session
session_start();
//db connection include
include("inc/dbconn_open.php") ;
//errors on
error_reporting(E_ALL);
ini_set('display_errors', '1');

if (!empty($_POST['UserName']) && !empty($_POST['Password'])) {
   $UserName = $_POST['UserName'];
   $Password = $_POST['Password'];
}
$msg = '';

if (!empty($UserName)) {

    $sql = "SELECT `AdminID`,`UserName` FROM `admin` WHERE
`UserName`='$UserName' and    `Password`='$Password'";
    $result = mysql_query ($sql);
    $row = mysql_fetch_object ($result);

 If (mysql_num_rows($result) > 0) {
       $_SESSION['AdminLogin'] = true;
       $_SESSION['user'] = $UserName;
       $_SESSION['AdminID'] = $row->AdminID;


        header ('Location: Main.php');
        exit;


    } else {
        $msg = "Sorry You Entered  An Invalid Login<br>Please Try
Again<br>Click to Contact <a href='mailto:blah@xxxxxxxxxxxx'><b>blah
blah</b></a> If You Need Help";
    }
}
 //include ("VariableReveal2.php");
?>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux