include "includes/header.php"; ?> // Sub rutiner // Legg til / rediger unit if ($_REQUEST[sub_action]=="edit_unit"){ //Sjekk etter duplikater if ($_REQUEST[sub_unit]=="add"){ $sql_query = "SELECT * FROM units WHERE serial ='".$_REQUEST[serial]."'"; } else if ($_REQUEST[sub_unit]=="change"){ $sql_query = "SELECT * FROM units WHERE serial ='".$_REQUEST[serial]."' AND id != '".$_REQUEST[unit_id]."'"; } $sql_check = mysql_query("$sql_query"); $sql_checknum = mysql_num_rows($sql_check); if ($sql_checknum!="0"){$error_check=1;ErrorPopUp("Duplicate serial number","Invalid data");} // Endre / Legg til unit om alt ok if ($error_check!="1"){ list($reg_day, $reg_month, $reg_year) = split('[/.-]', $_REQUEST[register]); list($exp_day, $exp_month, $exp_year) = split('[/.-]', $_REQUEST[expire]); $register_date = mktime(0, 0, 0, $reg_month, $reg_day, $reg_year); $expire_date = mktime(0, 0, 0, $exp_month, $exp_day, $exp_year); if ($_REQUEST[sub_unit]=="add"){ $sql_query = "INSERT INTO `units` ( `cust_id` , `type` , `hostname` , `name` , `description` , `serial` , `registered` , `expires` , `notify` ) VALUES ('".$_REQUEST[customer]."', '".$_REQUEST[type]."', '".$_REQUEST[hostname]."', '".$_REQUEST[name]."', '".$_REQUEST[description]."', '".$_REQUEST[serial]."', '".$register_date."', '".$expire_date."', '".$_REQUEST[notify]."');"; } else if ($_REQUEST[sub_unit]=="change"){ $sql_query = "UPDATE `units` SET `type` = '".$_REQUEST[type]."', `hostname`= '".$_REQUEST[hostname]."' , `name` = '".$_REQUEST[name]."' , `description` = '".$_REQUEST[description]."', `serial` = '".$_REQUEST[serial]."' , `registered` = '".$register_date."' , `expires` = '".$expire_date."' , `notify` = '".$_REQUEST[notify]."' WHERE id = '".$_REQUEST[unit_id]."';"; } mysql_query("$sql_query"); } } // Slett unit if ($_REQUEST[action]=="delete"){ mysql_query("DELETE FROM `certificates` WHERE unit_id = ".$_REQUEST[unit_id].""); mysql_query("DELETE FROM `certificates_files` WHERE unit_id = ".$_REQUEST[unit_id].""); mysql_query("DELETE FROM `units_files` WHERE unit_id = ".$_REQUEST[unit_id].""); mysql_query("DELETE FROM `units` WHERE id = ".$_REQUEST[unit_id].""); //ErrorPopUp("Added unit","Invalid data"); } ?> Licenses and units
if ($_REQUEST[customer]!=""){ $sql_cust = mysql_query("SELECT * FROM customers WHERE id ='".$_REQUEST[customer]."'"); $sql_cust_row = mysql_fetch_object($sql_cust); echo '|
Customer data: '.$sql_cust_row->name.' '.$sql_cust_row->address.' '.$sql_cust_row->zipcode.' '.$sql_cust_row->location.' Phone: '.$sql_cust_row->telephone.' '.$sql_cust_row->email.' Customer units:
Add unit:
|
|||||||||||||||||||||||||||||||||||