本文整理汇总了PHP中user::getFromDB方法的典型用法代码示例。如果您正苦于以下问题:PHP user::getFromDB方法的具体用法?PHP user::getFromDB怎么用?PHP user::getFromDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::getFromDB方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConversationList
function getConversationList()
{
if (isset($_SESSION['userid'])) {
$users = array();
$userid;
$dbhandle = db_connect();
$stmt = $dbhandle->stmt_init();
//We must search both people who messaged you AND people you messaged
//Ensure no duplicates
$stmt->prepare("SELECT Distinct UserID FROM(\n\t\t\t\t\t\t(SELECT SenderID AS UserID, Time FROM Messages WHERE ReceiverID = ?)\n\t\t\t\t\t\tUNION ALL\n\t\t\t\t\t\t(SELECT ReceiverID AS UserID, Time FROM Messages WHERE SenderID = ?)\n\t\t\t\t\t\tORDER BY Time desc\n\t\t\t\t\t\t)t ");
$stmt->bind_param("ii", $_SESSION['userid'], $_SESSION['userid']);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($userid);
//Add each resulting user to the array to return
while ($stmt->fetch()) {
$user = new user();
$user->getFromDB($userid);
array_push($users, $user);
}
$stmt->close();
$dbhandle->close();
return $users;
}
}
示例2: user
<?php
require_once 'user_class.php';
if (isset($_POST['UserID']) && isset($_REQUEST['Img'])) {
$userid = $_POST['UserID'];
$image = $_REQUEST['Img'];
$user = new user();
$user->getFromDB($userid);
$avatarfilepath = '/var/www/html/images/avatars/';
$avatarfilename = $avatarfilepath . $user->userid . '.jpg';
header('Content-Type: bitmap; charset=utf-8');
$imagefile = fopen($avatarfilename, 'wb');
fwrite($imagefile, base64_decode($image));
fclose($imagefile);
$allowedext = array("jpg");
//if(exif_imagetype != IMAGETYPE_JPEG)
$result = null;
if (!in_array(pathinfo($avatarfilename, PATHINFO_EXTENSION), $allowedext)) {
$result['errorFileNotJPG'] = true;
unlink($avatarfilename);
} else {
}
//$result = $user->DEBUGuploadAvatar($imagefile);
if ($result == null) {
$result['success'] = true;
}
echo json_encode($result);
} else {
$error['error'] = true;
$error['UserID or Img not set'] = true;
echo json_encode();
示例3: user
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
require_once 'php/user_class.php';
require_once 'php/task_class.php';
require_once 'php/review_class.php';
require_once 'php/lister.php';
if (!isset($_GET['id'])) {
die;
}
$user = new user();
$user->getFromDB($_GET['id']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- Raty Resources -->
<link rel="stylesheet" href="/lib/jquery.raty.css">
<script src="vendor/jquery.js"></script>
<script src="lib/jquery.raty.js"></script>
示例4: user
<?php
require_once 'user_class.php';
require_once 'lister.php';
$user = new user();
if (isset($_POST['userid'])) {
$user->getFromDB($_POST['userid']);
$userout = array();
$userout['Username'] = $user->username;
$userout['AvatarURL'] = $user->avatarurl;
$listerreviews = listReviewsByTime($_POST['userid']);
$doerreviews = listDoReviewsByTime($_POST['userid']);
$userout['ListerReviews'] = $listerreviews;
$userout['DoerReviews'] = $doerreviews;
echo json_encode($userout);
}
示例5: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "add_user_group":
case "add_supervisor_group":
case "add_delegatee_group":
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
if (isset($input['users_id'])) {
// Add users to groups
$input2 = array('groups_id' => $key, 'users_id' => $input['users_id']);
} else {
if (isset($input['groups_id'])) {
// Add groups to users
$input2 = array('groups_id' => $input["groups_id"], 'users_id' => $key);
} else {
return false;
}
}
$updateifnotfound = false;
if ($input["action"] == 'add_supervisor_group') {
$input2['is_manager'] = 1;
$updateifnotfound = true;
}
if ($input["action"] == 'add_delegatee_group') {
$input2['is_userdelegate'] = 1;
$updateifnotfound = true;
}
$group = new Group();
$user = new user();
if ($group->getFromDB($input2['groups_id']) && $user->getFromDB($input2['users_id'])) {
if ($updateifnotfound && $this->getFromDBForItems($user, $group)) {
if ($this->can($this->getID(), 'w')) {
$input2['id'] = $this->getID();
if ($this->update($input2)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
} else {
if ($this->can(-1, 'w', $input2)) {
if ($this->add($input2)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
} else {
$res['ko']++;
}
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例6: printMessages
function printMessages($messages)
{
foreach ($messages as $message) {
$msguser = new user();
$msguser->getFromDB($message->senderID);
if ($message->senderID == $_SESSION['userid']) {
echo '<li class="server">';
} else {
echo '<li class="client">';
}
?>
<!-- links to UserProfile.php?id={userid} -->
<a href="UserProfile.php?id=<?php
echo $msguser->userid;
?>
" title>
<!-- Use php to change alt="" to show actual username -->
<div class="avatar_small">
<img class = "resize_fit_center" src="<?php
echo $msguser->getAvatarURL();
?>
">
</div>
</a>
<div class="message-area">
<span class="pointer"></span>
<div class="info-row">
<span class="user-name">
<!-- Should also link to UserProfile.php?id= -->
<a href="UserProfile.php?id=<?php
echo $msguser->userid;
?>
">
<!-- Username or first name of user -->
<strong><?php
echo $msguser->username;
?>
</strong>
</a>
says:
</span>
<!-- Time message was sent -->
<span class="time">
<?php
echo date("M j, Y g:i:s A", $message->timestamp);
?>
</span>
<div class="clear"></div>
</div>
<!-- User message -->
<p><?php
echo $message->content;
?>
</p>
</div>
</li>
<?php
}
}
示例7: user
<?php
session_start();
if (isset($_POST['submit']) && isset($_SESSION['userid'])) {
require_once 'php/user_class.php';
$user = new user();
$user->getFromDB($_SESSION['userid']);
$user->uploadAvatar($_FILES['imageinputav']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<title>Task Master</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- CSS -->
<link href="../assets/css/bootstrap.css" rel="stylesheet">
<style type="text/css">
示例8: array
require_once 'message_class.php';
require_once 'user_class.php';
require_once 'db_connect.php';
$out = array();
if (isset($_SESSION['userid'])) {
$dbhandle = db_connect();
$stmt = $dbhandle->stmt_init();
$stmt->prepare("SELECT MessageID, Time, SenderID, ReadFlag, Content, TaskID FROM Messages WHERE (ReceiverID=?)");
$stmt->bind_param("i", $_SESSION['userid']);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($messageid, $temptime, $senderid, $readflag, $content, $taskid);
$i = 0;
while ($stmt->fetch()) {
$sender = new user();
$sender->getFromDB($senderid);
$message = array();
$message['MessageID'] = $messageid;
$message['Time'] = $temptime;
$message['SenderID'] = $senderid;
$message['SenderUsername'] = $sender->username;
$message['Read'] = $readflag;
$message['Content'] = $content;
$message['TaskID'] = $taskid;
$out[$i] = $message;
$i++;
}
$stmt->close();
$dbhandle->close();
} else {
$out['error'] = true;
示例9: user
$taskout['Description'] = $task->description;
$taskout['Location'] = $task->location;
$taskout['Category'] = $task->category;
$taskout['Tags'] = $task->tags;
$taskout['NumImages'] = $task->numimg;
$taskout['CurrentBid'] = $task->getCurrentBid();
$taskout['EndDateTime'] = $task->enddatetime;
$taskout['HighestBidderID'] = $task->winnerid;
if ($taskout['HighestBidderID'] != null) {
$winner = new user();
$winner->getFromDB($taskout['HighestBidderID']);
$taskout['HighestBidderUsername'] = $winner->username;
}
//Get user info
$lister = new user();
if ($lister->getFromDB($task->userid) == null) {
$taskout['ListerUsername'] = $lister->username;
$taskout['ListerAvatarURL'] = $lister->getAvatarURL();
//$taskout['ListerAvatarURL']=$lister->DEBUGgetAvatarURL();
$rating = $lister->getListerRating();
$taskout['ListerRating'] = $rating['rating'];
$taskout['ListerRatingWeight'] = $rating['weight'];
} else {
$taskout['ErrorUserNotFound'] = true;
$taskout['error'] = true;
}
echo json_encode($taskout);
} else {
$error['error'] = true;
echo json_encode($error);
}
示例10: array
require_once 'php/task_class.php';
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
$intaskid;
if (isset($_GET['id'])) {
$intaskid = $_GET['id'];
}
$error = array();
$task = new task();
$error = $task->getFromDB($intaskid);
if (count($error) == 0) {
require_once 'php/user_class.php';
$user = new user();
$user->getFromDB($task->userid);
$date = new DateTime();
$date->setTimestamp($task->enddatetime);
$dateStr = $date->format('m/d/Y g:i A');
} else {
$_SESSION['msg_badtaskid'] = "Bad task id";
}
if (isset($_POST['submit'])) {
$biderror = array();
if (isset($_SESSION['userid'])) {
$biderror = $task->addBid($_SESSION['userid'], $_POST['Bid']);
} else {
$_SESSION['msg_needlogin'] = "Log in to bid";
}
if (count($biderror) == 0) {
$_SESSION['msg_bidplaced'] = "Bid Placed";