Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $servername = "**.**.***.***";
- $username = "******";
- $password = "*******";
- $dbname = "**********";
- $conn = new mysql($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $phonenumber= $_POST['phonenumber'];
- $sql = "SELECT COUNT(*) FROM AccountForm WHERE phonenumber= '{$_POST['phonenumber']}'";
- $result = $conn->query($sql);
- if (mysql_result($sql_result, 0)<1)
- {
- die("<BR>Unknown user; account not found");
- }
- else {
- echo "Success!";
- }
- while($row = mysql_fetch_assoc($result)) {
- $phonenumber = $row['phonenumber'];
- }
- $result = mysql_query("SELECT * FROM AccountForm WHERE phonenumber = '$phonenumber' LIMIT 1");
- if(mysql_num_rows($result) > 0){
- $row = mysql_fetch_array($result, MYSQL_ASSOC);
- $firstname = $row["firstname"];
- echo "<BR>Your pizza will be here in 15 minutes, ";
- echo $firstname;
- }else{
- echo 'Unknown user; account not found';
- }
- function pizza2(){
- $response = new Services_Twilio_Twiml();
- $response->sms("Your " . $row["size2"]. " " . $row["topping2"]. " pizza has been ordered, " . $row["firstname"]. " " . $row["lastname"]. ". It will be delivered to " . $row["physicaladdress"]. " " . $row["city"]. " " . $row["state"]. " in 10 minutes");
- echo $response;
- }
- $body = $_REQUEST['Body'];
- $result = preg_replace("/[^A-Za-z0-9]/u", " ", $body);
- $result = trim($result);
- $result = strtolower($result);
- switch ($result) {
- case 'pizza1':
- pizza1();
- break;
- case 'pizza2':
- pizza2();
- break;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement