query($query)) { if(mysqli_num_rows($result) == 0) { $balance=0; $rewarded=0; $query = "INSERT INTO textusers (phone,balance,usersince,lastvisit,rewarded,active) VALUES ('$phone', '$balance', NOW(), NOW(),'$rewarded', '1')"; $link->query($query); $txt = "Pooky's Famous Yogurt: Thank you for signing up for our promotional alerts. Msg & Data rates apply. You can opt out at any time by replying STOP."; sendSMS ($phone,$txt); $txt = "Pooky's: You are now entered in our drawings for Free Froyo. Good luck!"; sendSMS ($phone,$txt); } else sendSMS ($phone,"Already registered. Stop cheating!"); } else echo "Query Failed."; mysqli_close($link); //header('Location: http://www.aribellawebdesign.com/froyo/home.php', true, 301); } function sendText($phone,$txt) { sendSMS ($phone,$txt); } function email_application($info){ $email_message = " New Application

New Application

Name: ".$info['name']."

Address: ".$info['address']."

Email: ".$info['email']."

Phone: ".$info['phone']."

DOB: ".$info['dob']."

Monday: ".$info['monav']."

Tuesday: ".$info['tueav']."

Wednesday: ".$info['wedav']."

Thursday: ".$info['thuav']."

Friday: ".$info['friav']."

Saturday: ".$info['satav']."

Sunday: ".$info['sunav']."

Weekly Hours: ".$info['hours']."

Hourly Rate: $".$info['rate']."

Start Date: ".$info['start']."

Position: ".$info['position']."

Last Job: ".$info['emphist']."

Comments: ".$info['message']."

