Jump to content

Need help with Syntax setting session...


CodeMama

Recommended Posts

Help I can't get the AdminID session to set and pick up the AdminID from the db :(

 

<?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);
   
   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');

Link to comment
https://forums.phpfreaks.com/topic/143188-need-help-with-syntax-setting-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.