/
var
/
www
/
html
/
stengineers
/
admin
/
api
/
Upload FileeE
HOME
<?php header('Access-Control-Allow-Origin: *'); require_once 'dbconnection.php'; error_reporting(E_ALL); $action = $_POST['action']; $ref = $_POST['referer']; if ($ref == 'ezioaws') { function validateData($data) { $resultData = htmlspecialchars(stripslashes(trim($data))); return $resultData; } //Code for Adding blog if ($action == 'addbrand') { if (function_exists('date_default_timezone_set')) { date_default_timezone_set("Asia/Kolkata"); } $brandname = $_POST['brandname']; $brandlogo = $_POST['brandlogo']; $status = $_POST['status']; $s = "select * from brand"; $res = mysqli_query($con, $s); $sql = "INSERT INTO brand (brandname,brandlogo,status) VALUES ('$brandname','$brandlogo','$status')"; // echo $sql; // exit; $msg = mysqli_query($con, $sql); if ($msg) { $json['status'] = 'success'; $json['message'] = "Added Successfully"; } else { $json['status'] = 'failed'; $json['message'] = "Failed to Add logo"; } echo json_encode($json); } // Code for blog update if ($action == 'updatelogo') { if (function_exists('date_default_timezone_set')) { date_default_timezone_set("Asia/Kolkata"); } $brandname = $_POST['brandname']; $brandlogo = $_POST['thumb_img']; $status = $_POST['status']; $id = $_POST['id']; $sql = "UPDATE brand SET brandname='$brandname', brandlogo='$brandlogo', status='$status' WHERE id='$id'"; // echo $sql; // exit; $msg = mysqli_query($con, $sql); if ($msg) { $json['status'] = 'success'; $json['message'] = "Updated Successfully"; } else { $json['status'] = 'failed'; $json['message'] = "Failed to Update"; } echo json_encode($json); } //Code for blog delete if ($action == 'deletebrand') { $id = $_POST['id']; $sql = "DELETE FROM brand WHERE id='$id'"; $msg = mysqli_query($con, $sql); if ($msg) { $json['status'] = 'success'; $json['message'] = "Deleted Successfully"; } else { $json['status'] = 'failed'; $json['message'] = "Failed to Delete"; } echo json_encode($json); } if ($action == 'selectlogoforwebsite') { $s = "select * from brand where status='active'"; $res = mysqli_query($con, $s); $num = mysqli_num_rows($res); if ($num == 0) { $json['status'] = 'failed'; $json['message'] = "No Blog Added"; echo json_encode($json); } else { $carr = array(); $sql = "select * from brand where status='active' ORDER BY id DESC"; $selected = mysqli_query($con, $sql); while ($row = mysqli_fetch_assoc($selected)) { $carr[] = $row; } $tvals = json_encode($carr); print_r($tvals); } } if ($action == 'selectlogo_for_home') { $s = "select * from brand WHERE status='active'"; $res = mysqli_query($con, $s); $num = mysqli_num_rows($res); if ($num == 0) { $json['status'] = 'failed'; $json['message'] = "No Blog Added"; echo json_encode($json); } else { $carr = array(); $sql = "SELECT * FROM brand WHERE status='active' ORDER BY id DESC LIMIT 8"; $selected = mysqli_query($con, $sql); while ($row = mysqli_fetch_assoc($selected)) { $carr[] = $row; } $tvals = json_encode($carr); print_r($tvals); } } } else { $json['status'] = 'failed'; $json['message'] = "Access Denied"; echo json_encode($json); }