"; $to = "contact@pookysyogurt.com, opmanager@pookysyogurt.com, manager@pookysyogurt.com"; $subject = 'New Applicant'; $headers = 'From: contact@pookysyogurt.com' . "\r\n" . 'Reply-To: contact@pookysyogurt.com' . "\r\n" . 'Content-type:text/html;charset=UTF-8' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $email_message, $headers); return true; } function getNumOfSubscribers(){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from textusers where active='1'"; if ($result=$link->query($query)) return mysqli_num_rows($result); else return 0; } function deductBucks($gc_num, $balance, $qty){ $newBalance = $balance - $qty; $newBalance = number_format($newBalance,2); $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "UPDATE giftcard SET balance='$newBalance' WHERE id ='$gc_num'"; $link->query($query); $query = "SELECT * from giftcard where id ='$gc_num' AND active ='1'"; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); $email = $row['to_email']; $name = $row['gc_to']; $expire = $row['expire']; } } mysqli_close($link); emailBalance($gc_num,$name,$email,$newBalance,$expire); } function emailBalance($gc_num,$name,$email,$newBalance,$expire){ $link_address = "http://pookysyogurt.com/placeOrder.php"; $email_message = "

".$name.",
Thank you for your visit.

Your Froyo Bucks Info
Gift Card#: ".$gc_num."
Balance: $".$newBalance."
Expires: ".$expire."

Enjoy your Froyo Bucks,
Pooky's Famous Yogurt
12000 US 380 #102
Cross Roads, TX 76227
940-320-2331

Share the love. Click "."here"." to send Froyo Bucks to someone else.

"; $to = $email; $subject = 'Your Froyo Bucks Update'; $headers = 'From: contact@pookysyogurt.com' . "\r\n" . 'Reply-To: contact@pookysyogurt.com' . "\r\n" . 'Content-type:text/html;charset=UTF-8' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $email_message, $headers); } function getBucks($gc_num){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from giftcard where id ='$gc_num' AND active ='1'"; $ret=""; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); $ret = $row['balance']; } else $ret="NO"; } else $ret="NO"; mysqli_close($link); return $ret; } function getRefText($refId){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from referrals where refId ='$refId' AND active ='1'"; $ret=""; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); $ret = $row['org']; } } else echo "Query Failed."; mysqli_close($link); return $ret; } function saveGc(){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $n=count($_SESSION['cart']); $email = $_SESSION['sender_email']; $unique_id = $_SESSION['unique_id']; $refId = $_SESSION['refId']; $date = date('m-d-Y'); $tempDate = date('Y-m-d'); $expire = date('m-d-Y', strtotime($tempDate. ' + 90 days')); $i=0; while ($i<$n){ $pic = $_SESSION['cart'][$i]['pic']; $gc_from = $_SESSION['cart'][$i]['from']; $gc_to = $_SESSION['cart'][$i]['to']; $to_email = $_SESSION['cart'][$i]['rec_email1']; $message = $link->real_escape_string($_SESSION['cart'][$i]['message']); $start_amount = number_format ($_SESSION['cart'][$i]['amount'],2); $balance = $start_amount; $query = "INSERT INTO giftcard (gc_from,from_email,gc_to,to_email,message,start_amount,balance,active,date,expire,unique_id,pic) VALUES ('$gc_from','$email','$gc_to','$to_email','$message','$start_amount','$balance','0','$date','$expire','$unique_id','$pic')"; $link->query($query); $i++; } $amount = $_SESSION['amount']; $query = "INSERT INTO invoice (email,amount,paid,unique_id,refId) VALUES ('$email','$amount','0','$unique_id','$refId')"; $link->query($query); mysqli_close($link); } function saveGcAdmin(){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $n=count($_SESSION['cart']); $unique_id = $_SESSION['unique_id']; $refId = "admin"; $date = date('m-d-Y'); $tempDate = date('Y-m-d'); $expire = date('m-d-Y', strtotime($tempDate. ' + 90 days')); $i=0; while ($i<$n){ $start_amount = number_format ($_SESSION['cart'][$i]['amount'],2); $balance = $start_amount; $to_email = $_SESSION['cart'][$i]['email']; $query = "INSERT INTO giftcard (to_email,start_amount,balance,active,date,expire,unique_id) VALUES ('$to_email','$start_amount','$balance','1','$date','$expire','$unique_id')"; $link->query($query); $i++; } $amount = $_SESSION['amount']; $query = "INSERT INTO invoice (email, amount,paid,unique_id,refId) VALUES ('$to_email','$amount','1','$unique_id','$refId')"; $link->query($query); $query = "SELECT * from giftcard where unique_id ='$unique_id'"; $ret=""; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); $ret = $row; } else $ret="NO"; } else $ret="NO"; mysqli_close($link); email_froyoBucks($unique_id); return $ret; } function saveGcReal(){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $n=count($_SESSION['cart']); $unique_id = $_SESSION['unique_id']; $refId = "instore"; $date = date('m-d-Y'); $tempDate = date('Y-m-d'); $expire = date('m-d-Y', strtotime($tempDate. ' + 90 days')); $i=0; while ($i<$n){ $start_amount = number_format ($_SESSION['cart'][$i]['amount'],2); $balance = $start_amount; $query = "INSERT INTO giftcard (start_amount,balance,active,date,expire,unique_id) VALUES ('$start_amount','$balance','1','$date','$expire','$unique_id')"; $link->query($query); $i++; } $amount = $_SESSION['amount']; $query = "INSERT INTO invoice (amount,paid,unique_id,refId) VALUES ('$amount','1','$unique_id','$refId')"; $link->query($query); $query = "SELECT * from giftcard where unique_id ='$unique_id'"; $ret=""; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); $ret = $row; } else $ret="NO"; } else $ret="NO"; mysqli_close($link); return $ret; } function enableNumber($phone){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); if (strlen($phone) > 10) $phone = substr($phone, 2, 10); $query = "SELECT * from textusers where phone ='$phone'"; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $query = "UPDATE textusers SET active=1 where phone ='$phone'"; $link->query($query); } } else echo "Query Failed."; mysqli_close($link); } function disableNumber($phone){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); if (strlen($phone) > 10) $phone = substr($phone, 2, 10); $query = "SELECT * from textusers where phone ='$phone'"; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $query = "UPDATE textusers SET active=0 where phone ='$phone'"; $link->query($query); } } else echo "Query Failed."; mysqli_close($link); //header('Location: http://www.aribellawebdesign.com/froyo/home.php', true, 301); } function processPhone($phone){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from textusers where phone ='$phone'"; $curr_date=date("Y-m-d"); if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); $lastVisitDate = date('Y-m-d',strtotime($row['lastvisit'])); if ($curr_date > $lastVisitDate) { updatePhone($row); } else { $_SESSION['dontMessage'] = true; } } else { insertPhone($phone); } } else echo "Query Failed."; mysqli_close($link); //header('Location: http://www.aribellawebdesign.com/froyo/home.php', true, 301); } function add_txt ($info){ $company = $info['company']; $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $message = $link->real_escape_string($info['message']); $query = "INSERT INTO txtchron (company,message,active) VALUES ('$company','$message','1')"; if ($link->query($query)) $ret = true; else $ret = false; mysqli_close($link); return $ret; }// end of add_txt function getMessage($company){ $ret=false; $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from txtchron WHERE company ='$company' AND active ='1'"; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); $ret = $row['message']; $query = "UPDATE txtchron SET active='0' WHERE company ='$company'"; $link->query($query); } } else echo "Query Failed."; mysqli_close($link); return $ret; } function send_txts($info){ $message = $info['message']; $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from textusers where active='1'"; if ($result=$link->query($query)) { $people = []; while($row = $result->fetch_assoc()) { //echo $row['phone']; $people[] = array( 'phone' => $row['phone'], ); } //print_r($people); sendSMSs ($people,$message); return true; } else echo "Query Failed."; mysqli_close($link); } function insertPhone ($phone) { $balance=1; $rewarded=0; $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "INSERT INTO textusers (phone,balance,usersince,lastvisit,rewarded,active) VALUES ('$phone', '$balance', NOW(), NOW(),'$rewarded', '1')"; //$query = $link->real_escape_string($query); $link->query($query); mysqli_close($link); $txt = "Pooky's Famous Yogurt: Thank you for signing up for our promotional alerts. Msg & Data rates apply. You can opt out at any time by replying STOP."; sendSMS ($phone,$txt); $txt = "Pooky's Famous Yogurt: Thank you. You now have 1/".REWARDS_GOAL." points. You're one step closer to your reward!"; sendSMS ($phone,$txt); } function updatePhone ($row) { $phone = $row['phone']; $rewarded = $row['rewarded']; $balance = $row['balance'] + 1; $txt = "Pooky's Famous Yogurt: Thank you. You now have ".$balance."/".REWARDS_GOAL." points. You're one step closer to your reward!"; if ($balance >= REWARDS_GOAL) { $rewarded = 1; $balance = 0; $tempDate = date('Y-m-d'); $expire = date('m-d-Y', strtotime($tempDate. ' + 7 days')); $txt = "Pooky's: You have earned your Free Froyo! Provide your cashier with this message at your next visit, to claim it. Expires: ".$expire; } $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "UPDATE textusers SET balance=$balance,rewarded=$rewarded, active=1 where phone ='$phone'"; //$query = $link->real_escape_string($query); $link->query($query); mysqli_close($link); sendSMS ($phone,$txt); } function froyoAddToCart($in){ $i=count($_SESSION['cart']); $_SESSION['cart'][$i]['from']= $in['from']; $_SESSION['cart'][$i]['to']= $in['to']; $_SESSION['cart'][$i]['message']= $in['message']; $_SESSION['cart'][$i]['rec_email1']= $in['rec_email1']; $_SESSION['cart'][$i]['amount']= $in['amount']; $_SESSION['cart'][$i]['pic']= $in['pic']; } function froyoAddToCartAdmin($in){ $i=count($_SESSION['cart']); $_SESSION['cart'][$i]['amount']= $in['amount']; $_SESSION['cart'][$i]['email']= $in['email']; } function froyoAddToCartReal($in){ $i=count($_SESSION['cart']); $_SESSION['cart'][$i]['amount']= $in['amount']; } function addBalance ($phone, $qty) { $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from textusers where phone ='$phone'"; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); } else { mysqli_close($link); return -1; } } else { mysqli_close($link); return -1; } $balance = $row['balance'] + $qty; $rewarded = $row['rewarded']; $txt = "Pooky's Famous Yogurt: Thank you. You now have ".$balance."/".REWARDS_GOAL." points. You're one step closer to your reward!"; if ($balance >= REWARDS_GOAL) { $rewarded = 1; $balance = $balance - REWARDS_GOAL; $txt = "Pooky's Famous Yogurt: Yay! You have earned your Reward! Provide your cashier with this phone number at your next visit, to claim it"; } $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "UPDATE textusers SET balance=$balance,rewarded=$rewarded, active=1 where phone ='$phone'"; //$query = $link->real_escape_string($query); $link->query($query); mysqli_close($link); sendSMS ($phone,$txt); } function getBalance($phone){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from textusers where phone ='$phone' AND active='1'"; if ($result=$link->query($query)) { if(mysqli_num_rows($result) > 0) { $row = $result->fetch_assoc(); return $row; } else return "NO"; } else echo "Query Failed."; mysqli_close($link); } function claimReward ($phone) { $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "UPDATE textusers SET rewarded=0 where phone ='$phone'"; //$query = $link->real_escape_string($query); $link->query($query); mysqli_close($link); $txt = "Pooky's Famous Yogurt: You have claimed your reward. Thank you for your visit."; sendSMS ($phone,$txt); } //error_reporting(E_ALL); //redeemVoucher("promo1"); function sendEmail($info){ $name = $info['name']; $email = $info['email']; $message = "From: ".$name."\nEmail: ".$email."\n\n\n".$info['message']; $subject = "A New Message"; $to = "stojanbacev@yahoo.com"; $headers = ""; $headers .= "From: Dry Clean Delivery 380 \r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\r\n"; if (mail ($to, $subject, $message, $headers)) return true; else return false; } function registerUser ($userInfo){ $first_name = $userInfo['first_name']; $last_name = $userInfo['last_name']; $address = $userInfo['address']; $city = $userInfo['city']; $state = $userInfo['state']; $zip_code = $userInfo['zip_code']; $phone = $userInfo['phone']; $email = $userInfo['email']; $password = $userInfo['pass1']; $phone_active = $userInfo['phone_active']; $pickup_l=$userInfo['pickup_l']; if($phone_active=="on") $phone_active=1; else $phone_active=0; $result = mysql_query("INSERT INTO CUST (f_name,l_name,email,password,phone,phone_active,address,city,state,zip,pickup_l) VALUES ('$first_name','$last_name','$email','$password','$phone','$phone_active','$address','$city','$state','$zip_code','$pickup_l')"); if ($result) { return true; } else { return false; } //else return "DB Write Failed"; // else die('Could not write to database: ' . mysql_error()); } function updateUser ($userInfo){ $cust_id=$_SESSION['user']['CUST_ID']; $first_name = $userInfo['first_name']; $last_name = $userInfo['last_name']; $address = $userInfo['address']; $city = $userInfo['city']; $state = $userInfo['state']; $zip_code = $userInfo['zip_code']; $phone = $userInfo['phone']; $email = $userInfo['email']; $password = $userInfo['pass1']; $phone_active = $userInfo['phone_active']; $pickup_l=$userInfo['pickup_l']; if($phone_active=="on") $phone_active=1; else $phone_active=0; $result = mysql_query("UPDATE CUST SET f_name='$first_name',l_name='$last_name',phone='$phone',phone_active='$phone_active',address='$address',city='$city',state='$state',zip='$zip_code',pickup_l='$pickup_l' WHERE cust_id='$cust_id'"); if ($result) { $_SESSION['user']['logged_in'] = "yes"; return true; } else { return false; } //else return "DB Write Failed"; // else die('Could not write to database: ' . mysql_error()); } function logIn ($userInfo){ $email = $userInfo['email']; $password = $userInfo['password']; $result = mysql_query("SELECT * FROM `CUST` WHERE email='$email' AND password='$password'"); if ($result){ $row=mysql_fetch_assoc($result); if($row){ $_SESSION['user'] = $row; $_SESSION['user']['logged_in'] = "yes"; return true; } else return false; } else return false; } function getUserInfo($email){ $result = mysql_query("SELECT * FROM `CUST` WHERE email='$email'"); if ($result){ $row=mysql_fetch_assoc($result); if($row){ $_SESSION['user'] = $row; $_SESSION['user']['logged_in'] = "yes"; return true; } else return false; } else return false; } function addVoucher($info){ $voucher_code=$info['voucher_code']; $credit_amount=number_format($info['credit_amount'],2); $check_date=$info['check_date']; $cust_specific=$info['cust_specific']; $active=$info['active']; $active_insert = 0; $check_date_insert=0; $cust_specific_insert=0; if($active=="on"){ $active_insert = 1; } if($check_date=="on") { $check_date_insert=1; $valid_from=$info['valid_from']; $valid_to=$info['valid_to']; } if($cust_specific=="on") { $cust_specific_insert=1; $cust_id=$info['cust_id']; } $result = mysql_query("INSERT INTO VOUCHER_DEF (code,credit,check_date,cust_specific,cust_id,valid_from,valid_to,active) VALUES ('$voucher_code','$credit_amount','$check_date_insert','$cust_specific_insert','$cust_id','$valid_from','$valid_to','$active_insert')"); if ($result) { return true; } else { die('Could not write to database: ' . mysql_error()); //return false; } } function redeemVoucher($voucher, $cust_id){ $voucherValid=true; $result = mysql_query("SELECT * FROM `VOUCHER_DEF` WHERE code='$voucher'"); $row=mysql_fetch_assoc($result); $curr_date=date("m/d/Y"); //$curr_date=date("m/d/Y",strtotime("01/01/2017")); $from= date($row['valid_from']); $to= date($row['valid_to']); $balance = $row['credit']; $voucher_id=$row['id']; $cost = 0; $charge_result=0; $result1 = mysql_query("SELECT * FROM `VOUCHER_USED` WHERE code='$voucher' AND cust_id='$cust_id'"); if($row['active'] == 1 && mysql_num_rows($result1)==0) { if(($row['check_date'] == 1) && ($curr_date < $from || $curr_date > $to)) $voucherValid=false; if(($row['cust_specific'] == 1) && ($cust_id != $row['cust_id'])) $voucherValid=false; } else { $voucherValid=false; } if($voucherValid == true){ $status='P'; $result = mysql_query("INSERT INTO VOUCHER_USED (voucher_id,code,cust_id,credit) VALUES ('$voucher_id','$voucher','$cust_id','$balance')"); if ($result) { $result = mysql_query("SELECT * FROM `CUST` WHERE cust_id='$cust_id'"); $row=mysql_fetch_assoc($result); $new_balance = number_format($row['BALANCE'],2) + $balance; $result = mysql_query("UPDATE CUST SET balance='$new_balance' where cust_id='$cust_id'"); if ($result) { $status='C';//complete $result = mysql_query("UPDATE LOADS SET status='$status',pay_num='$charge_result' where cust_id='$cust_id' AND status='P'"); return true; } else { die('Could not write to database: ' . mysql_error()); //return false; } } else { die('Could not write to database: ' . mysql_error()); //return false; } } else return false; } function submit_order($info){ $cust_id=$_SESSION['user']['CUST_ID']; $dry_items=$_SESSION['user']['dry_num']; $wash_items=$_SESSION['user']['wash_num']; $credit_items=$_SESSION['user']['club_num']; $pickup_days=explode(" - ",$_SESSION['user']['pickupDays']); $pickup_day = $pickup_days[0]; $pickup_date = $pickup_days[1]; $delivery_days=explode(" - ",$_SESSION['user']['deliveryDays']); $delivery_day = $delivery_days[0]; $delivery_date = $delivery_days[1]; $special_inst=$_SESSION['user']['order_inst']; $credits_used=$credit_items; $status='S'; $starch=$_SESSION['user']['starch']; if(cardValid()!=="error"){ $result = mysql_query("INSERT INTO ORDERS (cust_id,dry_items,wash_items,credit_items,pickup_day,delivery_day,pickup_date,delivery_date,special_inst,starch,status) VALUES ('$cust_id','$dry_items','$wash_items','$credit_items','$pickup_day','$delivery_day','$pickup_date','$delivery_date','$special_inst','$starch','$status')"); if ($result) { return true; } else { die('Could not write to database: ' . mysql_error()); //return false; } } return false; } function pickupOrder($orderNum){ $result = mysql_query("UPDATE `ORDERS` SET status='P' WHERE order_num='$orderNum'"); if ($result){ return true; } else return false; } function proc_load($info){ $cust_id=$_SESSION['user']['CUST_ID']; $cust_profile = $_SESSION['user']['PAY_PROFILE_ID']; $pay_profile = $_SESSION['user']['PAY_PAYMENT_ID']; $wash_amount = $info['wash_amount']; $balance = number_format($info['load_balance'],2); $load_pay = $info['load_pay']; $cost = number_format($wash_amount,2) + number_format($load_pay,2); if(cardValid()!=="error"){ $charge_result=charge($cust_profile,$pay_profile,$cost); if($charge_result!="error"){ $status='P';//paid $result = mysql_query("INSERT INTO LOADS (cust_id,cost,balance,status) VALUES ('$cust_id','$cost','$balance','$status')"); if ($result) { $result = mysql_query("SELECT * FROM `CUST` WHERE cust_id='$cust_id'"); $row=mysql_fetch_assoc($result); $new_balance = number_format($row['BALANCE'],2) + $balance; $result = mysql_query("UPDATE CUST SET balance='$new_balance' where cust_id='$cust_id'"); if ($result) { $status='C';//complete $result = mysql_query("UPDATE LOADS SET status='$status',pay_num='$charge_result' where cust_id='$cust_id' AND status='P'"); return true; } else { die('Could not write to database: ' . mysql_error()); //return false; } } else { die('Could not write to database: ' . mysql_error()); //return false; } } else return false; } else return false; } function cardValid(){ $cust_profile = $_SESSION['user']['PAY_PROFILE_ID']; $pay_profile = $_SESSION['user']['PAY_PAYMENT_ID']; if($_SESSION['CC_GOOD'] === "yes") return true; if(strlen($cust_profile) > 1 && strlen($pay_profile)>1){ $result = validateCustomerPaymentProfile($cust_profile,$pay_profile); if($result !== "error") return true; else return "error"; } else return "error"; } function charge($cust_profile,$pay_profile,$amount){ $result=chargeCustomerProfile($cust_profile, $pay_profile, $amount); return $result; } function addCard($info){ $email=$_SESSION['user']['EMAIL']; $cust_id=$_SESSION['user']['CUST_ID']; $result=createCustomerProfile($email,$info,$cust_id); if($result != "error") { $cust_profile = $result['cust_profile']; $pay_profile = $result['pay_profile']; $result = mysql_query("UPDATE CUST SET PAY_PROFILE_ID='$cust_profile',PAY_PAYMENT_ID='$pay_profile' WHERE cust_id='$cust_id'"); if ($result) { return true; } else { return false; } } else return false; } function getCardInfo(){ $cust_profile = $_SESSION['user']['PAY_PROFILE_ID']; $pay_profile = $_SESSION['user']['PAY_PAYMENT_ID']; $result = getCustomerPaymentProfile($cust_profile,$pay_profile); if($result != "error") return $result; else header('Location: dryerror.php', true, 301); } function editCard($info){ $cust_profile = $_SESSION['user']['PAY_PROFILE_ID']; $pay_profile = $_SESSION['user']['PAY_PAYMENT_ID']; $result = updateCustomerPaymentProfile($cust_profile,$pay_profile,$info); $_SESSION['error']=$result; //print_r($result);exit; if($result != "error") return true; else return false; } function getOrders($date,$type){ if($type=="Delivery"){ $result = mysql_query("SELECT c.f_name, c.l_name, c.address, c.city, c.state, c.zip, c.phone, c.pickup_l, o.status, o.order_num, o.dry_items, o.wash_items, o.credit_items, c.cust_id FROM `ORDERS` o LEFT JOIN `CUST` c ON c.cust_id = o.cust_id WHERE o.delivery_date='$date'"); } else if ($type=="Pickup"){ $result = mysql_query("SELECT c.f_name, c.l_name, c.address, c.city, c.state, c.zip, c.phone, c.pickup_l, o.status, o.order_num, o.dry_items, o.wash_items, o.credit_items, c.cust_id FROM `ORDERS` o LEFT JOIN `CUST` c ON c.cust_id = o.cust_id WHERE o.pickup_date='$date'"); } if ($result){ return $result; } else die('Could not read from database: ' . mysql_error()); } function findOrder($orderNum){ $result = mysql_query("SELECT c.f_name, c.l_name, c.address, c.city, c.state, c.zip, c.phone, c.pickup_l, o.status, o.order_num, o.dry_items, o.wash_items, o.credit_items, c.cust_id FROM `ORDERS` o LEFT JOIN `CUST` c ON c.cust_id = o.cust_id WHERE o.order_num='$orderNum'"); if ($result){ return $result; } else die('Could not read from database: ' . mysql_error()); } function getOrder($orderNum){ $result = mysql_query("SELECT * FROM `ORDERS` WHERE order_num='$orderNum'"); if ($result){ return mysql_fetch_assoc($result); } else die('Could not read from database: ' . mysql_error()); } function processOrder($orderNum){ } function updateOrder($info){ $dry_items=$info['dry_num']; $wash_items=$info['wash_num']; $credit_items=$info['club_num']; $pickup_day=$info['pickupDays']; $delivery_day=$info['deliveryDays']; $special_inst=$info['order_inst']; $starch=$info['starch']; $order_num=$info['order']; $total=$info['total']; $result = mysql_query("UPDATE `ORDERS` SET dry_items='$dry_items',wash_items='$wash_items',credit_items='$credit_items',pickup_day='$pickup_day',delivery_day='$delivery_day',special_inst='$special_inst',starch='$starch', cost='$total' WHERE order_num='$order_num'"); if ($result) { return true; } else { die('Could not write to database: ' . mysql_error()); //return false; } } function adminlogIn ($userInfo){ $email = $userInfo['email']; $password = $userInfo['password']; $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * FROM `admins` WHERE email='$email' AND password='$password' AND active='1'"; $result=$link->query($query); if (mysqli_num_rows($result) > 0){ $row = $result->fetch_assoc(); if($row){ $_SESSION['user'] = $row; $_SESSION['user']['logged_in'] = "yes"; return true; } else return false; } else return false; } function email_froyoBucks($tran_token){ $link = mysqli_connect("127.0.0.1", "pookys", "@Pookysfamousyogurt2019", "pookys"); $query = "SELECT * from giftcard WHERE unique_id ='$tran_token'"; if ($result=$link->query($query)) { $query = "UPDATE giftcard SET active=1 WHERE unique_id ='$tran_token'"; $link->query($query); while($row = $result->fetch_assoc()) { $gc_num = $row['id']; $from = "Pooky's Famous Yogurt"; $to = "Our Valued Customer"; $to_email = $row['to_email']; $message = "Thank you and please enjoy your sweet Froyo Bucks :)"; $amount = number_format ($row['start_amount'],2); $expire = $row['expire']; $link_address = "http://pookysyogurt.com/placeOrder.php"; $email_message = "

From: ".$from."
To: ".$to."
Message: ".$message."

Your Froyo Bucks Info
e-Card#: ".$gc_num."
Amount: $".$amount."
Expires: ".$expire."

Enjoy your Froyo Bucks,
Pooky's Famous Yogurt
12000 US 380 #102 #393
Cross Roads, TX 76227
940-320-2331

Share the love. Click "."here"." to send Froyo Bucks to someone else.

"; $to = $to_email; $subject = 'Froyo Bucks from '.$from; $headers = 'From: contact@pookysyogurt.com' . "\r\n" . 'Reply-To: contact@pookysyogurt.com' . "\r\n" . 'Bcc: contact@pookysyogurt.com' . "\r\n" . 'Content-type:text/html;charset=UTF-8' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $email_message, $headers); } //print_r($people); } mysqli_close($link); } ?>