File manager - Edit - /home/custbahd/irungikitchen.com/admin/clients/add/index.php
Back
<?php session_start(); include_once('../../db/saucerer.php'); //IP Address Protocol $ip_address = $_SERVER["REMOTE_ADDR"]; // Check if the "mobile" word exists in User-Agent $isMob = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "mobile")); // Check if the "tablet" word exists in User-Agent $isTab = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "tablet")); // Platform check $isWin = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "windows")); $isAndroid = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "android")); $isIPhone = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "iphone")); $isIPad = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "ipad")); $isIOS = $isIPhone || $isIPad; if($isTab){ if ($isIPad) { $device = 'iPad'; } else { $device = 'Tablet'; } } elseif($isMob){ if ($isIPhone) { $device = 'iPhone'; } else { $device = 'Phone'; } } else{ $device = 'Desktop'; } if($isIOS){ $system = 'iOS'; }elseif($isAndroid){ $system = 'ANDROID'; }elseif($isWin){ $system = 'WINDOWS'; } if(isset($_POST['submit'])){ $client_id = $_POST['client_id']; $fname = $_POST['fname']; $lname = $_POST['lname']; $email = $_POST['email']; $address = $_POST['address']; $location = $_POST['location']; $dob = $_POST['dob']; $gender = $_POST['gender']; $author = $_POST['author']; $handler = $_POST['handler']; $token = $_POST['token']; $access = $_POST['access']; $name = "".$fname." ".$lname.""; $user = $_SESSION['name']; $page = $_POST['page']; $a=" "; $b=""; $phone_space = str_replace($a, $b, $_POST['phone']); $x="+256"; $y="0"; $phone = str_replace($x, $y, $phone_space); $a1=" "; $b1=""; $phone1_space = str_replace($a1, $b1, $_POST['phone1']); $x1="+256"; $y1="0"; $phone1 = str_replace($x1, $y1, $phone1_space); $sql = "SELECT * FROM clients WHERE phone = '$phone' OR phone = '$phone1'"; $query = $conn->query($sql); if($query->num_rows > 0){ //return the inputted fields if ($page=="client") { $_SESSION['success'] = ''.$fname.' '.$lname.' exists'; $action = "Placing Order | Tried Saving Existing"; } else { $_SESSION['error'] = ''.$fname.' '.$lname.' exists, <a class="text-white text-underline text-italic" href="clients/manager/?client='.$client_id.'">View Details</a>'; $action = "Tried Saving Existing"; } } else { $sql = "INSERT INTO clients (client_id, fname, lname, phone, phone1, email, address, location, dob, gender, handler, author) VALUES ('$client_id','$fname','$lname','$phone','$phone1','$email','$address','$location','$dob','$gender','$handler','$author')"; //use for MySQLi OOP if($conn->query($sql)){ if ($page=="client") { $_SESSION['success'] = ''.$fname.' '.$lname.' successfully saved</a>'; $action = "Placing Order | Add"; } else { $_SESSION['success'] = ''.$fname.' '.$lname.' added successfully, <a class="text-white text-underline text-italic" href="clients/manager/?client='.$client_id.'">View Details</a>'; $action = "Add"; } $result = "Success"; $summary = "".$name." has been saved"; $channel = "Notifications"; } else{ $_SESSION['error'] = 'Something went wrong while adding the client'; $result = "Error"; $summary = "Error adding ".$name.", if persists contact support"; $channel = "System"; $action = "Add"; } } $attempt = "Admin"; $filter = "Admin"; $category = "Add"; $link = "clients/manager/?client=$client_id"; $sql = "INSERT INTO secure (name, token, access, attempt, action, user, handler, result, filter, category, channel, summary, link, ip_address, device_name, system_name) VALUES ('$name', '$token', '$access', '$attempt', '$action', '$user', 'Admin', '$result', '$filter', '$category', '$channel', '$summary', '$link', '$ip_address', '$device', '$system')"; mysqli_query($mysqli, $sql); if ($page=="client") { header('location: ../../orders/order/?client='.$client_id.''); } else { header('location: '.$page.''); } } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 3.4 |
proxy
|
phpinfo
|
Settings