本文整理汇总了PHP中getUsers函数的典型用法代码示例。如果您正苦于以下问题:PHP getUsers函数的具体用法?PHP getUsers怎么用?PHP getUsers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUsers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendGCM
function sendGCM($message, $db)
{
// Replace with real BROWSER API key from Google APIs
$apiKey = "Your API Key";
// Replace with real client registration IDs
$registrationIDs = getUsers($db);
// Message to be sent
//$message = "x";
// Set POST variables
$url = 'https://android.googleapis.com/gcm/send';
$fields = array('registration_ids' => $registrationIDs, 'data' => array("message" => $message));
$headers = array('Authorization: key=' . $apiKey, 'Content-Type: application/json');
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
// Close connection
curl_close($ch);
return $result;
}
示例2: getUserRanking
function getUserRanking($idSelected)
{
$users = getUsers();
$ranking = initialRanking();
$result = runQuery('SELECT userId, matchId, coteResult, coteScore, round,
bet.scoreDomicile AS betScoreDomicile,
bet.scoreExterieur AS betScoreExterieur,
result.scoreDomicile AS resultScoreDomicile,
result.scoreExterieur AS resultScoreExterieur
FROM bet
INNER JOIN result WHERE id IN (' . implode(',', $idSelected) . ') AND bet.matchId = result.id');
foreach ($result as $row) {
//Variable sql
$userId = intval($row['userId']);
$coteResult = floatval($row['coteResult']);
$coteScore = floatval($row['coteScore']);
$round = intval($row['round']);
$betScoreDomicile = intval($row['betScoreDomicile']);
$betScoreExterieur = intval($row['betScoreExterieur']);
$resultScoreDomicile = intval($row['resultScoreDomicile']);
$resultScoreExterieur = intval($row['resultScoreExterieur']);
if ($resultScoreDomicile >= 0) {
//Variable de calcul
$scorePoint = 0;
if ($betScoreDomicile == $resultScoreDomicile && $betScoreExterieur == $resultScoreExterieur) {
$scorePoint = $coteScore;
}
$betPoint = 0;
if ($betScoreDomicile > $betScoreExterieur && $resultScoreDomicile > $resultScoreExterieur || $betScoreDomicile == $betScoreExterieur && $resultScoreDomicile == $resultScoreExterieur || $betScoreDomicile < $betScoreExterieur && $resultScoreDomicile < $resultScoreExterieur) {
$betPoint = $coteResult;
}
$ranking[$userId]['betCount']++;
$ranking[$userId]['betWon'] += $betPoint > 0 ? 1 : 0;
$ranking[$userId]['betPoint'] += $betPoint;
$ranking[$userId]['scoreWon'] += $scorePoint > 0 ? 1 : 0;
$ranking[$userId]['scorePoint'] += $scorePoint;
$ranking[$userId]['globalPoint'] += $betPoint + $scorePoint;
}
}
$sortedranking = array_values($ranking);
usort($sortedranking, 'compareUserPoint');
$currentRanking = 0;
$currentScore = 0;
$index = 0;
foreach ($sortedranking as $row) {
$index++;
if ($currentRanking == 0) {
$currentRanking = 1;
$currentScore = $row['globalPoint'];
}
if ($currentScore != $row['globalPoint']) {
$currentRanking = $index;
$currentScore = $row['globalPoint'];
}
$ranking[$row['userId']]['rank'] = $currentRanking;
}
$ranking = array_values($ranking);
usort($ranking, 'compareUserRanking');
return $userRanking = array('ranking' => $ranking);
}
示例3: deleteUser
function deleteUser($id)
{
$fileFunctions = new FileFunctions();
$users = getUsers();
unset($users[$id]);
$fileFunctions->serializeUsers($users);
//var_dump($fileFunctions);
}
示例4: loginUser
/**
* login mechanism
*/
function loginUser()
{
// find user in the db
$user = getUsers()[$_POST['email']];
// compare hashes; set cookie; and refresh the page
if (md5($_POST['pass']) === $user['pass']) {
setcookie('proxy', base64_encode($user['email']) . '.' . base64_encode($user['pass']), false, '/');
header('Location: ' . $_SERVER['REQUEST_URI']);
} else {
die(file_get_contents('login/login_error.html'));
}
}
示例5: deleteUser
function deleteUser($id)
{
$sql = "DELETE FROM users WHERE id=:id";
try {
$db = getConnection();
$stmt = $db->prepare($sql);
$stmt->bindParam("id", $id);
$stmt->execute();
getUsers();
} catch (PDOException $e) {
echo '{"error":{"text":' . $e->getMessage() . '}}';
}
}
示例6: getUsers
<?php
/**
* Created by ChenguangBai
* Date: 2016/3/3
*/
include_once "../dao/DBHelper.php";
include_once "../dao/getUsers.php";
$page = $_GET['page'];
$maxSize = $_GET['maxSize'];
$result = getUsers($page - 1, $maxSize);
$users = array();
while ($row = mysql_fetch_array($result)) {
$temp = array();
$temp['uid'] = $row['uid'];
$temp['userName'] = $row['username'];
$temp['firstName'] = $row['firstName'];
$temp['lastName'] = $row['lastName'];
array_push($users, $temp);
}
echo json_encode($users);
示例7: parameters
KalturaLog::log('Saving partner [' . $partner->getId() . '] with account owner kuser ID [' . $partner->getAccountOwnerKuserId() . ']');
$partner->save();
} else {
KalturaLog::log('DRY RUN - records are not being saved: ');
KalturaLog::log('New user_login_data with the following parameters: ');
KalturaLog::log(print_r($new_login_data, true));
KalturaLog::log('Newkuser with the following parameters (login_data_id unknown): ');
KalturaLog::log(print_r($new_kuser, true));
KalturaLog::log('DRY RUN - saving partner [' . $partner->getId() . '] with account owner kuser ID [' . $partner->getAccountOwnerKuserId() . ']');
}
file_put_contents($lastUserFile, $lastUser);
}
kuserPeer::clearInstancePool();
PartnerPeer::clearInstancePool();
UserLogindataPeer::clearInstancePool();
$users = getUsers($lastUser, $userLimitEachLoop);
}
$msg = 'Done - ' . ($dryRun ? 'DRY RUN!' : 'REAL RUN!');
KalturaLog::log($msg);
echo $msg;
function getUsers($lastUser, $userLimitEachLoop)
{
adminKuserPeer::clearInstancePool();
$c = new Criteria();
$c->add(adminKuserPeer::ID, $lastUser, Criteria::GREATER_THAN);
$c->addAscendingOrderByColumn(adminKuserPeer::ID);
$c->setLimit($userLimitEachLoop);
adminKuserPeer::setUseCriteriaFilter(false);
$users = adminKuserPeer::doSelect($c);
adminKuserPeer::setUseCriteriaFilter(true);
return $users;
示例8: unset
$query_upd = $db->query("UPDATE `users` SET `photo`= null,`modiff`=NOW(),`modiff_uid`='{$admin_id}' WHERE `uid`={$uid}");
if ($query_upd) {
$result['success'] = true;
unset($result['msg']);
}
break;
case 'getUserInfo':
require_once "../vendor/autoload.php";
// Twig инициализация
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem("../templates/users");
// Twig папка с шаблонами
$twig = new Twig_Environment($loader, array("cache" => ""));
// Twig no cache
$uid = $_POST['user_id'];
$query_info = "SELECT\r\n u.`uid`,\r\n DATE_FORMAT(u.`modiff`,'%d.%m.%Y %H:%i:%s') as `modiff`,\r\n (SELECT CONCAT(`lastname`,' ',`firstname`) FROM users WHERE `uid`=u.`modiff_uid`) AS `modiff_user`,\r\n u.`status_id`,\r\n (SELECT `name` FROM users_statuses WHERE users_statuses.`id`=u.`status_id`) AS `status`,\r\n u.`lastname`,\r\n u.`firstname`,\r\n u.`middlename`,\r\n u.`login`,\r\n u.`login_ae`,\r\n u.`pass`,\r\n u.`photo`,\r\n u.`phone` as `tel`,\r\n u.`skud`,\r\n u.`email`,\r\n u.`comment`,\r\n u.`area_id`,\r\n (SELECT `name` FROM areas WHERE areas.`id`=u.`area_id`) AS `area`,\r\n (SELECT `name` FROM depts WHERE depts.`id`=u.`dept_id`) AS `dept`,\r\n (SELECT `name` FROM posts WHERE posts.`id`=u.`post_id`) AS `post`,\r\n (SELECT `name` FROM organizations WHERE organizations.`id`=u.`organization_id`) AS `organization`,\r\n (SELECT `workstation` FROM `sessions_users` WHERE `id`='{$uid}') as `workstation_id`,\r\n (SELECT `ip` FROM `workstations` WHERE `id`=`workstation_id`) as `logon_ip`,\r\n (SELECT `name` FROM `workstations` WHERE `id`=`workstation_id`) as `workstation`,\r\n (SELECT `domain` FROM `sessions_users` WHERE `id`='{$uid}') as `domain`,\r\n (SELECT `time` FROM `sessions_users` WHERE `id`='{$uid}') as `logon_time`\r\n FROM users AS u WHERE u.`uid`='{$uid}'";
if ($query_info_res = $db->query($query_info)) {
$user_data = $db->fetch_assoc($query_info_res);
}
$user_data['users'] = getUsers();
$user_data['permissions'] = getPermissions($admin_login["uid"], $user_data['users']);
$result['user_info'] = $twig->render('user_info.twig', $user_data);
break;
}
/* Возвращаем результат также в виде JSON-объекта.
* В случае безошибочного получения результата,
* Делаем $result['success'] = true;
* Остальные параметры - опциональные
* */
print_r(json_encode($result));
}
示例9: getUsers
<?php
include_once 'include/view-helper.php';
// Recupère les utilisateurs dans la bdd
$users = getUsers();
head();
?>
<h1>Utilisateurs</h1>
<table>
<tr>
<th>#</th>
<th>Nom</th>
<th>Prénom</th>
<th>Pseudo</th>
<th>Action</th>
</tr>
<?php
foreach ($users as $user) {
echo '<tr>';
$td = '<td>%s</td>';
// On va l'utiliser plusieurs fois, donc on le stocke
$uid = $user['user_id'];
// Les données
echo sprintf($td, $uid);
echo sprintf($td, $user['user_name']);
echo sprintf($td, $user['user_firstname']);
echo sprintf($td, $user['user_username']);
$link = '<a href="%s?id=' . $uid . '">%s</a> ';
// Les liens
$links = sprintf($link, 'show-user.php', 'Détail');
// S'il s'agit de l'utilisateur courant ou d'un admin
示例10: unset
<?php
include '../include/webzone.php';
if (is_admin() && $GLOBALS['demo_mode'] != 1) {
unset($_SESSION['ygp_fb_box']);
$user_id = $_GET['id'];
$type = 1;
$users = getUsers(array('user_id' => $user_id, 'type' => $type));
if (count($users) > 0) {
$u1 = new MySqlTable();
$sql = 'DELETE FROM ' . $GLOBALS['db_table']['users'] . ' WHERE user_id="' . $u1->escape($user_id) . '" AND type="' . $type . '"';
$u1->executeQuery($sql);
}
}
header('Location: ../');
示例11: array
{
$tr = array("А" => "A", "Б" => "B", "В" => "V", "Г" => "G", "Д" => "D", "Е" => "E", "Ё" => "E", "Ж" => "ZH", "З" => "Z", "И" => "I", "Й" => "Y", "К" => "K", "Л" => "L", "М" => "M", "Н" => "N", "О" => "O", "П" => "P", "Р" => "R", "С" => "S", "Т" => "T", "У" => "U", "Ф" => "F", "Х" => "H", "Ц" => "TS", "Ч" => "CH", "Ш" => "SH", "Щ" => "SCH", "Ъ" => "", "Ы" => "YI", "Ь" => "", "Э" => "E", "Ю" => "YU", "Я" => "YA", "а" => "a", "б" => "b", "в" => "v", "г" => "g", "д" => "d", "е" => "e", "ё" => "e", "ж" => "zh", "з" => "z", "и" => "i", "й" => "y", "к" => "k", "л" => "l", "м" => "m", "н" => "n", "о" => "o", "п" => "p", "р" => "r", "с" => "s", "т" => "t", "у" => "u", "ф" => "f", "х" => "h", "ц" => "ts", "ч" => "ch", "ш" => "sh", "щ" => "sch", "ъ" => "y", "ы" => "yi", "ь" => "", "э" => "e", "ю" => "yu", "я" => "ya");
return strtr($str, $tr);
}
function generate_password($length)
{
$pass = "";
$arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
for ($i = 0; $i < $length; $i++) {
$index = rand(0, count($arr) - 1);
// Случайный индекс массива
$pass .= $arr[$index];
}
return $pass;
}
$users = getUsers(true);
foreach ($users as $id => $user) {
$users[$id]["permissions"] = 33;
$users[$id]["login"] = mb_strtolower(translit(mb_substr($user["firstname"], 0, 1, "UTF-8") . $user["lastname"]));
$users[$id]["login_ae"] = mb_strtoupper(mb_substr($user["firstname"], 0, 1, "UTF-8") . mb_substr($user["middlename"], 0, 1, "UTF-8") . $user["lastname"], "UTF-8");
$users[$id]["email"] = $users[$id]["login"] . "@megacorp.com";
$users[$id]["password"] = generate_password(8);
$query = "UPDATE users SET\r\n `login`='" . $users[$id]["login"] . "',\r\n `login_ae`='" . $users[$id]["login_ae"] . "',\r\n `pass`='" . $users[$id]["password"] . "',\r\n `email`='" . $users[$id]["email"] . "'\r\n WHERE `uid`={$id}";
// echo "\n\n";
$query_upd = $db->query($query);
if ($query_upd) {
echo 1;
}
}
//print_r($users);
print_r($db->error());
示例12: addUser
// add user to db
$result = addUser($post);
if (!$result) {
$data = 'Tekrar deniyiniz!';
header('HTTP/1.1 405 Reset Content');
Output::error($data);
} else {
$data = getUser($result);
header('HTTP/1.1 201 Created');
Output::success($data);
}
}
// get users
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$data = getUsers();
header('HTTP/1.1 200 OK');
Output::success($data);
} else {
header('HTTP/1.1 405 Method Not Allowed');
header('Allow: GET, POST');
Output::error('Method not exist');
}
}
}
break;
case 'login':
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$post = json_decode(file_get_contents("php://input"), true);
// die(var_dump($post));
// TODO:: Validate post
示例13: notification
<?php
include '_php/functions.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>The Guru Coder - Tutorial 2 How to code a PHP Connection Class</title>
<link rel="stylesheet" href="_style/main.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="_scripts/functions.js"></script>
</head>
<body>
<div id="container">
<?php
notification();
?>
<h1>The Guru Coder</h1>
<h2>Tutorial 2 - Code a PHP Connection Class</h2>
<?php
getUsers();
?>
</div>
</body>
</html>
示例14: while
while ($stmt->fetch()) {
$results[$i]['id'] = $id;
$results[$i]['username'] = $username;
$results[$i]['email'] = $email;
$results[$i]['firstname'] = $firstname;
$results[$i]['lastname'] = $lastname;
$results[$i]['role'] = $role;
$results[$i]['date_created'] = $date_created;
$results[$i]['is_valid'] = $is_valid;
$i++;
}
$stmt->close();
$mysqli->close();
return $results;
}
$users = getUsers($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
?>
<html>
<head>
<title>List Users</title>
<?php
include 'includes/head.php';
?>
</head>
<body>
<section>
<div class="row">
<div class="large-12 columns">
<a href="dashboard.php">Home</a>
<h1>Users</h1>
<a href="user-add.php">Add User</a>
示例15: undeleteUser
function undeleteUser()
{
global $error;
global $obj_smarty;
$arr_submit = array(array('uid', 'int', true, ''));
$frm_submitted = validate_var($arr_submit);
if (User::isAdminUser($frm_submitted['uid'])) {
$bln_success = User::undeleteUser($frm_submitted['uid']);
if ($bln_success) {
$obj_smarty->assign('msg', 'User is back again');
}
$arr_users = getUsers();
$obj_smarty->assign('users', $arr_users);
$obj_smarty->assign('active', 'users');
} else {
$obj_smarty->assign('error', 'NO rights to undelete this user');
}
$obj_smarty->display(FULLCAL_DIR . '/view/user_panel.tpl');
exit;
}