本文整理汇总了PHP中getUserById函数的典型用法代码示例。如果您正苦于以下问题:PHP getUserById函数的具体用法?PHP getUserById怎么用?PHP getUserById使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUserById函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login($link, $user_id)
{
$_SESSION['auth'] = 'ok';
$_SESSION['user_id'] = $user_id;
$user_info = getUserById($link, $user_id);
$_SESSION['user'] = $user_info['user'];
$_SESSION['role'] = $user_info['role'];
header('LOCATION: ./index.php');
}
示例2: checkIsAuth
function checkIsAuth()
{
global $db;
if (!isset($_SESSION['userid'])) {
header('Location: /');
exit;
} else {
//Теперь при вызове этой функции для закрытия части сайта
//мы можем сразу забрать данные о пользователе. В userspace продолжение
getUserById($_SESSION['userid']);
}
}
示例3: extractLogins
function extractLogins($prefix)
{
$prefixLen = strlen($prefix);
foreach ($_POST as $key => $value) {
$index = strpos($key, $prefix);
if ($index !== false) {
$userId = substr($key, $prefixLen);
$oneLogin = getUserById($userId);
$loginList[] = $oneLogin;
}
}
return $loginList;
}
示例4: sendConfirmationEmail
function sendConfirmationEmail($userID)
{
global $smarty;
$user = getUserById($userID);
$hash = getUserActivation($userID);
$to = $user["email"];
$subject = 'Please confirm your registration in Fastmarket';
$smarty->assign('user', $user["name"]);
$smarty->assign('hash', $hash);
$message = $smarty->fetch('emails/confirmationEmail.tpl');
$headers = "From: noreply@fastmarket.fe.up.pt\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers);
}
示例5: sendProductPriceChange
function sendProductPriceChange($userId, $productId)
{
global $smarty;
$user = getUserById($userId);
$userName = "André Freitas";
$link = "http://fastmarket.com";
$to = "p.andrefreitas@gmail.com";
$productName = "Ferrari 548";
$subject = 'Product changed price';
$smarty->assign('user', $userName);
$smarty->assign('link', $link);
$smarty->assign('productName', $productName);
$message = $smarty->fetch('emails/productPriceChange.tpl');
$headers = "From: noreply@fastmarket.fe.up.pt\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers);
}
示例6: page_admincontrol
function page_admincontrol()
{
global $admin_lang;
//
// get the coutnt of all pages
//
$sitedata_result = db_result("SELECT page_id FROM " . DB_PREFIX . "pages_content");
$page_count = mysql_num_rows($sitedata_result);
//
// get the count of all registered users
//
$users_result = db_result("SELECT user_id FROM " . DB_PREFIX . "users");
$users_count = mysql_num_rows($users_result);
//
// get the size of all tables with the prefix DB_PREFIX
//
$table_infos_result = db_result("SHOW TABLE STATUS");
$data_size = 0;
while ($table_infos = mysql_fetch_object($table_infos_result)) {
if (substr($table_infos->Name, 0, strlen(DB_PREFIX)) == DB_PREFIX) {
$data_size += $table_infos->Data_length + $table_infos->Index_length;
}
}
$out = "<h3>AdminControl</h3><hr />\r\n\t<table>\r\n\t\t<tr><td>" . $admin_lang['online since'] . "</td><td>#DATUM</td></tr>\r\n\t\t<tr><td>" . $admin_lang['registered users'] . "</td><td>" . $users_count . "</td></tr>\r\n\t\t<tr><td>" . $admin_lang['created pages'] . "</td><td>" . $page_count . "</td></tr>\r\n\t\t<tr><td>" . $admin_lang['database size'] . "</td><td>" . kbormb($data_size) . "</td></tr>\r\n\t</table>\r\n\t\r\n\t<h3>Aktuelle Besucher</h3><hr />\r\n\t<table>\r\n\t\t<tr>\r\n\t\t\t<td>" . $admin_lang['name'] . "</td>\r\n\t\t\t<td>" . $admin_lang['page'] . "</td>\r\n\t\t\t<td>" . $admin_lang['last action'] . "</td>\r\n\t\t\t<td>" . $admin_lang['language'] . "</td>\r\n\t\t\t<td>" . $admin_lang['ip'] . "</td>\r\n\t\t\t<td>" . $admin_lang['host'] . "</td>\r\n\t\t</tr>";
//output all visitors surfing on the site
$users_online_result = db_result("SELECT userid, page, lastaction, lang, ip, host FROM " . DB_PREFIX . "online");
while ($users_online = mysql_fetch_object($users_online_result)) {
if ($users_online->userid == 0) {
$username = $admin_lang['not registered'];
} else {
$username = getUserById($users_online->userid);
}
//
// FIXME: gethostbyaddr needes to much time if there are many users online
//
$out .= "\t\t\t<tr>\r\n\t\t\t<td>" . $username . "</td>\r\n\t\t\t<td><a href=\"index.php?page=" . $users_online->page . "\">" . $users_online->page . "</a></td>\r\n\t\t\t<td>" . date("d.m.Y H:i:s", $users_online->lastaction) . "</td>\r\n\t\t\t<td>" . $admin_lang[$users_online->lang] . "</td>\r\n\t\t\t<td>" . $users_online->ip . "</td>\r\n\t\t\t<td>" . $users_online->host . "</td>\r\n\t\t</tr>\r\n";
}
$out .= "</table>";
return $out;
}
示例7: getUserById
<?php
require_once __DIR__ . '/app/models/user.php';
//require_once __DIR__ . '/app/models/post.php';
require_once __DIR__ . '/libs/storage.php';
require_once __DIR__ . '/libs/viev.php';
$user = getUserById(isset($_GET['id']) ? $_GET['id'] : '');
if (!$user) {
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not found');
exit('Post not found!');
}
//var_dump($post);
?>
<!Doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php
echo $user['login'];
?>
</title>
</head>
<body>
<p>Имя пользователя: <?php
echo $user['login'];
?>
</p>
<p><?php
echo $post['login'];
?>
示例8: header
<?php
header('Content-Type: application/json');
include "../../include/dbcon.inc.php";
include "../../include/functions.php";
include "../../include/pm_functions.inc.php";
include "../../include/push_functions.inc.php";
$user_id = getUserIdFromToken($con, @$_POST["token"]);
$dog_id = $con->real_escape_string($_POST["dog_id"]);
$symptoms = $con->real_escape_string($_POST["symptoms"]);
$place_id = $con->real_escape_string($_POST["place_id"]);
$duedate = $con->real_escape_string($_POST["duedate"]);
$volume = $con->real_escape_string($_POST["volume"]);
$user = getUserById($user_id, $con);
$dog = getDogById($dog_id, $con);
$bloodtype = getBloodTypeById($dog["dog_bloodtype_id"], $con);
$bloodstores = getBloodStoreByBloodTypeId($dog["dog_bloodtype_id"], $con);
$result = 0;
if (sizeof($bloodstores) > 0) {
//Found Blood In Hospital Blood Store
//create bloodstore_id string
$bloodstore_ids = array();
foreach ($bloodstores as $key => $bloodstore) {
array_push($bloodstore_ids, $bloodstore["bloodstore_id"]);
}
$bloodstore_id = implode(",", $bloodstore_ids);
$con->query("INSERT INTO `request`(`request_id`, `from_user_id`, `for_dog_id`, `symptoms`, `place_id`," . " `duedate`, `request_type`, `bloodstore_id`, `created_time`, `amount_volume`) " . "VALUES (null,'{$user_id}','{$dog_id}','{$symptoms}','{$place_id}','{$duedate}',1,'{$bloodstore_id}',now(),'{$volume}')");
//save to db (request_type = 1)
$senthospital_id = array();
//store sent hospital id
$message = "การขอรับเลือดของ" . $dog["dog_name"] . " เมื่อ " . date("j") . " " . $thai_month_short_arr[date("n")] . " " . (date("Y") + 543) . " " . "พบเลือดกรุ๊ป " . $bloodtype["bloodtype_name"] . " ที่โรงพยาบาลดังนี้";
示例9: getUserById
<div class="score-tabs">
<div class="col-md-2"></div>
<div class="col-md-8"><ul class="gamepoint">
<li><a href="game-point-leader-board">All Time </a></li>
<li><a href="game-point-weekly-leader-board">This Week</a></li>
<li><a href="game-point-daily-leader-board">Today </a></li>
</ul></div>
<div class="clearfix"></div>
<div class="highscore">
<div class="row">
<div class="col-md-12">
<h3>Today Leaderboard</h3>
</div>
<?php
if (isset($_SESSION['user_loged_id'])) {
$user_information = getUserById($_SESSION['user_loged_id']);
$u_info = mysql_fetch_array($user_information);
$current_user = countDailyUserDailyPointByUserId($_SESSION['user_loged_id']);
if ($current_user > 0) {
$user_current_score = mysql_fetch_array($current_user);
}
$utilize = countUtilizeUserPointByUserId($_SESSION['user_loged_id']);
$utilize_point = mysql_fetch_array($utilize);
?>
<?php
if ($user_current_score['user_id'] > 0) {
?>
<div class="bdr-bot-red">
<div class="col-md-1 nopad-right">
<img src="user_images/<?php
echo $u_info['photo'];
示例10: session_start
<?php
session_start();
include "dbconnection.php";
if (isset($_SESSION['user_loged_id'])) {
$session_id = $_SESSION['user_loged_id'];
$user_detail = getUserById($_SESSION['user_loged_id']);
$user = mysql_fetch_array($user_detail);
} else {
header("location:maverick-game-user-login");
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Purchase Coins | Maverick Game</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="shortcut icon" href="favicon.png" type="image/x-icon"/>
<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Didact+Gothic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="assets/css/style.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="assets/js/jquery.min.js" type="text/javascript"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/script.js"></script>
<!--[if lt IE 9]>
<script src="http://css3-mediaqueries-js.googlecode.com/files/css3-mediaqueries.js"></script>
<script src="/assets/js/respond.min.js"></script>
<![endif]-->
示例11: getAllNotificationGames
</a>
<ul class="dropdown-menu">
<li class="header">You have <?php
echo $total_game_comment['game_comment_id'];
?>
Game Comments Notification</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<?php
$games_notification = getAllNotificationGames($last_game['game_comment_id']);
if ($games_notification) {
while ($game_notification = mysql_fetch_array($games_notification)) {
$games_users = getUserById($game_notification['user_id']);
$game_user = mysql_fetch_array($games_users);
?>
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<?php
if ($rhyme_user['userimages'] != '') {
?>
<img src="../userimages/<?php
echo $game_user['userimages'];
?>
" class="img-circle" alt="User Image"/>
<?php
示例12: getReplyByThreadByReply
?>
</div>
</div>
<?php
}
}
?>
<?php
$get_reply = getReplyByThreadByReply($thread_id);
if ($get_reply > 0) {
while ($reply_get = mysql_fetch_array($get_reply)) {
$thread_user = getUserById($reply_get['user_id']);
$userthread = mysql_fetch_array($thread_user);
?>
<div class="col-md-12 postdtl">
<div class="col-md-3 post-display">
<?php
if ($userthread['user_name'] != "") {
?>
<h3> <?php
echo $userthread['user_name'];
?>
</h3>
<?php
} else {
?>
示例13: explode
?>
<input type="hidden" name="imgName" id="imgName" value="<?php
if (isset($imgname)) {
echo $imgname;
}
?>
" />
</form>
<?php
if (isset($_REQUEST['update'])) {
$imgNames = $_POST['imgNames'];
$user_crop_image = $imgNames;
$user_crop_image = explode("/", $imgNames);
$profile_img_query = mysql_query("UPDATE glogin_users SET photo='{$user_crop_image['1']}' WHERE id='{$session_id}'");
unset($_SESSION['loged_user_image']);
$users = getUserById($session_id);
$user = mysql_fetch_array($users);
$_SESSION['loged_user_image'] = $user['photo'];
//echo "<strong style='background-color:green'; color:#fff; font-size:12px; padding:3px 5px'>Your Profile Picture has been Update Sucessfully</strong>";
echo "<script type='text/javascript'>\n\t\t\t\t\t\ttop.location.href = 'user-profile.php';\n\t\t\t\t\t\t</script>";
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
示例14: updateUser
function updateUser($userId, $name, $email, $password, $privilegeId)
{
$sql = "UPDATE users " . "SET name = ?, email = ?, password = ?, privilege_id=? " . "WHERE id = ?";
$sqlVars = array($name, $email, $password, $privilegeId, $userId);
return getUserById($userId) ? query($sql, $sqlVars) : false;
}
示例15: session_start
<?php
session_start();
if (isset($_POST['submit'])) {
include "dbconnection.php";
$puzzle_id = mysql_real_escape_string($_POST['puzzle_id']);
$rhymes = getPuzzleById($puzzle_id);
$rhyme = mysql_fetch_array($rhymes);
$rhyme_seo = $rhyme['seo_puzzle'];
if (isset($_SESSION['user_id'])) {
$users = getUserById($_SESSION['user_id']);
$user = mysql_fetch_array($users);
$comments = mysql_real_escape_string($_POST['comments']);
addPuzzleComments($puzzle_id, $comments, $_SESSION['user_id']);
$base_url = "http://thefunkids.com/admin";
$subject = "Comments on Rhymes for Moderation";
$from = "info@thefunskids.com";
$to = "raheelaslam@golive.com.pk";
$mail_body = "Dear All,<br/><br/> A comment has been posted on our website TheFunKids.com and is pending approval. Kindly review and <br /><br /> moderate whether the comment should be posted or not.<br /><br /><br/>Login Url:<a href=" . $base_url . ">" . $base_url . "</a><br/><br/><strong>User Name:</strong>admin@thefunkids.com<br><strong>Password:</strong>admin123<br/></br>Regards & Love<br/><br/>The Fun Kids Team";
$body = wordwrap($mail_body, 2000);
//$body_user = wordwrap($mail_body_user,70);
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: " . $from . "\r\n";
$headers .= 'Bcc:amohsin@golive.com.pk,saher@golive.com.pk' . "\r\n";
//------------------------Thanks You Email-------------------------------------------------------------------
mail($to, $subject, $mail_body, $headers);
header("location:kid-puzzle-{$rhyme_seo}&comment#puzzles");
} elseif (isset($_SESSION['FBID'])) {
$user_facebook_id = getUserByFaceBookId($_SESSION['FBID']);
if ($user_facebook_id) {