function lookUp($loc, $mask, $pdo, $SENDER_URL, $APP_INFO) { $user = getUser($mask, $pdo); $list = getMatchList($mask, $pdo); if (getUser($mask, $pdo)["friendMask"] != 'nill') { sendReply("Your friend has left the conversation.", getFMask($mask, $pdo), $SENDER_URL, $APP_INFO); sendReply(exitCoversation($mask, $pdo), $mask, $SENDER_URL, $APP_INFO); } $found = FALSE; foreach ($list as $listUser) { if (distance($listUser["lat"], $listUser["longi"], $user["lat"], $user["longi"], "K") <= 10) { updateFriend($mask, $listUser["mask"], $pdo); updateFriend($listUser["mask"], $mask, $pdo); $user = $listUser["username"]; $found = TRUE; break; } } if ($found) { return "You have been matched up with {$user}.\n Type FSTR M <message> and send it to 77100 to start the conversation."; } else { return "Sorry no match found, please try again later."; } }
<?php require_once 'functions.inc'; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $myEmail = "*****@*****.**"; // Sanitize received values $name = sanitize($name); $email = sanitize($email); $message = sanitize($message); // Validate the form if (validateForm($name, $email, $message)) { // Send the email $success = mail($myEmail, "{$name} ({$email})", $message); if ($success) { sendReply(200, "Email sent"); } else { sendReply(500, "Failed to send email, please try again later"); } } else { // The form validation failed sendReply(400, "Some fields are empty or contain wrong values"); }
require_once DIR_APP . 'projects.php'; $id = RemoveIdeaLike($_POST['ideathread_id'], $_SESSION['uid']); minusInteraction($_POST['ideathread_id']); if (!empty($id)) { $likes = getIdeaLikes($_POST['ideathread_id']); $responce['result'] = 'OK'; $responce['id'] = $id; $responce['likes'] = $likes; } else { $responce['result'] = ''; } echo json_encode($responce); break; case 'reply': require_once DIR_APP . 'users.php'; $res = sendReply($_POST); if ($res) { $responce['result'] = 'OK'; } else { $responce['result'] = ''; } echo json_encode($responce); break; case 'add-comment': require_once DIR_APP . 'projects.php'; require_once DIR_APP . 'users.php'; $id = addComment($_POST['project_id'], $_SESSION['uid'], $_POST['text']); if (!empty($id)) { $responce['result'] = 'OK'; $responce['id'] = $id; $project_title = getProjectTitle($_POST['project_id']);