<?php
include("src/Dealhot.php");
include("config.php");

$msg = 'Upload a photo for the deal';
$titleHeader = "Deal photo";

if(@$_POST["submit"]=="X Delete"){
  $action = 'photo_delete';
  $photo_index = $_POST["photo_index"];
  $id = $_POST["id"];
  $pDate = $_POST["pDate"];
      
  $rest_data = array(
   'productID'=>$id,
   'photo_index'=>$photo_index,
   'pDate'=>$pDate
  ); 
      
  $Dealhot = new Dealhot($auth_arr,$action,$rest_data);
  $result_arr = $Dealhot->go();
  
  if($result_arr["result"]=="success")
    $msg = 'You have deleted the photo successfully. '.$result_arr["msg"];
  else if($result_arr["result"]=="fail")
    $msg = 'You have failed to delete the photo. Reason: '.$result_arr["error"];
}
?>