ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/pod_multi_delete.php |
<?php require_once('header.php'); $pod_ids=array(); $pod_ids=$_POST['pod_ids']; foreach($pod_ids as $pod_id) { if(!isset($pod_id)) { header('location: logout.php'); exit; } else { // Check the id is valid or not $statement = $pdo->prepare("SELECT * FROM tbl_pod WHERE id=? "); $statement->execute(array($pod_id)); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach($result as $row) { $img1=$row['url_1']; $img2=$row['url_2']; $img3=$row['url_3']; $img4=$row['url_4']; $img5=$row['url_5']; } $total = $statement->rowCount(); if( $total == 0 ) { header('location: logout.php'); exit; } } // Unlink the photo if($img1!='') { unlink('img/POD/'.$img1); } if($img2!='') {unlink('img/POD/'.$img2);} if($img3!='') {unlink('img/POD/'.$img3);} if($img4!='') {unlink('img/POD/'.$img4);} if($img5!='') {unlink('img/POD/'.$img5);} // Delete from Pincode $statement = $pdo->prepare("DELETE FROM tbl_pod WHERE id=?"); $resp=$statement->execute(array($pod_id)); } if($resp) { $response=1; } else { $response=0; } $datas[] = array('status'=>$response); echo json_encode($datas); ?>