function get_request_by_id($id) { $db = new adb(); $db->connect(); $result = "SELECT * FROM gnpc_lms.lms_requests\n \t\tINNER JOIN gnpc_employees.ge_users ON (ge_users.u_id=lms_requests.employee_ref)\n \t\tINNER JOIN lms_leave_type ON (lms_leave_type.t_id=lms_requests.leave_type_ref)\n \t\tINNER JOIN lms_request_status ON (lms_request_status.rs_id=lms_requests.request_status_ref)\n \t\tWHERE r_id='{$id}'"; if (!$db->query($result)) { return false; } return $db->fetch(); }
function get_request_by_id($id) { $db = new adb(); $db->connect(); $result = "SELECT he_id, he_device_model, he_serial_no, ghi_hardware_type.ht_id, ghi_hardware_type.hardware_name,\n \t\tdevice_name, supplier_name, repairer_name, he_warranty_exdate, ghi_status.s_id, ghi_status.status, ghi_repairs.r_id, ghi_repairs.repair_status,\n \t\trepair_comments, DATE_FORMAT(start_repair_date, '%d %b %Y') as start_repair_date, DATE_FORMAT(end_repair_date, '%d %b %Y') as end_repair_date, \n \t\tDATE_FORMAT(date_registered, '%d %b %Y') as date_registered, date_of_manufacture, he_user_name,\n \t\tghi_departments.d_id, ghi_departments.dep_name, DATE_FORMAT(start_dispatch_date, '%d %b %Y') as start_dispatch_date, DATE_FORMAT(end_dispatch_date, '%d %b %Y') as end_dispatch_date\n \t\tFROM ghi_hardware_entry\n \t\tINNER JOIN ghi_hardware_type ON (ghi_hardware_type.ht_id=ghi_hardware_entry.he_type)\n \t\tINNER JOIN ghi_status ON (ghi_status.s_id=ghi_hardware_entry.he_status)\n \t\tINNER JOIN ghi_repairs ON (ghi_repairs.r_id=ghi_hardware_entry.he_repair_status)\n \t\tINNER JOIN ghi_departments ON (ghi_departments.d_id=ghi_hardware_entry.he_dep_ref)\n \t\tWHERE he_id='{$id}'"; if (!$db->query($result)) { return false; } return $db->fetch(); }
function authenticateUser() { include "adb.php"; $user_email = $_REQUEST['usermail']; $user_pass = $_REQUEST['userpass']; $obj = new adb(); $sql_users = "select * from users where email='{$user_email}'\n\tand password='******'"; if ($obj->query($sql_users)) { $dataset = $obj->fetch(); if (empty($dataset['email']) or empty($dataset['password'])) { echo '{"result":2}'; } else { echo '{"result":1}'; } } }
function signUp() { $fn = $_REQUEST['fn']; $email = $_REQUEST['email']; $phone = $_REQUEST['phone']; $occupation = $_REQUEST['occupation']; $workplace = $_REQUEST['workplace']; $nationality = $_REQUEST['nationality']; $_SESSION['email'] = $email; $myadb = new adb(); $str_sql = "INSERT INTO attendance (email, fn, phone, occupation, workplace, nationality) values ('{$email}', '{$fn}', '{$phone}', '{$occupation}', '{$workplace}', '{$nationality}')"; if (!$myadb->query($str_sql)) { echo '{"result": 0, "message": "Could not signUp"}'; return; } echo '{"result": 1, "message": "SigUp was successful"}'; return; }
/** * Bring up events data */ function getEvents() { include_once "adb.php"; $eqp = new adb(); $str_query = "select * from inven_products"; if (!$eqp->query($str_query)) { echo '{"result": 0, "message": "No Events in database"}'; return; } $data = array(); $row = $eqp->fetch(); while ($row) { $row_array['id'] = $row['id']; $row_array['owner'] = $row['product_id']; $row_array['name'] = $row['products']; $row_array['des'] = $row['quantity']; $row_array['contact'] = $row['price']; $row = $eqp->fetch(); // //push the values in the array array_push($data, $row_array); } echo json_encode($data); }
$student_major = $_REQUEST['student_major']; $student_phone = $_REQUEST['student_phone']; function generateRandomString($length = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMONPQRSTUVWXYZ'; $charactersLength .= strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $random_pass = generateRandomString(8); echo "PASS: {$random_pass}"; /** PARTS OF THE MESSAGE ***/ $obj = new adb(); // check if ISSET $str = "INSERT INTO `sms_messages` SET `student_id`='{$student_id}',\n `student_name`='{$student_name}', `student_gpa`='{$student_gpa}',\n `student_major`='{$student_major}', `student_phone`='{$student_phone}'"; $result = $obj->query($str); try { // Quick Send approach SMSGH quick send $messageResponse = $messagingApi->sendQuickMessage("CodeWreaker", $student_phone, "{$student_name} This is your login password {$random_pass}"); if ($messageResponse instanceof MessageResponse) { echo "msg1: " . $messageResponse->getStatus() . "</br></br>"; } elseif ($messageResponse instanceof HDpResponse) { echo "\nServer Response Status : " . $messageResponse->getStatus() . "</br></br>"; } echo "</br>success done"; } catch (ExcepWon $ex) { echo $ex->getTraceAsString(); }
<span><input type="submit" name="button" value="Go"></span> </span> </div> <div id="divStatus" class="status"> status message </div> <div id="divContent"> Content space <span class="clickspot">click here </span> <?php include 'adb.php'; $obj = new adb(); $obj->connect(); $select_query = "Select * from task,nurse where task.nurse_id = nurse.nurse_id"; $obj->query($select_query); echo "<table border='1' id='tableExample' class='reportTable' width='100%'>"; echo "<tr style = 'Background-color:#066d5d' class='header'>"; echo "<td>Task id</td>"; echo "<td>Task name</td>"; echo "<td>Due date</td>"; echo "<td>Description</td>"; echo "<td>Nurse</td>"; echo "<td></td>"; echo "<td></td>"; echo "</tr>"; $row = $obj->fetch(); while ($row) { echo "<tr>"; echo "<td width=7% >" . $row['task_id'] . "</td>"; echo "<td>" . $row['task_name'] . "</td>";