Well I changed it because it's not a post since its not coming from a form
is this closer?

<?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 (isset($_POST['UserName'])) {$UserName = $_POST['UserName'];} else
{$UserName = '';}
if (isset($_POST['Password'])) {$Password = $_POST['Password'];} else
{$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);
    $AdminId = $_SESSION['AdminID'];

   if(isset($_SESSION['AdminID']))
    $_SESSION['AdminID'] = $_SESSION['AdminID'];
else
    $_SESSION['AdminID'] = $AdminID;

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

        header ('Location: Main.php');
        exit;
    } else {

On Fri, Jan 30, 2009 at 4:20 PM, Terion Miller <webdev.ter...@gmail.com>wrote:

> Think I'm setting this in the wrong place...someone help ...where do I set
> the AdminID session
>
> if (isset($_POST['UserName'])) {$UserName = $_POST['UserName'];} else
> {$UserName = '';}
> if (isset($_POST['Password'])) {$Password = $_POST['Password'];} else
> {$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 (isset($_POST['AdminID'])) {$AdminID = $_POST['AdminID'];} else
> {$AdminID= '';}
>
>     If (mysql_num_rows($result) > 0) {
>         $_SESSION['AdminLogin'] = true;
>         $_SESSION['user']=$UserName;
>         $_SESSION['AdminID']=$AdminID;
>
>         header ('Location: Main.php');
>         exit;
>     } else {
>

Reply via email to