Location: PHPKode > projects > CoreAsset > coreasset/edit_user.php
<?php
require_once("lib/inc.php");
require_once("lib/security.php");

$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$title	  ="::: Edit User :::";
$smarty->assign('title',$title);
// 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
$date     = date("Y-m-d");
$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);

if($status=="1")
{
  if(isset($_GET['hd83___2y8dh328f____8hhdiw___jd9']))
  {
   $userid               = $_GET['hd83___2y8dh328f____8hhdiw___jd9'];
   $row                  = $database->get_from_database("select * from asset_users where user_id='$userid'");
   $login                = $row['login'];
   $password             = base64_decode($row['password']);
   $full_name            = $row['full_name'];
   $email                = $row['email'];
   $stus                 = $row['status'];
   $comments             = $row['comments'];
   
   $smarty->assign('userid',$userid);
   $smarty->assign('login',$login);
   $smarty->assign('password',$password);
   $smarty->assign('full_name',$full_name);
   $smarty->assign('email',$email);
   $smarty->assign('stus',$stus);
   $smarty->assign('comments',$comments);
  }

  if(isset($_GET['act']))
  {
   if($_GET['act']=="edit")
   {
    $userid               = $_POST['user_id'];
    $login                = $_POST['login'];
    $password             = base64_encode($_POST['password']);
    $full_name            = $_POST['full_name'];
    $email                = $_POST['email'];
    $status1              = $_POST['status'];
    $comments             = $_POST['comments'];

    if($database->update("update asset_users set login='$login', password='$password', full_name='$full_name', email='$email', status='$status1', comments='$comments', updated_by='$user_id', updated_on='$date' where user_id='$userid'"))
    {
     redirect ("manage_admin.php","Edit");
    }
   }
  }
}
else
{
 $mes = "Sorry ! You have no such Privillage ...";
 $smarty->assign('mes',$mes);
}
$smarty->assign('name',$name);
$smarty->assign('status',$status);

$smarty->display('edit_user.tpl');
?>
Return current item: CoreAsset