public function userinfo() { $id = $_REQUEST['id']; $this->assign("user", findById("user", $id)); $map['user_id'] = $id; $this->assign("userinfo", findByMap("user_info", $map)); $this->display(); }
function findById($id, $options, $level, &$tree) { foreach ($options as $k => $v) { if ($v['id'] == $id) { $tree[$level] = $k; return $k; } else { if (!$v['final']) { $found = findById($id, $v['options'], $level + 1, $tree); if ($found !== false) { $tree[$level] = $k; return $found; } } } } return false; }
<?php include_once '../../config/config.php'; include_once $serverPath . 'utils/db/db_get.php'; if (!empty($_GET['id'])) { $table = "tavern"; $owner_table = "npc"; $s = findById($table, $_GET['id']); $tavern = json_encode($s); $tavern_owner = json_encode(findById($owner_table, $s['tavern_owner_id'])); } else { header("Location: index.php"); die("Redirecting to index"); } include_once $serverPath . 'resources/templates/head.php'; ?> <div ng-controller="tavernController"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3>{{tavern.name}}</h3> </div> <div class="panel-body"> <div class="col-md-12"> <h4>Type</h4> <div>{{tavern.type}}</div> </div> <div class="col-md-12"> <h4>Owner</h4>
function getCat($id) { $result = findById($id, 'category'); echo $result; }
function getEventBidDetail($id) { $sql = "SELECT * from event_bids where event_bids.id=:id"; //echo $sql; $site_path = SITEURL; $offer_images = array(); $point_master_details = array(); try { $db = getConnection(); $stmt = $db->prepare($sql); $stmt->bindParam("id", $id); $stmt->execute(); $offer = $stmt->fetchObject(); $count = $stmt->rowCount(); if ($count > 0) { $rid = $offer->resturant_id; $outlet_id = $offer->outlet_id; $event_id = $offer->event_id; $events = findById($event_id, 'events'); $events = json_decode($events); $allRes = findById($rid, 'merchantrestaurants'); $allRes = json_decode($allRes); $allOutlet = findById($outlet_id, 'merchantoutlets'); $allOutlet = json_decode($allOutlet); $promo_images = findByConditionArray(array('event_bid_id' => $id), 'event_bid_images'); if (!empty($promo_images)) { $prmcount = count($promo_images); for ($i = 0; $i < $prmcount; $i++) { $image = $site_path . "template_images/" . $promo_images[$i]['image']; $offer_images[$i]['image'] = $image; } } else { $image = $site_path . "template_images/default.png"; $offer_images[0]['image'] = $image; } $offer = json_encode($offer); $result = '{"type":"success","event_bid":' . $offer . ',"restaurant":' . json_encode($allRes) . ',"outlet":' . json_encode($allOutlet) . ',"events" : ' . json_encode($events) . ',"promo_images" : ' . json_encode($offer_images) . '}'; } else { $result = '{"type":"error","message":"Sorry no promo found"}'; } } catch (PDOException $e) { $result = '{"type":"error","message":' . $e->getMessage() . '}'; } echo $result; }
function getCoupon($id) { $result = findById($id, 'coupons'); echo $result; }
<?php include_once '../../config/config.php'; include_once $serverPath . 'utils/db/db_get.php'; if (!empty($_GET['id'])) { $table = "settlement"; $ruler_table = "npc"; $s = findById($table, $_GET['id']); $settlement = json_encode($s); $ruler = json_encode(findById($ruler_table, $s['ruler_id'])); } else { header("Location: index.php"); // Remember that this die statement is absolutely critical. Without it, // people can view your members-only content without logging in. die("Redirecting to index"); } include_once $serverPath . 'resources/templates/head.php'; ?> <div ng-controller="SettlementController"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3>{{settlement.name}}</h3> </div> <div class="panel-body"> <div class="row"> <div class="col-md-6"> Population: <b>{{settlement.population}}</b> </div>
function getCustomer($id) { $request = findById($id, 'users'); $body = json_decode($request); //print_r($body);exit; if (!empty($body)) { $site_path = SITEURL; $aa = date("d M, Y", strtotime($body->registration_date)); $body->registration_date = $aa; $ab = date("d M, Y", strtotime($body->last_login)); $body->last_login = $ab; if (!empty($body->image)) { $bb = $site_path . "user_images/" . $body->image; } else { $bb = $site_path . "user_images/default-profile.png"; } $sql = "SELECT sum(remaining_points) as points FROM points WHERE user_id=" . $id . " and expire_date>=NOW()"; //echo $sql; //exit; $db = getConnection(); $stmt = $db->prepare($sql); $stmt->execute(); //echo $count;exit; $user = $stmt->fetchObject(); if (!empty($user->points)) { $body->points = $user->points; } else { $body->points = 0; } $body->image = $bb; $body->locations = json_decode(findByCondition(array('user_id' => $id), 'merchant_location_map')); // print_r($body->locations); // exit; $body->categories = json_decode(findByCondition(array('user_id' => $id), 'merchant_category_map')); $user_details = json_encode($body); $result = '{"type":"success","user_details":' . $user_details . '}'; } echo $result; }
<?php include_once $serverPath . 'utils/db/db_get.php'; if (isset($table)) { if (isset($_GET['id'])) { $canSee = false; $data = findById($table, $_GET['id']); if ($data['public'] == '1' || isset($_SESSION['user']) && ($data['owner_id'] == $_SESSION['user']['id'] || $_SESSION['user']['admin'] == '1')) { $canSee = true; } if ($canSee == false) { header("Location: " . $baseURL . "index.php?error=You do not have access to that."); die("redirecting to login"); } } } else { echo "Cannot guarantee security table name is undefined."; }
function getLocation($id) { $result = findById($id, 'locations'); echo $result; }
function getEvenDetails($id) { $event_details = findById($id, 'events'); $event_details = json_decode($event_details); $mul_image = array(); if (!empty($event_details)) { $today = date('Y-m-d'); $checkdate = date('Y-m-d', strtotime($event_details->offer_to_date)); $event_details->from_date = date('m-d-Y h:i:s a ', strtotime($event_details->from_date)); $event_details->to_date = date('m-d-Y h:i:s a', strtotime($event_details->to_date)); $event_details->offer_from_date = date('m-d-Y', strtotime($event_details->offer_from_date)); $event_details->offer_to_date = date('m-d-Y', strtotime($event_details->offer_to_date)); //$event_details->mulimg = array(); if (!empty($event_details->image)) { $event_details->image = SITEURL . 'event_images/' . $event_details->image; $mul_image[]['image'] = $event_details->image; } else { $event_details->image = SITEURL . 'event_images/default.png'; $mul_image[]['image'] = $event_details->image; } if ($checkdate < $today) { $event_details->status = 'Expired'; } else { if ($event_details->status == 'O') { $event_details->status = 'Open'; } else { if ($event_details->status == 'E') { $event_details->status = 'Expired'; } else { $event_details->status = 'Completed'; } } } $condition = array('event_id' => $id); $result = findByCondition($condition, 'event_images'); $result = json_decode($result); //echo '<pre>';print_r($result); if (!empty($result)) { foreach ($result as $key => $val) { $mul_image[]['image'] = SITEURL . 'event_images/' . $val->image; } } $event_details->mulimg = $mul_image; $event_details->user_details = findByIdArray($event_details->user_id, 'users'); $event_details->locations = array(); $locations = findByConditionArray(array('event_id' => $id), 'event_location_map'); foreach ($locations as $cat) { $event_details->locations[] = findByIdArray($cat['location_id'], 'locations'); } $event_details->categories = array(); $category = findByConditionArray(array('event_id' => $id), 'event_category_map'); foreach ($category as $cat) { $event_details->categories[] = findByIdArray($cat['category_id'], 'category'); } echo json_encode(array('status' => 'success', 'data' => $event_details)); } else { echo json_encode(array('status' => 'error', 'message' => 'No data found')); } //echo $event_details; exit; }
<?php include_once '../config/config.php'; include_once $serverPath . 'utils/security/requireAdmin.php'; include_once $serverPath . 'utils/db/db_post.php'; include_once $serverPath . 'utils/db/db_get.php'; $_POST = json_decode(file_get_contents('php://input'), true); if (!empty($_POST) && !empty($_POST['id']) && $_POST['id'] != $_SESSION['user']['id']) { $id = $_POST['id']; $table = "users"; $user = findById($table, $id); $data = ['admin' => $user['admin'] == 1 ? '0' : '1']; $constraints = ['id' => $id, "protected" => 0]; updateWithConstratints($table, $data, $constraints); }
<?php include_once '../../config/config.php'; include_once $serverPath . 'admin/login/requireAdmin.php'; include_once $serverPath . 'utils/db_post.php'; include_once $serverPath . 'utils/db_get.php'; if (!empty($_GET['id']) && $_SESSION['user']['id'] != $_GET['id']) { $table = "users"; $user = findById($table, $_GET['id']); if ($user['protected'] != 1) { deleteFrom($table, $_GET['id']); } }
public function getNameById($id) { $this->contain(); $population = $this > findById($populationId); return $population['Population']['name']; }
public function getNameById($id) { $library = $this > findById($id); return $library['Library']['name']; }
<?php include_once '../../config/config.php'; include_once $serverPath . 'admin/login/requireAdmin.php'; include_once $serverPath . 'utils/db_post.php'; include_once $serverPath . 'utils/db_get.php'; $table = 'users'; $_POST = json_decode(file_get_contents('php://input'), true); if (!empty($_POST)) { if (!empty($_POST['email']) && !empty($_POST['id']) && $_POST['id'] != $_SESSION['user']['id'] && ($_POST['active'] == 1 || $_POST['active'] == 0)) { $user = findById($table, $_POST['id']); if ($user['protected'] != '1') { $update = "Update " . getTableQuote($table) . " SET active=" . $_POST['active'] . " WHERE id=" . $_POST['id'] . ";"; runInsert($update); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'From:' . $webmasterMail . ' <' . $webmasterMail . '>' . "\r\n"; $activated = $_POST['active'] == 0 ? 'deactivated' : 'activated'; $link = $_POST['active'] == 1 ? '<p>Click here to login: <a href="' . $externalLink . 'admin/login/">Login</a></p>' : ''; $message = "\n\t\t\t\t\t<html>\n\t\t\t\t\t\t<body>\n\t\t\t\t\t\t<p>Your account has been {$activated}</p>\n\t\t\t\t\t\t{$link}\n\t\t\t\n\t\t\t\t\t</body>\n\t\t\t\n\t\t\t\t\t</html>\n\t\t\t\t\t"; $subject = "Your account has been {$activated} for The Linger Martini Bar"; mail($_POST['email'], $subject, $message, $headers); } } }
function success_payment() { $rarray = array(); if (!empty($_POST)) { $data = array(); $data['is_paid'] = 'P'; $payment_id = $_POST['payment_id']; $details = editByField(json_encode(array('save_data' => $data)), 'orders', array('payment_id' => $payment_id)); if ($details) { $sql = "SELECT * FROM orders WHERE payment_id=:payment_id"; $db = getConnection(); $stmt = $db->prepare($sql); $stmt->bindParam("payment_id", $payment_id); $stmt->execute(); $user = $stmt->fetchObject(); $db = null; if ($user) { $userforEmail = findByConditionArray(array('id' => $user->user_id), 'users'); $emailForEmail = $userforEmail[0]['email']; $nameForEmail = $userforEmail[0]['first_name'] . ' ' . $userforEmail[0]['last_name']; $toMain = $emailForEmail; //'*****@*****.**'; $subjectMain = 'Download App Link'; $bodyMain = '<html><body><p>Dear ' . $nameForEmail . ',</p> <p>You can download the app from the link below:<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif"><a href="https://linkmaker.itunes.apple.com/en-us/" target="_blank">Download From Apple Store</a> | <a href="https://play.google.com/store?utm_source=apac_med&utm_medium=hasem&utm_content=Jun2515&utm_campaign=evergreen&pcampaignid=MKT-DR-apac-in-all-med-hasem-py-evergreen-Jun2515-1-en-bkws&gclid=Cj0KEQjwzq63BRCrtIuGjImRoIIBEiQAGLHdYT7z3GaJyAPj3q9T0zqoX5Try5Eh6WEgR8Dvh7EEnMgaAscR8P8HAQ&gclsrc=aw.ds" target="_blank">Download From Google Store</a> </span></p> <p>Thanks,<br /> mFood Team</p> <p> </p></body></html>'; //echo $user->id; $sql = "SELECT * FROM order_details WHERE order_id=:order_id"; $db = getConnection(); $stmt = $db->prepare($sql); $stmt->bindParam("order_id", $user->id); $stmt->execute(); $order_details = $stmt->fetchAll(PDO::FETCH_OBJ); $db = null; foreach ($order_details as $order_detail) { if ($order_detail->typemem == 'App' || $order_detail->typemem == 'Both') { sendMail($toMain, $subjectMain, $bodyMain); } if ($order_detail->event == 0) { $qty = $order_detail->quantity; $offer_details = json_decode(findById($order_detail->offer_id, 'offers')); //print_r($offer_details); $merchant_id = ''; $offer_id = ''; $point_id = ''; $point = ''; $merchant_id = $offer_details->merchant_id; $offer_id = $offer_details->id; $point_id = $offer_details->given_point_master_id; $needed_point_id = $offer_details->point_master_id; $point = $offer_details->mpoints_given; $given_point_details = findByConditionArray(array('id' => $point_id), 'point_master'); $given_point_exipre_date = $given_point_details[0]['expire_date']; if ($order_detail->resell == 0) { for ($i = 0; $i < $qty; $i++) { if ($offer_details->conditions == 0) { $voucher_data = array(); $voucher_data['offer_id'] = $order_detail->offer_id; $voucher_data['created_on'] = date('Y-m-d h:i:s'); $voucher_data['price'] = $offer_details->price; $voucher_data['offer_price'] = $offer_details->offer_price; $voucher_data['offer_percent'] = $offer_details->offer_percent; $voucher_data['from_date'] = $offer_details->offer_from_date; $voucher_data['to_date'] = $offer_details->offer_to_date; if ($offer_details->start_date_type == 'P') { $voucher_data['item_start_date'] = date('Y-m-d'); $voucher_data['item_expire_date'] = date('Y-m-d', strtotime("+" . $offer_details->valid_days . " days")); } else { $voucher_data['item_start_date'] = $offer_details->item_start_date; $voucher_data['item_expire_date'] = $offer_details->item_expire_date; } $voucher_data['item_start_hour'] = $offer_details->item_start_hour; $voucher_data['item_end_hour'] = $offer_details->item_end_hour; $voucher_data['is_active'] = 1; $voucher_data['purchase_type'] = 0; $s = add(json_encode(array('save_data' => $voucher_data)), 'vouchers'); $s = json_decode($s); //print_r($s); exit; $owner_data = array(); $owner_data['offer_id'] = $order_detail->offer_id; $owner_data['voucher_id'] = $s->id; $owner_data['from_user_id'] = 0; $owner_data['to_user_id'] = $order_detail->user_id; $owner_data['purchased_date'] = date('Y-m-d h:i:s'); $owner_data['is_active'] = 1; $owner_data['price'] = $offer_details->price; $owner_data['offer_price'] = $offer_details->offer_price; $owner_data['offer_percent'] = $offer_details->offer_percent; $owner_data['buy_price'] = $offer_details->offer_price; add(json_encode(array('save_data' => $owner_data)), 'voucher_owner'); $point_data = array(); $point_data['offer_id'] = $offer_id; $point_data['points'] = $point; $point_data['source'] = 'earn from promo click'; $point_data['user_id'] = $order_detail->user_id; $point_data['date'] = date('Y-m-d h:i:s'); $point_data['type'] = 'P'; $point_data['remaining_points'] = $point; $point_data['merchant_id'] = $merchant_id; $point_data['point_id'] = $point_id; $point_data['expire_date'] = $given_point_exipre_date; add(json_encode(array('save_data' => $point_data)), 'points'); $point_detail_data = array(); $point_detail_data['offer_id'] = $offer_id; $point_detail_data['points'] = $point; $point_detail_data['source'] = 'earn from promo click'; $point_detail_data['user_id'] = $order_detail->user_id; $point_detail_data['date'] = date('Y-m-d h:i:s'); $point_detail_data['type'] = 'P'; $point_detail_data['remaining_points'] = $point; $point_detail_data['merchant_id'] = $merchant_id; $point_detail_data['point_id'] = $point_id; $point_detail_data['expire_date'] = $given_point_exipre_date; $point_detail_data['transaction_type'] = 0; add(json_encode(array('save_data' => $point_detail_data)), 'point_details'); } } /********* Update Offer *************/ //$up_query = "UPDATE offers SET buy_count=buy_count+".$order_detail->quantity." where id=".$order_detail->offer_id; //updateByQuery($up_query); } elseif ($order_detail->resell == 1) { $resell_id = $order_detail->resell_id; $resellInfo = findByConditionArray(array('id' => $resell_id), 'voucher_resales'); $resell_point_id = $resellInfo[0]['point_id']; $resell_user_id = $resellInfo[0]['user_id']; $resell_price = $resellInfo[0]['price']; $to_user_id = $order_detail->user_id; $resellUserInfo = findByConditionArray(array('id' => $resell_user_id), 'users'); $toUserInfo = findByConditionArray(array('id' => $to_user_id), 'users'); $resell_user_email = $resellUserInfo[0]['email']; $to_user_email = $toUserInfo[0]['email']; $to_user_name = $toUserInfo[0]['first_name'] . ' ' . $toUserInfo[0]['last_name']; $resell_user_name = $resellUserInfo[0]['first_name'] . ' ' . $resellUserInfo[0]['last_name']; $mCashInfo = findByConditionArray(array('name' => 'mCash'), 'point_master'); $money_point = $mCashInfo[0]['money_point']; $point_val = $mCashInfo[0]['value']; $mCashExpireDate = $mCashInfo[0]['expire_date']; $mCashPointId = $mCashInfo[0]['id']; $total_point = round($resell_price / $point_val); $resell_voucher_id = $resellInfo[0]['voucher_id']; $voucherDetail = findByConditionArray(array('id' => $resell_voucher_id), 'vouchers'); $resellbidInfo = findByConditionArray(array('voucher_id' => $resell_voucher_id, 'user_id' => $to_user_id), 'voucher_bids'); if (empty($resellbidInfo)) { $resellownerInfo = findByConditionArray(array('voucher_id' => $resell_voucher_id, 'is_active' => 1), 'voucher_owner'); $voucher_owner_id = $resellownerInfo[0]['id']; $save_data = array(); $save_data['save_data']['voucher_status'] = 0; $voucher_edit = edit(json_encode($save_data), 'vouchers', $resell_voucher_id); $save_data = array(); $save_data['save_data']['resell_type'] = 2; $save_data['save_data']['is_active'] = 0; $voucher_owner_edit = edit(json_encode($save_data), 'voucher_owner', $voucher_owner_id); $save_data = array(); $save_data['save_data']['ispayment'] = 0; $save_data['save_data']['is_sold'] = '1'; $save_data['save_data']['sold_on'] = date('Y-m-d h:i:s'); $save_data['save_data']['accept_date'] = date('Y-m-d h:i:s'); $voucher_owner_edit = edit(json_encode($save_data), 'voucher_resales', $resell_id); $data = array(); $data['voucher_id'] = $resell_voucher_id; $data['offer_id'] = $voucherDetail[0]['offer_id']; $data['voucher_view_id'] = $voucherDetail[0]['view_id']; $data['from_user_id'] = $resell_user_id; $data['to_user_id'] = $to_user_id; $data['price'] = $voucherDetail[0]['price']; $data['offer_price'] = $voucherDetail[0]['offer_price']; $data['offer_percent'] = $voucherDetail[0]['offer_percent']; $data['is_active'] = '1'; $data['buy_price'] = $resell_price; $data['purchased_date'] = date('Y-m-d h:i:s'); $data['resell_type'] = 0; $data['owner_id'] = $voucher_owner_id; $newinfo['save_data'] = $data; $new_owner_details = add(json_encode($newinfo), 'voucher_owner'); } else { $resellownerInfo = findByConditionArray(array('voucher_id' => $resell_voucher_id, 'is_active' => 1), 'voucher_owner'); $voucher_owner_id = $resellownerInfo[0]['id']; $save_data = array(); $save_data['save_data']['voucher_status'] = 0; $voucher_edit = edit(json_encode($save_data), 'vouchers', $resell_voucher_id); $save_data = array(); $save_data['save_data']['resell_type'] = 0; $voucher_owner_edit = edit(json_encode($save_data), 'voucher_owner', $voucher_owner_id); $save_data = array(); $save_data['save_data']['ispayment'] = 0; $voucher_owner_edit = edit(json_encode($save_data), 'voucher_resales', $resell_id); } //$resellPointInfo = findByConditionArray(array('id' => $resell_point_id),'point_master'); if ($money_point == 1) { $point_detail_data = array(); $point_detail_data['offer_id'] = 0; $point_detail_data['points'] = $total_point; $point_detail_data['source'] = 'earn from promo click'; $point_detail_data['user_id'] = $resell_user_id; $point_detail_data['date'] = date('Y-m-d h:i:s'); $point_detail_data['type'] = 'P'; $point_detail_data['remaining_points'] = $total_point; $point_detail_data['merchant_id'] = 0; $point_detail_data['point_id'] = $mCashPointId; $point_detail_data['expire_date'] = $mCashExpireDate; $point_detail_data['transaction_type'] = 0; add(json_encode(array('save_data' => $point_detail_data)), 'point_details'); } $from = ADMINEMAIL; //$to = $saveresales->email; $to = $to_user_email; //'*****@*****.**'; $sviewid = 'MFG-000000000' . $voucherDetail[0]['id']; $sstartdate = date('d M, Y', strtotime($voucherDetail[0]['item_start_date'])); $senddate = date('d M, Y', strtotime($voucherDetail[0]['item_expire_date'])); $sprice = $voucherDetail[0]['price']; $resaleprice = $resell_price; $svname = $offer_details->title; $subject = 'Payment successfully'; $body = '<html><body><p>Dear ' . $to_user_name . ',</p> <p>You have successfully made payment for resell voucher<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher Id :</span>' . $sviewid . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher Name :</span>' . $svname . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher Start Date :</span>' . $sstartdate . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher End Date :</span>' . $senddate . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher price :</span>' . $sprice . '<br /><br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Sell price :</span>' . $resaleprice . '<br /><br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">If we can help you with anything in the meantime just let us know by e-mailing </span>' . $from . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif"></span><span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">! </span></p> <p>Thanks,<br /> mFood Team</p> <p> </p></body></html>'; sendMail($to, $subject, $body); $from = ADMINEMAIL; //$to = $saveresales->email; $to1 = $resell_user_email; //'*****@*****.**'; $subject1 = $to_user_name . ' has successfully made payment for your voucher'; $body1 = '<html><body><p>Dear ' . $resell_user_name . ',</p> <p> You have successfully sold voucher to ' . $to_user_name . '.<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher Id :</span>' . $sviewid . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher Name :</span>' . $svname . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher Start Date :</span>' . $sstartdate . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher End Date :</span>' . $senddate . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Voucher price :</span>' . $sprice . '<br /><br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Sell price :</span>' . $resaleprice . '<br /><br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">If we can help you with anything in the meantime just let us know by e-mailing </span>' . $from . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif"></span><span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">! </span></p> <p>Thanks,<br /> mFood Team</p> <p> </p></body></html>'; sendMail($to1, $subject1, $body1); } } else { $event_id = $order_detail->event_id; $bid_id = $order_detail->event_bid_id; $temp = array(); $temp['event_id'] = $event_id; editByField(json_encode(array('save_data' => array('is_accepted' => 2))), 'event_bids', $temp); $t = edit(json_encode(array('save_data' => array('is_accepted' => 1))), 'event_bids', $bid_id); edit(json_encode(array('save_data' => array('status' => 'C'))), 'events', $event_id); $bidInfo = findByConditionArray(array('id' => $bid_id), 'event_bids'); $bid_user_id = $bidInfo[0]['user_id']; $from_user_id = $order_detail->user_id; $bidUserInfo = findByConditionArray(array('id' => $bid_user_id), 'users'); $fromUserInfo = findByConditionArray(array('id' => $from_user_id), 'users'); $bid_user_email = $bidUserInfo[0]['email']; $from_user_email = $fromUserInfo[0]['email']; $from_user_name = $fromUserInfo[0]['first_name'] . ' ' . $fromUserInfo[0]['last_name']; $bid_user_name = $bidUserInfo[0]['first_name'] . ' ' . $bidUserInfo[0]['last_name']; $from = ADMINEMAIL; //$to = $saveresales->email; $to1 = $bid_user_email; //$to1 = '*****@*****.**'; $subject1 = $from_user_name . ' accept the event that you have bidded and successfully made payment for the event'; $body1 = '<html><body><p>Dear ' . $bid_user_name . ',</p> <p> ' . $from_user_name . ' accept the event that you have bidded and successfully made payment for the event<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">If we can help you with anything in the meantime just let us know by e-mailing </span>' . $from . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif"></span><span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">! </span></p> <p>Thanks,<br /> mFood Team</p> <p> </p></body></html>'; sendMail($to1, $subject1, $body1); } } // $orders = getlist('order_details',array('order_id' => $user->id)); //print_r($orders); } //print_r($user); //exit; } $rarray = array('type' => 'success'); } else { $rarray = array('type' => 'error'); } echo json_encode($rarray); exit; }
<?php include_once '../../config/config.php'; include_once $serverPath . 'utils/db_get.php'; $table = "drinks"; mysqli_set_charset(connect(), "utf8"); if (!empty($_GET['get'])) { $get = $_GET['get']; if ($get == "grid") { $data = getAllData($table); echo json_encode($data, true); } elseif ($get == "drink_types") { $queryStatement = "SELECT DISTINCT(type) FROM {$table};"; $data = runQuery($queryStatement); $array = []; foreach ($data as $row) { array_push($array, $row['type']); } echo json_encode($array); } } if (!empty($_GET['id'])) { $id = $_GET['id']; echo json_encode(findById($table, $id)); }
function merchantSaveMember() { //echo 'aqb';exit; $is_active = 1; $site_path = SITEURL; $newdate = date('Y-m-d'); $request = Slim::getInstance()->request(); $membership_info = json_decode($request->getBody()); $user_exist = $membership_info->user_type; unset($membership_info->user_type); if ($user_exist == "New User") { $unique_field = array(); $user = array(); $unique_field['email'] = $membership_info->email; //$unique_field['username']=$user->username; $rowCount = rowCount(json_encode($unique_field), 'users'); if ($rowCount == 0) { $unique_code = time() . rand(100000, 1000000); $pass = '******'; $user['txt_pwd'] = $pass; $user['email'] = $membership_info->email; $user['unique_code'] = $unique_code; $user['password'] = md5($pass); $user['user_type_id'] = 2; $user['is_active'] = 1; $user['registration_date'] = date('Y-m-d h:m:s'); //$activation_link = $user->activation_url; //unset($user->activation_url); $allinfo['save_data'] = $user; //$allinfo['unique_data'] = $unique_field; $user_details = add(json_encode($allinfo), 'users'); if (!empty($user_details)) { $user_details = json_decode($user_details); //echo $user_details->email; exit; // print_r($user_details);exit; $from = ADMINEMAIL; $to = $user_details->email; $subject = 'User Registration'; $body = '<html><body><p>Dear User,</p> <p>Thank You for signing up with mFoodGate.<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Your Account Details:</span><br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif"><strong>Email: ' . $to . '</strong></span><br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif"><strong>Password: '******'</strong></span></p> <p><span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">If we can help you with anything in the meantime just let us know by e-mailing </span>' . $from . '<br /> <span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">Thanks again for signing up with the site</span><span style="color:rgb(34, 34, 34); font-family:arial,sans-serif">! </span></p> <p>Thanks,<br /> mFood Team</p> <p> </p></body></html> '; //$body = "Hello"; sendMail($to, $subject, $body); $new_user_id = $user_details->id; $offer_details = json_decode(findById($membership_info->offer_id, 'offers')); $voucher_data = array(); $voucher_data['offer_id'] = $membership_info->offer_id; $voucher_data['created_on'] = $offer_details->created_on; $voucher_data['price'] = $offer_details->price; $voucher_data['offer_price'] = $offer_details->offer_price; $voucher_data['offer_percent'] = $offer_details->offer_percent; $voucher_data['from_date'] = $offer_details->offer_from_date; $voucher_data['to_date'] = $offer_details->offer_to_date; $voucher_data['is_active'] = 1; $s = add(json_encode(array('save_data' => $voucher_data)), 'vouchers'); $s = json_decode($s); $owner_data = array(); $owner_data['offer_id'] = $membership_info->offer_id; $owner_data['voucher_id'] = $s->id; $owner_data['from_user_id'] = 0; $owner_data['to_user_id'] = $new_user_id; $owner_data['purchased_date'] = date('Y-m-d h:i:s'); $owner_data['is_active'] = 1; $owner_data['price'] = $offer_details->price; $owner_data['offer_price'] = $offer_details->offer_price; $owner_data['offer_percent'] = $offer_details->offer_percent; $owner_data['buy_price'] = $offer_details->offer_price; add(json_encode(array('save_data' => $owner_data)), 'voucher_owner'); $result = '{"type":"success","message":"Added Succesfully"}'; } else { $result = '{"type":"error","message":"Try Again"}'; } } else { if ($rowCount > 0) { $result = '{"type":"error","message":"Email already exist"}'; } } } else { if ($user_exist == "Existing User") { $unique_code = $membership_info->unique_code; $sql = "SELECT * FROM users where users.unique_code=:unique_code"; $db = getConnection(); $stmt = $db->prepare($sql); $stmt->bindParam("unique_code", $unique_code); $stmt->execute(); $user_info = $stmt->fetchObject(); $count = $stmt->rowCount(); if ($count == 0) { $result = '{"type":"error","message":"User code does not exist"}'; } else { $new_user_id = $user_info->id; $offer_details = json_decode(findById($membership_info->offer_id, 'offers')); $voucher_data = array(); $voucher_data['offer_id'] = $membership_info->offer_id; $voucher_data['created_on'] = $offer_details->created_on; $voucher_data['price'] = $offer_details->price; $voucher_data['offer_price'] = $offer_details->offer_price; $voucher_data['offer_percent'] = $offer_details->offer_percent; $voucher_data['from_date'] = $offer_details->offer_from_date; $voucher_data['to_date'] = $offer_details->offer_to_date; $voucher_data['is_active'] = 1; $s = add(json_encode(array('save_data' => $voucher_data)), 'vouchers'); $s = json_decode($s); $owner_data = array(); $owner_data['offer_id'] = $membership_info->offer_id; $owner_data['voucher_id'] = $s->id; $owner_data['from_user_id'] = 0; $owner_data['to_user_id'] = $new_user_id; $owner_data['purchased_date'] = date('Y-m-d h:i:s'); $owner_data['is_active'] = 1; $owner_data['price'] = $offer_details->price; $owner_data['offer_price'] = $offer_details->offer_price; $owner_data['offer_percent'] = $offer_details->offer_percent; $owner_data['buy_price'] = $offer_details->offer_price; add(json_encode(array('save_data' => $owner_data)), 'voucher_owner'); $result = '{"type":"success","message":"Added successfully"}'; } } } echo $result; }
<?php include_once '../../config/config.php'; include_once $serverPath . 'utils/db/db_get.php'; $table = "dungeon"; $traps_table = "traps"; if (!empty($_GET['id'])) { echo json_encode(findById($table, $_GET['id'])); } else { if (!empty($_GET['column'])) { $column = $_GET['column']; if ($column == "index") { $columns = ['name', 'purpose', 'location', 'creator']; print json_encode(getSpecificData($table, $columns)); } else { if ($column == "traps") { print json_encode(getAllData($traps_table)); } } } }
function getUsersPoints($user_id, $promo_id) { $rarray = array(); $offer_details = json_decode(findById($promo_id, 'offers')); $merchant_id = $offer_details->merchant_id; //echo $merchant_id; try { $date = date('Y-m-d H:i:s'); $sql = "SELECT sum(remaining_points) as sum FROM points WHERE user_id=:user_id and merchant_id=:merchant_id"; $db = getConnection(); $stmt = $db->prepare($sql); $stmt->bindParam("user_id", $user_id); $stmt->bindParam("merchant_id", $merchant_id); //$stmt->bindParam("expire_date", $date); $stmt->execute(); $points = $stmt->fetch(); $rarray = array('status' => 'success', 'data' => $points); } catch (PDOException $e) { $rarray = array('status' => 'error', 'error' => array('text' => $e->getMessage())); } echo json_encode($rarray); exit; }