JezK
Edit File: confirmAppointment.php
<?php include('mainHeader.php'); $scheduleby=''; if(!isset($_POST['action']) ) { //print_r($_POST);exit; if(isset($_REQUEST['scheduleby']) && $_REQUEST['scheduleby']!='') { $scheduleby="&scheduleby=".$_REQUEST['scheduleby']; } if(!isset($_REQUEST['businessid']) || $_REQUEST['businessid']<=0) { echo "<script>alert('Invalid details');window.location='bookAppointment.php?pid=".$_REQUEST['pid']."".$scheduleby."'</script>"; } $userDet=$users->getUsers('id',$_SESSION['id']); if(count($userDet)<=0) { echo "<script>alert('Invalid details');window.location='index.php'</script>"; } $existedBookslots=$users->checkUserAlreadyBookedSlots($userDet['0']['id'],$_REQUEST['businessid'],$_REQUEST); if($existedBookslots) { /*if(isset($_REQUEST['rescheduleId']) && $_REQUEST['rescheduleId']!='') { $scheduleby="&scheduleby=".$_REQUEST['rescheduleId']; }*/ echo "<script>alert('You are already booked the slots on this date and time');window.location='bookAppointment.php?pid=".$users->encrypt_decrypt('encrypt',$_REQUEST['businessid'])."".$scheduleby."'</script>"; } $getava=$users->getBusiness('id',$_REQUEST['businessid']); $countryId = isset($getava[0]['country']) ? (int)$getava[0]['country'] : 0; $countryName = $users->getCountry($countryId); $getPrice=$users->getBusinessPrice($_REQUEST['businessid']); $businesspic='img/dummybusinesspic.png'; if($getava['0']['business_pic']!='' && file_exists('uploads/'.$getava['0']['business_pic'])) { $businesspic='uploads/'.$getava['0']['business_pic']; } $totalPrice=$getPrice['call_cost'] * count($_REQUEST['slotbooking']); /*$getCountryPaymentGateway = $users ->getCountryPaymentGateway($countryName[0]['name']); if($getCountryPaymentGateway['payment_gateway'] == 'Paypal') { $actionpage='paypal/paypal.php'; }else if($getCountryPaymentGateway['payment_gateway'] == 'Instamojo'){ $actionpage='instamojo/pay-instamojo.php'; }*/ $getCountryPaymentGateway = $users->getPractManCountry(); // if($getCountryPaymentGateway['country_name'] == 'United States') // { // $actionpage='paypal/paypal.php'; // }else{ $actionpage='instamojo/pay-instamojo.php'; // } // $addbooking=$users->addBooking($_POST,$bookingDet['transaction_id'],$bookingDet['amount'],$bookingDet['fee_amount'],$bookingDet['net_amount'],$_POST['currency']); //echo "<script>alert('Payment Successfully Completed');window.location='appointment.php'</script>"; // $bookingDet = array(); // $bookingDet['transaction_id']= generateRandomString(); // $bookingDet['amount']= '200'; // $bookingDet['fee_amount'] = 0; // $bookingDet['net_amount']= 0; // $_POST['currency'] = 0; // $addbooking=$users->addBooking($_POST,'TEST1234','400','1.08','18.27',''); // echo "<script>alert('Payment Successfully Completed');window.location='appointment.php'</script>"; $fieldOfReschedule=''; if($scheduleby!='') { $actionpage=""; $fieldOfReschedule="<input type='hidden' name='action' value='reschedule'>"; } } else if(isset($_POST['action']) && $_POST['action']=='reschedule') { $bookingDet=$users->getUserTransactionDet('',$_POST['rescheduleId']); $usersDet=$users->getUsers('id',$bookingDet['user_id']); $_POST['cbusinessid']=$_POST['businessid']; $_POST['cslotbooking_date']=$_POST['slotbooking_date']; $_POST['cslotbooking']=$_POST['slotbooking']; $_POST['cclientname']=$_POST['clientName']; $_POST['cemail']=$_POST['email']; $_POST['cmobile']="+".$usersDet[0]['country_code'].$_POST['mobileNo']; $addbooking=$users->addBooking($_POST,$bookingDet['transaction_id'],$bookingDet['amount'],$bookingDet['fee_amount'],$bookingDet['net_amount'],$_POST['currency']); if($addbooking){ echo "<script>alert('Your slot booking is successfully completed');window.location='appointment.php'</script>"; }else{ echo "<script>alert('Slot booking was failed');window.location='appointment.php?slotid=3'</script>"; } } ?> <section class="mt-5 pt-4 loginUser-margin"> <div class="container-fluid bg-white text-dark border"> <div class="row py-4"> <div class="col-12 col-xl-8 col-sm-6 col-md-8 border-right"> <div class="row"> <div class="col-12 col-xl-12 col-sm-6 col-md-8 d-flex justify-content-end"> <a href="bookAppointment.php?pid=<?php echo $users->encrypt_decrypt('encrypt',$_REQUEST['businessid']).$scheduleby;?>" ><button class="btn btn-primary">Change Date & Time</button></a> </div> </div> <div class="row px-3"> <p><img src="img/calenderdark.png"> on <?php echo date('d M, Y',strtotime($_REQUEST['slotbooking_date']));?></p> </div> <div class="row px-3"> <p class="d-flex"><span><img src="img/timings.png"></span> <span><?php echo implode(',',$_REQUEST['slotbooking'])?></span></p> </div> <hr class="new2"> <div class="row"> <div class="col-xl-2"> <img width="90px" height="90px" src="<?php echo $businesspic;?>"> </div> <div class="col-xl-10 videoConf"> <p class="mb-1 text-dark"><?php echo (isset($getava['0']['business_name']) && $getava['0']['business_name']!='')?$getava['0']['business_name']:$getava['0']['professional_name'];?></p> <p class="mb-1"><img src="img/location.png"><?php echo (isset($getava['0']['location']) && $getava['0']['location'])?$getava['0']['location']:'';?></p> <?php $countries=$users->getCountriesById($getava['0']['country']); $states=$users->getStatesById($getava['0']['state']); $cities=$users->getCitiesById($getava['0']['city']); ?> <p class="mb-1"><?php echo $cities[$getava['0']['city']].",".$states[$getava['0']['state']].",".$countries[$getava['0']['country']];?></p> </div> </div> <hr class="new2"> </div> <div class="col-12 col-xl-4 col-sm-6 col-md-4"> <div class=""> <form action="<?php echo $actionpage;?>" method="POST" > <h6>Confirm Appointment</h6> <div class="form-group"> <label for="clientName" class="fieldName">Client Name</label> <input type="text" class="form-control formField-control" name="clientName" id="clientName" value="<?php echo $userDet['0']['fullname'];?>"> </div> <div class="form-group"> <label for="email" class="fieldName">Email</label> <input type="text" class="form-control formField-control" name="email" id="email" value="<?php echo $userDet['0']['email'];?>"> </div> <div class="form-group"> <label for="mobileNo" class="fieldName">Mobile</label> <input type="text" class="form-control formField-control" name="mobileNo" id="mobileNo" value="<?php echo $userDet['0']['mobile'];?>"> <input type="hidden" name="country_code" value="<?php echo $userDet['0']['country_code'];?>"> <span class="text-warning error-msg">You will receive an with SMS with verification code on this number</span> </div> <?php if($scheduleby==''){ ?> <div class="form-group pt-2 pb-2"> <label></label> <!-- <img src="img/amount.png"><span> <?php echo $totalPrice;?></span> --> <img src="img/amount.png"><span> <?php echo $countryName[0]['name']=="India"?"Rs.":($countryName[0]['name']=="United States"?"$":"");?> <?php echo $totalPrice;?></span> </div> <?php } ?> <input type="hidden" name="amount" value="<?php echo $totalPrice;?>"> <input type="hidden" name="currency" value="<?php echo $countryName[0]['name']=="India"?"INR":($countryName[0]['name']=="United States"?"USD":"USD");?>"> <!-- <input type="hidden" name="currency" value="USD">--> <input type="hidden" name="slotbooking_date" value="<?php echo $_REQUEST['slotbooking_date'];?>"> <input type="hidden" name="businessid" value="<?php echo $_REQUEST['businessid'];?>"> <input type="hidden" name="slotbooking" value="<?php echo implode(',',$_REQUEST['slotbooking'])?>"> <input type="hidden" name="amount" value="<?php echo $totalPrice;?>"> <input type="hidden" name="rescheduleId" value="<?php echo $_REQUEST['rescheduleId'];?>"> <input type="hidden" name="reqPid" value="<?php echo $_REQUEST['pid'];?>"> <?php echo $fieldOfReschedule;?> <div class="form-group mb-5"> <button class="btn basic-btn-color w-100" onclick="return ProceedToPay();"><?php echo $scheduleby!=''?'Submit':'Proceed to Pay';?></button> </div> </form> </div> </div> </div> </div> </section> <?php include('mainFooter.php')?> <script type="text/javascript"> function ProceedToPay() { var phoneno = /^\d{5,15}$/; var email=$('#email').val(); var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if($('#clientName').val()=='') { alert("Please enter Client Name");return false; } if(email=='') { alert("Please enter Email");return false; } else if (reg.test(email) == false) { alert("Please enter valid Email");return false; } if($('#mobileNo').val()=='') { alert("Please enter Mobile");return false; } else if(!$('#mobileNo').val().match(phoneno)) { alert("Please enter valid Mobile");return false; } } </script>