$data = array(); // +-----------------------------------+ // + STEP 2: get data + // +-----------------------------------+ $token = $_REQUEST['access_token']; if (!$token) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ $uid = GeneralFunctions::getUserId($token); if ($uid) { $data = GeneralFunctions::get_notifications($uid); if ($data) { $success = "1"; $msg = "Records Found"; } else { $success = '0'; $msg = "No Record Found"; } } else { $success = '0'; $msg = "Incorrect Parameters"; } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+
$data = array(); // +-----------------------------------+ // + STEP 2: get data + // +-----------------------------------+ $token = $_REQUEST['access_token']; if (!$token) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ $uid = GeneralFunctions::getUserId($token); if ($uid) { $code = GeneralFunctions::generateRandomString(12); $sth = $conn->prepare("update users set token=:token where id=:id"); $sth->bindValue("id", $uid); $sth->bindValue('token', md5($code)); try { $sth->execute(); $success = '1'; $msg = "Access Token Updated"; $access_token = md5($code); } catch (Exception $e) { } } else { $success = '0'; $msg = "Token Expired"; } }
} $r = $sth->fetchAll(PDO::FETCH_ASSOC); if (count($r)) { $success = 1; $msg = 'Removed from favorites list'; $sql = "delete from favorites where user_id=:user_id and recipe_id=:recipe_id"; $sth = $conn->prepare($sql); $sth->bindValue('recipe_id', $rid); $sth->bindValue('user_id', $uid); $count = 0; try { $count = $sth->execute(); } catch (Exception $e) { //echo $e->getMessage(); } $data = GeneralFunctions::getAllFavorites($uid); if ($data) { $success = '1'; // $msg='Favorites List'; } else { $success = '0'; // $msg='No Favorites Found'; $data = []; } } else { $success = 0; $msg = "No such favorites exists"; } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+
$auto_cancel = $_REQUEST['auto_cancel'] ? $_REQUEST['auto_cancel'] : 0; $cancel_type = $_REQUEST['cancel_type'] ? $_REQUEST['cancel_type'] : ''; $high_temp = $_REQUEST['high_temp'] ? $_REQUEST['high_temp'] : ""; $low_temp = $_REQUEST['low_temp'] ? $_REQUEST['low_temp'] : ""; $tablename = "event_practice_settings"; if (!($token && $practice_id && $player_id)) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ $user_id = Users::getUserId($token); if ($user_id) { GeneralFunctions::setGameSettings($tablename, $practice_id, $conversation_status, $auto_cancel, $cancel_type, $high_temp, $low_temp); for ($i = 0; $i < $arr_size; $i++) { $sql = "SELECT * FROM event_practice_players WHERE practice_id=:practice_id and user_id=:player_id"; $sth = $conn->prepare($sql); $sth->bindValue('practice_id', $practice_id); $sth->bindValue('player_id', $player_id[$i]); try { $sth->execute(); } catch (Exception $e) { } $tour[$i] = $sth->fetchAll(PDO::FETCH_ASSOC); if (!count($tour[$i])) { $sql = "INSERT into event_practice_players(id,practice_id,user_id,player_profile,player_status,accept_status,created_on) \n\t\t VALUES(DEFAULT,:practice_id,:player_id,:player_profile,0,0,UTC_TIMESTAMP())"; $sth = $conn->prepare($sql); $sth->bindValue('practice_id', $practice_id); $sth->bindValue('player_id', $player_id[$i]);
$sth = $conn->prepare($sql); $sth->bindValue('uid', $uid); $sth->bindValue('user_id2', $user_id2); try { $sth->execute(); } catch (Exception $e) { } $result = $sth->fetchAll(); if ($result) { $success = '0'; $msg = "Already blocked this user"; } else { //removing match,favourites and conversation between current user and blocked user GeneralFunctions::RemoveMatch($uid, $user_id2); GeneralFunctions::RemoveFavorites($uid, $user_id2); GeneralFunctions::RemoveConversation($uid, $user_id2); $sql = "INSERT into blocked_users(id,block_by,block_to,created_on) VALUES(DEFAULT,:uid,:user_id2,NOW())"; $sth = $conn->prepare($sql); $sth->bindValue('uid', $uid); $sth->bindValue('user_id2', $user_id2); try { $sth->execute(); $success = '1'; $msg = "User BLocked"; } catch (Exception $e) { } } } else { $success = '0'; $msg = "Token Expired"; }
<div class="mini-stat-info"> <span><?php $total_questions = count(GeneralFunctions::getAllQuestions()); echo $total_questions; ?> </span> Questions </div> </div> </div> <div class="col-md-6"> <div class="mini-stat clearfix"> <span class="mini-stat-icon tar"><i class="fa fa-list-alt"></i></span> <div class="mini-stat-info"> <span><?php $categories = count(GeneralFunctions::getAllCategories()); echo $categories; ?> </span> Categories </div> </div> </div> </div> <!--<div class="row"> <div class="col-md-4"> <div class="profile-nav alt"> <section class="panel"> <div class="user-heading alt clock-row terques-bg"> <h1><?php echo date("F");
if ($googleid) { $sth->bindValue("googleid", $googleid); } try { $sth->execute(); } catch (Exception $e) { echo $e->getMessage(); } $res = $sth->fetchAll(PDO::FETCH_ASSOC); if (count($res)) { if ($fbid) { $uid = $fbid; } elseif ($googleid) { $uid = $googleid; } $data = GeneralFunctions::fbsignin($uid, $email); $success = "1"; $msg = "Login Successful"; } else { $code = md5($email . rand(1, 9999999)); $sql = "insert into users values(DEFAULT,:fbid,:googleid,:name,:email,:token,NOW(),:password)"; $sth = $conn->prepare($sql); if ($fbid) { $sth->bindValue("fbid", $fbid); } else { $sth->bindValue("fbid", ""); } if ($googleid) { $sth->bindValue("googleid", $googleid); } else { $sth->bindValue("googleid", "");
$success = "0"; $msg = "Incomplete Parameters"; } else { $user_id = Users::getUserId($token); if ($user_id) { if (!$lat1 && $lang1) { $lat = $lat1; $lang = $lang1; $updated = Users::UpdateLatlang($user_id, $lat, $lang); } else { $user_latlong = Users::getLatLong($user_id); $lat = $user_latlong[0]['lat']; $lang = $user_latlong[0]['lang']; } //$gallery = Users::getUserGallery($user_id2); $profile = Users::getOtherProfile($user_id, $user_id2, $lat, $lang); $common_interests = Users::getCommonInterests($user_id, $user_id2); $mutual_friends = GeneralFunctions::getMutualFriendsList($user_id, $user_id2); //$partner_pref = Users::getPartnerPref($user_id2); $success = '1'; $msg = "User Profile"; } else { $success = '0'; $msg = "Token Expired"; } } if ($success) { echo json_encode(array('success' => $success, 'msg' => $msg, 'profile' => $profile, 'common_interests' => $common_interests, 'mutual_friends' => $mutual_friends)); } else { echo json_encode(array('success' => $success, 'msg' => $msg)); }
require_once "../classes/AllClasses.php"; $success = $msg = "0"; $data = array(); // +-----------------------------------+ // + STEP 2: get data + // +-----------------------------------+ $question_id = $_REQUEST['question_id']; if (!$question_id) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ $data = GeneralFunctions::get_comments($question_id); if ($data) { $success = "1"; $msg = "Records Found"; } else { $success = '0'; $msg = "No Record Found"; } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+ if ($success == 1) { echo json_encode(array("success" => $success, "msg" => $msg, "comments" => $data)); } else { echo json_encode(array("success" => $success, "msg" => $msg));
$uname = $result[0]['username']; if ($user_id) { $sql = "SELECT * from user_like where liked_by=:user_id and liked_to=:user_id2"; $sth = $conn->prepare($sql); $sth->bindValue('user_id', $user_id); $sth->bindValue('user_id2', $user_id2); try { $sth->execute(); } catch (Exception $e) { } $likes = $sth->fetchAll(); $other_like_status = GeneralFunctions::getLikeStatus($user_id, $user_id2); $push_check = GeneralFunctions::PushCheck($user_id2); $new_match = $push_check[0]['new_matches']; //push notification code $user = GeneralFunctions::get_push_ids($user_id2); $apnid = $user[0]['apn_id']; $oid = $user[0]['id']; $reg_ids[] = $user[0]['reg_id']; $message = array(); $message['msg'] = $uname . ' and you have a match'; $message['type'] = 'match'; //match-push $message['uid'] = $user_id; $type = 'match'; if (count($likes)) { $sql = "UPDATE user_like set status=:status where liked_by=:user_id and liked_to=:user_id2"; $sth = $conn->prepare($sql); $sth->bindValue('user_id', $user_id); $sth->bindValue('user_id2', $user_id2); $sth->bindValue('status', $flag);
// +-----------------------------------+ // + STEP 2: get data + // +-----------------------------------+ $token = $_REQUEST['token']; if (!$token) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ //fetching user_id and name based on token $user_id = Users::getUserId($token); if ($user_id) { $match = GeneralFunctions::check_match($user_id) ? GeneralFunctions::check_match($user_id) : []; if ($match) { $success = '1'; $msg = "Matches Found"; } else { $success = '1'; $msg = "No Match Found"; } } else { $success = '0'; $msg = "Token Expired"; } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+
<?php session_start(); define('FromFile', TRUE); include $_SERVER['DOCUMENT_ROOT'] . '/config.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes.php'; $General = new GeneralFunctions(); $Country = new Country($_GET["country"]); $View = new SingleView(); $View->GetType($_GET["data"]); $View->SetTable(); $View->GetDataList(); ?> <html> <head> <title>TravellingTo | Travel planning done simple</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/superhero/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> <script src='https://www.google.com/recaptcha/api.js'></script> <style type="text/css"> body { background: url('/images/background.png'); background-size: cover; background-repeat: no-repeat;
<?php require_once '../phpInclude/dbconnection.php'; require_once '../GeneralFunctions.php'; $rst = GeneralFunctions::getAllIngredients(); echo json_encode(array("success" => '1', "data" => $rst));
} } else { $video_name = ""; } $data = Messages::saveUserMessage($user_id, $other_id, $message, $image_name, $video_name, $message_type); if ($data) { $success = "1"; $msg = "Message Sent"; $messages = Messages::getRecUserMessagesAfter($user_id, $other_id, $message_id); $data = $messages ? $messages : []; //push check $push_check = GeneralFunctions::PushCheck($other_id); $push_notif = $push_check[0]['push_notification']; if ($push_notif) { //push notification code $user = GeneralFunctions::get_push_ids($other_id); $apnid = $user[0]['apn_id']; $oid = $user[0]['id']; $reg_ids[] = $user[0]['reg_id']; $message = array(); $message['msg'] = $uname . ' sent you a message'; $message['type'] = 'message'; //message-push $message['uid'] = $user_id; $type = 'message'; if (!empty($reg_ids)) { GCM::send_notification($reg_ids, $message); } if (!empty($apnid)) { try { $apns->newMessage($apnid);
$sth->bindValue('question_id', $question_id); $sth->bindValue('answer', $answer); $sth->bindValue('status', $win_status); $sth->bindValue('answer_time', $answer_time); try { $sth->execute(); $success = "1"; $msg = "Challenge Played"; //remove challenge after play GeneralFunctions::removeChallenge($uid, $oid); //add scoring for challenge GeneralFunctions::addScoring($uid, $question_id, $score); //opponent notification GeneralFunctions::addNotification($uid, $oid, $question_id, $type, $message['msg']); //my notification GeneralFunctions::addNotification($oid, $uid, $question_id, $type, $other_message); //my profile $my_profile = Users::get_profile($uid); //opponent profile $opponent_profile = Users::get_profile($oid); /*if(!empty($apnid){ try{ $apns->newMessage($apnid); $apns->addMessageAlert($message['msg']); $apns->addMessageSound('Siren.mp3'); $apns->addMessageCustom('q', $question_id); $apns->addMessageCustom('t', $message['type']); $apns->queueMessage(); $apns->processQueue(); } catch(Exception $e){}
<?php require_once '../phpInclude/dbconnection.php'; require_once '../GeneralFunctions.php'; $success = $msg = "0"; $data = array(); $user_id = $_REQUEST['user_id'] ? $_REQUEST['user_id'] : 0; $recipe_id = $_REQUEST['recipe_id']; if (!$recipe_id) { $success = '0'; $msg = 'Incomplete Parameters'; } else { $data = GeneralFunctions::getRecipeDetails($recipe_id, $user_id); if ($data) { $success = '1'; $msg = 'Success'; } else { $success = '1'; $msg = 'No Records Found'; $data = []; } } echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
<?php define('FromFile', TRUE); include 'config.php'; require_once 'classes.php'; $General = new GeneralFunctions(); //Relation Query + declaration BEGIN $Points = 0; $relationQuery = "SELECT * FROM `Relation` WHERE `Points` >= 1 ORDER BY `Points` DESC LIMIT 5"; $relationResult = mysqli_query($conn, $relationQuery); ?> <html> <head> <title>TravellingTo | Travel planning done simple</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/superhero/bootstrap.min.css" rel="stylesheet"> <style type="text/css"> body { background: url('images/background.png'); background-size: cover; background-repeat: no-repeat; background-attachment: fixed; !important; } .navbar-default {
//checking whether the user is already matched $sql = "SELECT count(user_like.id) as like_count FROM `user_like` where liked_by IN (:user_id,:other_id) and liked_to IN (:user_id,:other_id) and user_like.status=1"; $sth = $conn->prepare($sql); $sth->bindValue('user_id', $user_id); $sth->bindValue('other_id', $other_id); try { $sth->execute(); } catch (Exception $e) { } $result = $sth->fetchAll(PDO::FETCH_ASSOC); $like_count = $result[0]['like_count']; if ($like_count == 2) { $match_status = 1; } else { $match_status = 0; } GeneralFunctions::RemoveMatch($user_id, $other_id) ? GeneralFunctions::RemoveMatch($user_id, $other_id) : []; $success = '1'; $msg = "Unmatched user"; } else { $success = '0'; $msg = "Token Expired"; } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+ /*if($success) echo json_encode(array('success'=>$success,'msg'=>$msg,'match'=>$match)); else*/ echo json_encode(array('success' => $success, 'msg' => $msg));
$success = "0"; $msg = "Incomplete Parameters"; } else { $sql = "SELECT * from users where email=:email"; $sth = $conn->prepare($sql); $sth->bindValue("email", $email); try { $sth->execute(); } catch (Exception $e) { } $res = $sth->fetchAll(); $user = $res[0]['first_name']; $username = $user ? $user : '******'; if (count($res)) { $token = GeneralFunctions::generateRandomString(); $password = GeneralFunctions::generateRandomString(6); $sql = "UPDATE users set token=:token,password=:password where email=:email"; $sth = $conn->prepare($sql); $sth->bindValue("email", $email); $sth->bindValue("token", md5($token)); $sth->bindValue('password', md5($password)); $count = 0; try { $count = $sth->execute(); } catch (Exception $e) { } if ($count) { $success = "1"; $msg = "Email successfully sent."; $body_email = "<div style='font-size:16px;line-height:1.4;'>\n\t\t\t\t\t\t<p> Dear {$username} </p>\t\n\t\t\t\t\t\t<p>We have received your password reset request.</p>\n\t\t\t\t\t\t<p>Your Password is reset as per your request:</p>\n\t\t\t\t\t\t<p>New Password: {$password}</p>\n\t\t\t\t\t\t<p>Have a good NBA experience.</p>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<p>Best,</p>\n\t\t\t\t\t\t<p>NBA Users</p>\n\t\t\t\t\t\t</div>"; sendEmail($email, "NBA- Recover Password", $body_email, SMTP_EMAIL);
if (!empty($result['email'])) { $success = "0"; $msg = "User already exist!"; } else { if (!empty($profile_pic)) { $randomFileName = GeneralFunctions::randomFileNameGenerator("Img_") . "." . end(explode(".", $profile_pic['name'])); if (@move_uploaded_file($profile_pic['tmp_name'], "../uploads/{$randomFileName}")) { $success = "1"; $url = $randomFileName; } } if (!$url) { $url = "default_user.png"; } if (!empty($cover_pic['name'])) { $randomFileName = GeneralFunctions::randomFileNameGenerator("Img_") . "." . end(explode(".", $cover_pic['name'])); if (@move_uploaded_file($cover_pic['tmp_name'], "../uploads/{$randomFileName}")) { $success = "1"; $url1 = $randomFileName; } } if (!$url1) { $url1 = "default_user.png"; } // Initialize the hasher without portable hashes (this is more secure) $hasher = new PasswordHash(8, false); // Hash the password. $hashedPassword will be a 60-character string. $hashedPassword = $hasher->HashPassword($password); $sql = "insert into `users` values(DEFAULT,:name,:profile_pic,:cover_pic,:email,:password,'',:dob,:gender,:token,now(),'','')"; $stmt = $conn->prepare($sql); $stmt->bindParam(':name', $name);
<?php //this is an api to get nba team list // +-----------------------------------+ // + STEP 1: include required files + // +-----------------------------------+ require_once "../php_include/db_connection.php"; require_once "../classes/AllClasses.php"; $success = $msg = "0"; $data = array(); $data = GeneralFunctions::getNbaTeam(); // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+ echo json_encode(array("success" => '1', "msg" => "NBA TEAM LIST", "nba" => $data));
$data = array(); // +-----------------------------------+ // + STEP 2: get data + // +-----------------------------------+ $token = $_REQUEST['access_token']; if (!$token) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ $uid = GeneralFunctions::getUserId($token); if ($uid) { $data = GeneralFunctions::getAllPosts($uid) ? GeneralFunctions::getAllPosts($uid) : []; if ($data) { $success = "1"; $msg = "Records Found"; } else { $success = '0'; $msg = "No Record Found"; } } else { $success = '0'; $msg = "Token Expired"; } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+
foreach($output['data'] as $k=>$row){ if($row['name']=="Profile Pictures") $album_id = $row['id']; } //fetching images of user based on fbid $albums=Users::getPhotosJson($fb_token,$album_id); //saving images fetched in album $albums_saved= Users::AddPhotos($uid,$albums,$fb_token); }*/ //fetching interests json $interest = Users::getInterestJson($fb_token, $fbid); //saving interests $interest_saved = Users::AddCommonInterests($uid, $interest); } $success = '1'; $msg = "Updated"; } else { $success = '0'; $msg = "Token Expired"; } } if ($success) { $profile = Users::myprofile($user_id); $friend_count = GeneralFunctions::getAllFriendsCount($user_id); echo json_encode(array('success' => $success, 'msg' => $msg, 'profile' => $profile, 'friend_count' => $friend_count)); } else { echo json_encode(array('success' => $success, 'msg' => $msg)); }
<div class="panel-body"> <section id="no-more-tables"> <table class="table table-bordered table-striped table-condensed cf"> <thead class="cf"> <tr> <th>ID</th> <th>Category Image </th> <th>Category</th> <th>Title</th> <th>Edit</th> </tr> </thead> <tbody> <?php $result = GeneralFunctions::getAllQuestions(); $r = 1; foreach ($result as $key => $value) { ?> <tr> <td data-title="ID"><?php echo $r; ?> </td> <td data-title="Category Image" style="text-align:center;"><img src="<?php echo BASE_PATH; ?> /uploads/<?php if ($value['category_image']) { echo $value['category_image']; } else {
$oid = $user[0]['id']; $message = array(); $message['msg'] = $uname . ' liked your question'; $message['type'] = 1; //like $type = 'like'; $sql = "Insert into likes(id,user_id,question_id,created_on) values(DEFAULT,:uid,:question_id,NOW())"; $sth = $conn->prepare($sql); $sth->bindValue('uid', $uid); $sth->bindValue('question_id', $question_id); try { $sth->execute(); $like_id = $conn->lastInsertId(); $success = "1"; $msg = "Question Liked"; GeneralFunctions::addNotification($uid, $oid, $question_id, $type, $message['msg']); /*if(!empty($apnid){ try{ $apns->newMessage($apnid); $apns->addMessageAlert($message['msg']); $apns->addMessageSound('Siren.mp3'); $apns->addMessageCustom('q', $question_id); $apns->addMessageCustom('t', $message['type']); $apns->queueMessage(); $apns->processQueue(); } catch(Exception $e){} }*/ } catch (Exception $e) { }
<?php require_once '../phpInclude/dbconnection.php'; require_once '../GeneralFunctions.php'; $success = $msg = "0"; $data = array(); $favorites = array(); $ingredient_type_id = $_REQUEST['ingredient_type_id']; $recipe_type_id = $_REQUEST['recipe_type_id']; $cook_time = $_REQUEST['ready_time']; $user_id = $_REQUEST['user_id'] ? $_REQUEST['user_id'] : 0; $page = $_REQUEST['page'] ? $_REQUEST['page'] : 1; $limit = $_REQUEST['limit'] ? $_REQUEST['limit'] : 15; $startIndex = ($page - 1) * $limit; $data = GeneralFunctions::getRecipe($ingredient_type_id, $recipe_type_id, $cook_time, $user_id, $startIndex, $limit); $total_records = GeneralFunctions::gettotalRecordsSearch($ingredient_type_id, $recipe_type_id, $cook_time, $user_id); /* if($user_id){ $favorites= GeneralFunctions::getAllFavorites($user_id); $favorites=$favorites?$favorites:[]; } */ if ($data) { $success = '1'; $msg = 'Success'; } else { $success = '1'; $msg = 'No Records Found'; $data = []; } echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data, "total_records" => $total_records));
//check is_login session_start(); $is_login = isset($_SESSION['is_login']) ? $_SESSION['is_login'] : false; $staff_type = isset($_SESSION['staff_type']) ? $_SESSION['staff_type'] : ""; // check login if ($is_login == false) { require_once '../configure/GeneralFunctions.php'; echo GeneralFunctions::Alert("Bạn chưa đăng nhập."); header("Location: index.php"); } // hard code to test staff_type $staff_type = "NV Thu Ngan"; if ($staff_type != "NV Thu Ngan") { require_once '../configure/GeneralFunctions.php'; echo GeneralFunctions::Alert("Bạn không có đủ quyền để thực hiện chức năng này."); header("Location: home.php"); } require_once '../configure/IncludeGenerator.php'; require_once '../controller/GUIGenerator.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>T4V RESTAURANT</title> <link rel="stylesheet" href="../css/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="../css/ingredientManagement.css" type="text/css" media="all" /> <link rel="stylesheet" href="../css/start/jquery-ui-1.8.20.custom.css" type="text/css" media="all" /> <link rel="stylesheet" href="../css/jquery-ui-timepicker-addon.css" type="text/css" media="all" />
$token = $_REQUEST['token']; $GLOBALS['timezone'] = $_REQUEST['timezone']; if (!$token) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ $user_id = GeneralFunctions::getUserId($token); if ($user_id) { //matched users chat conversation messages $data['messages'] = Messages::getMatchedChat($user_id) ? Messages::getMatchedChat($user_id) : []; //matched users $data['users'] = GeneralFunctions::check_match($user_id) ? GeneralFunctions::check_match($user_id) : []; if ($data) { $success = "1"; $msg = "Records Found"; } else { $success = '0'; $msg = "No Record Found"; } } else { $success = "0"; $msg = "Token Expired"; } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+
$success = $msg = "0"; $data = array(); // +-----------------------------------+ // + STEP 2: get data + // +-----------------------------------+ $token = $_REQUEST['access_token']; $comment_id = $_REQUEST['comment_id']; if (!($token && $comment_id)) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ $uid = GeneralFunctions::getUserId($token); if ($uid) { $sth = $conn->prepare("delete from comments where id=:id and user_id=:user_id"); $sth->bindValue("id", $comment_id); $sth->bindValue('user_id', $uid); try { $sth->execute(); $success = '1'; $msg = "Comment Deleted"; } catch (Exception $e) { } } else { $success = '0'; $msg = "Token Expired"; } }
<?php require_once '../phpInclude/dbconnection.php'; require_once '../GeneralFunctions.php'; $rst = GeneralFunctions::getAllRecipes(); echo json_encode(array("success" => '1', "data" => $rst));