Location: PHPKode > projects > CoreAsset > coreasset/manage_admin.php
<?php
require_once("lib/inc.php");
require_once("lib/security.php");
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$title	  ="::: Adminstration :::";
$smarty->assign('title',$title);
$mes      = "";
$num      = "";
$status   = $_SESSION['status'];
$user_id  = $_SESSION['user_id'];
$smarty->assign('user_id',$user_id);
$row      = $database->get_from_database("select * from asset_users where user_id='$user_id'");
$name     = $row['full_name'];
$rw		  = $database->get_from_database("select * from asset_users where user_id='$_SESSION[user_id]'");
$last_login  = $rw['last_login'];
$last_logout = $rw['last_logout'];
$smarty->assign('last_login',$last_login);
$smarty->assign('last_logout',$last_logout);

// Date & Time to be dispalyed on the header 
$date_time	= date("h:i:s A")." ".date("d-m-Y");
$smarty->assign('date_time',$date_time);
// Done
if($status=="1")
{
    $num = $database->no_of_rows("select * from asset_users where user_id!='$user_id'");

    if(isset($_GET['hd83___2y8dh328f____8hhdiw___jd9']))
    {
      $userid = $_GET['hd83___2y8dh328f____8hhdiw___jd9'];
      if($database->delet("delete from asset_users where user_id='$userid'"))
      {
       redirect ("manage_admin.php","Delete");
      }
      else
      {
       echo mysql_error();
      }
    }


    if(isset($_GET['act']))
    {
     if($_GET['act']=="Add")
     {
      $mes = "User Successfully Created !";
     }
     if($_GET['act']=="Edit")
     {
      $mes = "User Successfully Updated !";
     }
     if($_GET['act']=="Delete")
     {
      $mes = "User Successfully Deleted !";
     }
     if($_GET['act']=="Exist")
     {
      $mes = "User already exists ! Please choose another User ID ...";
     }
    }


    if($num > 0)
    {
      $res          = $database->Execute("select * from asset_users where user_id!='$user_id'");
      while($row1   = mysql_fetch_array($res))
      {
       $userid[]    = $row1['user_id'];
       $user_name[] = $row1['full_name'];
       $email[]     = $row1['email'];
       $priv[]      = $row1['status'];
      }
    $smarty->assign('user_id',$userid);
    $smarty->assign('user_name',$user_name);
    $smarty->assign('email',$email);
    $smarty->assign('priv',$priv);
    }
$smarty->assign('num',$num);
$smarty->assign('mes',$mes);
}
else
{
 $num = "invalid";
 $smarty->assign('num',$num);
}

$smarty->assign('name',$name);
$smarty->assign('status',$status);
$smarty->display('manage_admin.tpl');
?>
Return current item: CoreAsset