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

$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$title	  ="::: Manage Vendor :::";
$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
$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);

if($status < 5)
{
    $num = $database->no_of_rows("select * from asset_vendor");

    if(isset($_GET['hd83___2y8dh328f____8hhdiw___jd9']))
    {
      if($status < 4)
      {
          $vendor_id = $_GET['hd83___2y8dh328f____8hhdiw___jd9'];
          if($database->delet("delete from asset_vendor where vendor_id='$vendor_id'"))
          {
           redirect ("manage_vendor.php","Delete");
          }
          else
          {
           echo mysql_error();
          }
       }
     else
     {
       $num = "invalid";
       $smarty->assign('num',$num);
     }
    }


    if(isset($_GET['act']))
    {
     if($_GET['act']=="Add")
     {
      $mes = "Vendor is Successfully Created !";
     }
     if($_GET['act']=="Edit")
     {
      $mes = "Vendor is Successfully Updated !";
     }
     if($_GET['act']=="Delete")
     {
      $mes = "Vendor is Successfully Deleted !";
     }
     if($_GET['act']=="Exist")
     {
      $mes = "Vendor Name already exists ...";
     }
    }


    if($num > 0)
    {
      $res          = $database->Execute("select * from asset_vendor");
      while($row1   = mysql_fetch_array($res))
      {
       $vendor_id[]                               = $row1['vendor_id'];
       $vendor_name[]                             = $row1['vendor_name'];
       $vendor_adress[]                           = $row1['vendor_address'];
       $vendor_email[]                            = $row1['vendor_email'];
       $vendor_phone[]                            = $row1['vendor_phone'];
       $vendor_zip[]                              = $row1['vendor_zip'];
       $vendor_country[]                          = $row1['vendor_country'];
       $vendor_state[]                            = $row1['vendor_state'];
       $vendor_description[]                      = $row1['vendor_description'];
      }
    $smarty->assign('vendor_id',$vendor_id);
    $smarty->assign('vendor_name',$vendor_name);
    $smarty->assign('vendor_adress',$vendor_adress);
    $smarty->assign('vendor_email',$vendor_email);
    $smarty->assign('vendor_phone',$vendor_phone);
    $smarty->assign('vendor_zip',$vendor_zip);
    $smarty->assign('vendor_country',$vendor_country);
    $smarty->assign('vendor_name',$vendor_name);
    $smarty->assign('vendor_state',$vendor_state);
    $smarty->assign('vendor_description',$vendor_description);
    }
$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_vendor.tpl');
?>
Return current item: CoreAsset