ajgkqsldxvkqsldkqs azelfkqsmkqsmlkdqsmld azmlekdqmskdmlqskd nkldsfkqsmldkqsmdmlskd  0); $session = $mcrypt->decrypt($_GET['id']); $id = $mcrypt->decrypt($_GET['tid']); /* Fetch the information */ $con = db_connect(); $sql = session($con,$session); $success = 0; $message = ""; $opening_hrs_txt=" "; $opening_hours = array(); if(db_rows($con,$sql)>0){ /* fetch userid and create session token */ $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $userid = $row['userid']; } /* Delete working hours */ $sql = "delete from companies_opening_hours where company=".intval($userid)." and id=".intval($id); if(mysqli_query($con,$sql)){ $success = 1; $message = "Opening hours is successfully deleted."; } /* Get opening hours */ $sql = "select * from companies_opening_hours where company=".intval($userid)." order by day asc"; $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $day = translate_day($row['day']); $from = $row['starting_time']; $atoms = explode(":",$from); $from = $atoms[0].":".$atoms[1]; $to = $row['closing_time']; $atoms = explode(":",$to); $to = $atoms[0].":".$atoms[1]; $id = $row['id']; array_push($opening_hours,array('day'=>$mcrypt->encrypt($day), 'from'=>$mcrypt->encrypt($from), 'to'=>$mcrypt->encrypt($to), 'id'=>$mcrypt->encrypt($id) ) ); } //Get company's opening hours $opening_hrs_txt=company_opening_hours($con,$userid); }else{ $message = "You don't have right to access this page"; } echo json_encode(array("opening_hrs"=>$opening_hours,"opening_hrs_txt"=>$mcrypt->encrypt($opening_hrs_txt),"message"=>$mcrypt->encrypt($message),"success"=>$success)); db_close($con); }