$subject = $header_info->subject; if (handle_to_address($to) == $subscribe_email && in_array(handle_subject($subject), $subscription_lists)) { $subscription = subscribe($from, $subject); if ($subscription) { eZMail::extractEmail($from, $email, $name); $cli->output("Subscription created: " . $subscription->attribute('subscriptionlist_id') . "/" . $email); sendConfirmation($email, $subscription, true); } else { $handled = false; } } elseif (handle_to_address($to) == $unsubscribe_email && in_array(handle_subject($subject), $subscription_lists)) { $subscription = unsubscribe($from, $subject); if ($subscription) { eZMail::extractEmail($from, $email, $name); $cli->output("Subscription removed: " . $subscription->attribute('subscriptionlist_id') . "/" . $email); sendConfirmation($email, $subscription, false); } else { $handled = false; } } else { //echo "Not a un/subscribe email: ".$to. " \"".$subject."\""."\n"; $handled = false; } if ($handled) { $cli->output('Email (' . $i . ') removed from mailbox'); imap_delete($mailbox, $i); } } } } function get_list_ids()
<?php include '../../login/dbc.php'; session_start(); require 'PHPMailer-master/PHPMailerAutoload.php'; function checkEmail($str) { return preg_match("/^([a-zA-Z0-9]+[a-zA-Z0-9._%-]*@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,4})\$/", $str); } switch ($_GET['action']) { case 'sendInvite': sendInvite(); break; case 'sendConfirmation': sendConfirmation(); break; } function sendInvite() { /* global $hostname,$username,$password,$database; foreach($_POST as $key => $value) { //$data[$key] = filter($value); $data[$key] = mysqli_real_escape_string($obj_db, $value); } $obj_db = mysqli_connect($hostname, $username, $password, $database); if($obj_db === FALSE) {
function handleRequest($msg, $divide) { //function receives request plus divide between song and artist $song; $artist; //retrieve song and artist given divide! if ($divide == "play") { $substr = substr($msg, 0, 5); if (strpos($substr, " play") !== false) { $request = explode(" play", $msg); } else { if (strpos($substr, "play ") !== false) { $request = explode("play ", $msg); } else { if (strpos($substr, "play") !== false) { $request = explode("play", $msg); } } } if (strpos($request[1], " by ") !== false) { $temp = explode(" by ", $request[1]); $song = $temp[0]; $artist = $temp[1]; } else { if (strpos($request[1], "-") !== false) { $temp = explode("-", $request[1]); $song = $temp[0]; $artist = $temp[1]; } else { if (strpos($request[1], "artist") !== false) { $temp = explode("artist", $request[1]); $song = $temp[0]; $artist = $temp[1]; } else { $song = $request[1]; } } } } else { if ($divide == " by ") { $temp = explode(" by ", $msg); $song = $temp[0]; $artist = $temp[1]; } else { if ($divide == "-") { $temp = explode("-", $msg); $song = $temp[0]; $artist = $temp[1]; } } } $song_parse = explode(" ", $song); $artist_parse = explode(" ", $artist); $song; $artist; for ($i = 0; $i < count($song_parse); $i++) { //make sure we don't have double white space (could mess up query of APIs) $new = rtrim(ltrim($song_parse[$i])); if ($i == 0) { $song = $new; } else { $song .= " " . $new; } } for ($i = 0; $i < count($artist_parse); $i++) { $new = rtrim(ltrim($artist_parse[$i])); if ($i == 0) { $artist = $new; } else { $artist .= " " . $new; } } $result = request($song, $artist); //get request given parsed song and artist if ($result == null) { handleMsg("Could not find your song. We have sent a message to the DJ."); //no result found =/, fail with a message } else { if (count($result) == 1) { sendConfirmation($result[0]["song"], $result[0]["artist"]); print_r($result); } else { //we SHOULD handle these cases differently - but do we want to? We should do something to determine tie breaks, perhaps when we have more data... //we don't want to text them back asking to pick one from the options simply cause of cost... sendConfirmation($result[0]["song"], $result[0]["artist"]); print_r($result); } } }
$sql = "INSERT INTO `users` (`Username`, `Password`, `Active`) VALUES (:uname, :upass, 0)"; $query = $dbconn->prepare($sql); $query->bindParam(':uname', $uname); $query->bindParam(':upass', $upass); $result = $query->execute(); if ($result) { $userid = $dbconn->LastInsertId(); echo $userid; $sql = "INSERT INTO `user-details` (`UserId`, `Email`, `UniId`, `CampusId`) VALUES (:id, :email, :uni, :camp)"; $query = $dbconn->prepare($sql); $query->bindParam(':email', $email); $query->bindParam(':id', $userid); $query->bindParam(':uni', $uni); $query->bindParam(':camp', $camp); $result = $query->execute(); $sentEmail = sendConfirmation($userid, $email, $dbconn); echo "here"; if ($result && $sentEmail) { $dbconn->commit(); setNotice("A confirmation email has been sent! Please verify to complete registration."); echo "true"; header('location: ../index.php'); } else { $dbconn->rollback(); } } } catch (PDOException $e) { $dbconn->rollback(); handleError($e); } } else {