File manager - Edit - /home/autoph/public_html/projects/Rating-AutoHub/public/css/affiliation.zip
Back
PK ]]�Z��ӡl l reload_affiliation.phpnu �[��� <?php include_once("../../cfg/db.php"); $type = $_POST['type']; if($type == 1){ $query = "SELECT `id`, `name` FROM `customer_affiliations_category` WHERE id != 0 ORDER BY name ASC"; $affiliations = $db -> return_result($query); //echo $query; return; foreach($affiliations as $data){ echo "<option value='{$data['id']}'>".$data['name']."</option>"; } } else if($type == 2){ if(isset($_POST['affiliation_id'])){ $affiliation_id = $_POST['affiliation_id']; $query = " SELECT cac.id, cac.name, concat(e.first_name, ' ', e.last_name) AS creator, DATE_FORMAT(cac.date_added, '%M %d, %Y / %h:%i:%s %p') AS date_added, cac.status FROM `customer_affiliations_category` cac INNER JOIN employee e ON e.id = cac.added_by WHERE cac.id != 0 AND cac.id = '$affiliation_id'"; //echo $query; return; $affiliation_details = $db -> return_result($query); foreach($affiliation_details AS $data){ $arr['name'] = $data['name']; $arr['date_added'] = $data['date_added']; $arr['creator'] = $data['creator']; $arr['status'] = (intval($data['status']) <> 0) ? true : false ; } echo json_encode($arr); } } else if($type == 3){ $search_item = $db->escape(trim($_POST['search_item'])); $search_query = "SELECT id, name FROM customer_affiliations_category WHERE (name LIKE '%$search_item%') AND id != 0 ORDER BY name ASC"; //echo $search_query; return; $result = $db->sql_query($search_query); //echo $search_query; return; while($row = $result->fetch_assoc()) { echo '<option value="'.$row['id'].'">'.$row["name"].'</option>'; } } ?>PK ]]�Z��� � add_affiliation.phpnu �[��� <?php include_once("../../cfg/db.php"); $new_affiliation = $db->escape(trim(strtoupper($_POST['new_affiliation']))); $current_user = $_SESSION['user']['id']; if(intval($db -> select("SELECT count(1) FROM customer_affiliations_category WHERE name = '$new_affiliation'")) > 0){ $return_arr['status'] = 0; //duplicate affiliation name $return_arr['message'] = "Affliation category already existing"; echo json_encode($return_arr); } else { $db->sql_query("INSERT INTO `customer_affiliations_category` (`name`, `added_by`) VALUES('$new_affiliation', '$current_user')"); $return_arr['status'] = 1; echo json_encode($return_arr); } ?>PK ]]�Zy/��Q Q update_affiliation.phpnu �[��� <?php include_once("../../cfg/db.php"); $id = $db->escape(trim($_POST['affiliation_id'])); $status = $db->escape(trim($_POST['status'])); $set_status = 0; if($status == "true"){ $set_status = 1; } $new_affiliation_name = $db->escape(trim(strtoupper($_POST['new_affiliation_name']))); if(intval($db -> select("SELECT count(1) FROM customer_affiliations_category WHERE `name` != '' AND `name` = '$new_affiliation_name' AND id != '$id'")) > 0){ $arr['status'] = 0; //duplicate brand name } else { $update_query = "UPDATE `customer_affiliations_category` SET `name`='$new_affiliation_name', `status`='$set_status' WHERE `id` = '$id'"; //echo $update_query; $db->sql_query($update_query); $arr['status'] = 1; //success update } echo json_encode($arr); ?> PK ]]�Z��ӡl l reload_affiliation.phpnu �[��� PK ]]�Z��� � � add_affiliation.phpnu �[��� PK ]]�Zy/��Q Q � update_affiliation.phpnu �[��� PK � O
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings