0byt3m1n1
Path:
/
var
/
www
/
listcrawler.app
/
public_html
/
admin
/
[
Home
]
File: delete_sponsor.php
<?php session_start(); require_once 'includes/auth_validate.php'; require_once './config/config.php'; $del_id = filter_input(INPUT_POST, 'del_id'); if ($del_id && $_SERVER['REQUEST_METHOD'] == 'POST') { if($_SESSION['admin_type']!='super'){ $_SESSION['failure'] = "You don't have permission to perform this action"; header('location: sponsors.php'); exit; } $sponsor_id = $del_id; $db = getDbInstance(); $db->where('id', $sponsor_id); $status = $db->delete('sponsors'); //deleting existing pics $select_pics = array('id', 'photo_name'); $db->where('sponsor_id', $sponsor_id); $rows = $db->arraybuilder()->paginate('sponsor_photos', 1, $select_pics); foreach ($rows as $row): @unlink("../sponsor_pics/" . $row['photo_name']); $db->where('id', $row['id']); $db->delete('sponsor_photos'); endforeach; if ($status) { $_SESSION['info'] = "Ad deleted successfully!"; header('location: sponsors.php'); exit; } else { $_SESSION['failure'] = "Unable to delete Ad"; header('location: sponsors.php'); exit; } }