Ive created a log in that essentially if the username and password are found
in the database it displays one section of code and if its not found it
display another log in form

Im able to log in and my verifylogin() function works because if the
username and password are not found it displays the login form again but
when I click a link to another page that uses my admin class it just
displays that second log in form as if the username and password are not
carrying over I know this has something to do with my session_start or
something but I've no idea I'm very new to sessions and cookies:

Here is my page admin page display:

<?
session_start();
session_register($employeeid,$password);
include ('include/adminclass.php');
$adminroot = new adminpage();
$title = "Administration Portal";

$redux = "Hello Some Temporary Content";
$adminroot->SetContent($redux);

$toolsneeded = "admin";
$adminroot->SetToolsNeeded($toolsneeded);
$adminroot->Display($employeeid,$password,$title);
?>


Here are the relevant parts of my class file:


##
##CLASS DECLARATION
##
class ADMINPAGE
{


##
##DISPLAY FUNCTION
##
function Display($employeeid,$password,$title)
 {
 $count = $this -> VerifyLogin($employeeid,$password);
 switch($count)
  {
  case "1":
   $this -> DisplayHeader($title,$employeeid);
   echo "<center><br><table width=\"500\"><tr><td>";
   $this -> DisplayMenu($this->buttons);
   echo "<br>";
   $this -> DisplayContent($this->toolsneeded,$this->content);
   echo "</td></tr></table></center><br>";
   $this -> DisplayFooter();
   break;

  default:
   $title = "Please Try Again";
   $employeeid = "";
   $password = "";
   $this -> DisplayHeader($title,$employeeid,$password);
   echo "<center><br><table width=\"500\"><tr><td valign=\"top\">";
   echo "Your username and password combination is incorrect. Please try
again.";
   $this->DisplayLogInForm();
   echo "</td></tr></table></center><br>";
   $this -> DisplayFooter();
   break;
  }
 }


##
##VERIFY LOGIN FUNCTION
##
function VerifyLogin($employeeid,$password)
 {
 include('dbconnection.php');
 $employeequery = "Select count(*) from employees where employeeid =
'$employeeid' and password='$password'";
 $employeeresult = mysql_query($employeequery);
 if(!$employeeresult)
  {
  echo 'Please Try Again Later.';
  exit();
  }
 $count = mysql_result($employeeresult,0,0);
 if($count>0)
  {
  $count = "1";
  }
  else
   {
   $count = "0";
   }
  return $count;
 }




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to