<?php include('../../config/setup.php');?>
<?php
    if($_GET['deltest']==700)
    {
        $delete_id = $_GET['deltestid'];
        $check_img_query = "SELECT * FROM testimonial WHERE id ='$delete_id'";
        $img_res = mysqli_query($config, $check_img_query);
        $res_data = mysqli_fetch_array($img_res);
        $image = $res_data['images'];

        $sql = "DELETE FROM testimonial WHERE id ='$delete_id' ";
        if($config->query($sql) === TRUE){
            if(file_exists('../../../photos/testimonials/'.$image)){
                unlink('../../../photos/testimonials/'.$image);
            }
            header("Location:../testimonial.php");
        }else  {
            echo "<script>window.location.href='../testimonial.php?err=101';</script>";	 
        }
    }

    if($_GET['apptest']==800)
    {
        $appid = $_GET['appid'];

        $sql = "UPDATE testimonial SET status = '1' WHERE id ='$appid' ";
        if($config->query($sql) === TRUE){
            header("Location:../testimonial.php");
        }else  {
            echo "<script>window.location.href='../testimonial.php?err=101';</script>";	 
        }
    }

?>
