本文整理汇总了PHP中UserClass类的典型用法代码示例。如果您正苦于以下问题:PHP UserClass类的具体用法?PHP UserClass怎么用?PHP UserClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler
function handler()
{
$messages = parent::handler();
$_USER = UserClass::getById($this->_FORMDATA["id"]);
if ($messages["status"] == "success" && !empty($this->_FORMDATA)) {
foreach ($this->_FORMDATA as $name => $value) {
if ($name == "email" && $value != $_USER->getProperty("email")) {
$user = UserClass::getByEmail($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким email уже зарегистрирован";
}
} else {
if ($name == "login" && $value != $_USER->getProperty("login")) {
$user = UserClass::getByLogin($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким логином уже зарегистрирован";
}
}
}
}
if ($error_message) {
$messages["status"] = "error";
$messages["error"] = $error_message;
unset($messages["success"]);
} else {
$arFields = array("id" => $this->_FORMDATA["id"], "login" => $this->_FORMDATA["login"], "email" => $this->_FORMDATA["email"], "full_name" => $this->_FORMDATA["full_name"], "pass" => $this->_FORMDATA["pass"], "active" => 1);
UserClass::updateUser($arFields);
$messages["success"] = "Информация обновлена.";
}
}
return $messages;
}
示例2: handler
function handler()
{
$messages = parent::handler();
if ($messages["status"] == "success" && !empty($this->_FORMDATA)) {
foreach ($this->_FORMDATA as $name => $value) {
if ($name == "email") {
$user = UserClass::getByEmail($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким email уже зарегистрирован";
}
} else {
if ($name == "login") {
$user = UserClass::getByLogin($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким логином уже зарегистрирован";
}
}
}
}
if ($error_message) {
$messages["status"] = "error";
$messages["error"] = $error_message;
unset($messages["success"]);
} else {
$arFields = array("login" => $this->_FORMDATA["login"], "email" => $this->_FORMDATA["email"], "full_name" => $this->_FORMDATA["full_name"], "pass" => $this->_FORMDATA["pass"], "active" => false, "code" => md5(date("Y-m-d H:i:s")));
UserClass::createUser($arFields);
$messages["success"] = "Спасибо за регистрацию. На Ваш email выслано письмо для активации аккаунта.";
MailController::RegisterMail($this->_FORMDATA["email"], $arFields["code"]);
}
}
return $messages;
}
示例3: index
function index()
{
require_once '../../Model/UserClass.php';
global $connection;
global $navegador;
global $navegadorAdmin;
$titulo = 'Titulo';
$description = 'description';
$palabrasClaves = 'palabrasClaves';
// Obtener type user
$user = new UserClass($connection);
$user->fetch($_SESSION['idRow']);
$userType = $user->roll;
// $userType = 'user';
if ($userType == '0') {
require_once '../../View/Back/home.php';
} elseif ($userType == '1') {
$navegador = $navegadorAdmin;
require_once '../../View/Back/homeAdmin.php';
}
}
示例4: get_comments
public function get_comments($act_id)
{
$query_str = "select * from cs_activity_comment where act_id={$act_id} order by create_at desc;";
$result = $this->dbObj->query($query_str);
$array = array();
if (is_object($result)) {
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$array[] = $row;
}
}
}
$userObj = new UserClass();
foreach ($array as $key => $item) {
$author_id = $item['author_id'];
$query_str = "select name from cs_user where uid={$author_id};";
$user = $this->dbObj->query($query_str)->fetch_assoc();
$array[$key]['author_name'] = $user['name'];
$array[$key]['author_avatar'] = $userObj->get_avatar($author_id);
$array[$key]['create_at'] = $this->encode_time($item['create_at']);
}
return $array;
}
示例5: handler
function handler()
{
$messages = parent::handler();
if ($messages["status"] == "success" && !empty($this->_FORMDATA)) {
$user = UserClass::auth($this->_FORMDATA["login"], md5($this->_FORMDATA["pass"]));
if (!$user) {
$messages["status"] = "error";
$messages["error"][] = "Неправильный логин или пароль";
unset($messages["success"]);
} else {
if ($user->getProperty("active") == false) {
$messages["status"] = "error";
$messages["error"][] = "Аккаунт неактивен";
unset($messages["success"]);
} else {
$messages["success"] = "Вы авторизованы.";
$this->redirect();
}
}
}
return $messages;
}
示例6: createUser
/**
* 建立用户
*/
public function createUser()
{
if ($this->getR('pwd') != $this->getR('pwd1')) {
return array('status' => -1, 'info' => '密码不一致', 'data' => null);
}
$this->_modelUser = $this->getGlobal('model/User', 'Model_User');
if ($this->_modelUser->findByUser($this->getR('user'))) {
return array('status' => -1, 'info' => '此账号已存在', 'data' => null);
}
$userArr = array('user' => $this->getR('user'), 'vuser' => $this->getR('vuser'), 'pwd' => $this->convertPwd($this->getR('pwd')));
if ($this->_modelUser->insert($userArr)) {
$userArr['id'] = $this->_modelUser->getLastInsertId();
import('object/UserClass');
$userClass = new UserClass();
$userClass->create($userArr);
$userClass->setUpdate(true);
$userClass = null;
unset($userClass);
return array('status' => 1, 'info' => '创建用户成功', 'data' => null);
} else {
return array('status' => -2, 'info' => '创建用户失败', 'data' => null);
}
}
示例7: config
<?php
include '../config.php';
include '../webappClass/UserClass.php';
$configobj = new config();
$conn = $configobj->getConnection();
$userobj = new UserClass();
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$loginid = $request->loginid;
$password = $request->password;
echo json_encode($userobj->userLogin($conn, $loginid, $password));
示例8: UserClass
//echo $msg;
}
else
{
$msg="Please enter CLIENT-ID.";
}
}
$objUser1=new UserClass($db);
$objUser1->id=$_SESSION['login'];
$arrUser1=$objUser1->SearchUser();
$objCoustodyAC=new Custody_ACClass($db);
$objCoustodyAC->id_client=$arrUser1[0]['id'];
$arrCustodyAC=$objCoustodyAC->SearchCustody_AC();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
示例9: getCode
{
if ($sName === "Breves" && $sPassword === "123") {
$this->sName = $sName;
$this->iCode = 1;
$this->sEmail = "aa.breves@outlook.com";
}
/* if ( $sName === "Breves" && $sPassword === "123" ) */
}
/* private function login( $sName, $sPassword ) */
function getCode()
{
return $this->iCode;
}
/* function getCode() */
function getName()
{
return $this->sName;
}
/* function getName() */
function getEmail()
{
return $this->sEmail;
}
}
/* class UserClass */
/* ********************************************************* */
$usrUser = new UserClass("Breves", "123");
echo $usrUser->getCode() . "<br />";
echo $usrUser->getName() . "<br />";
echo $usrUser->getEmail() . "<br />";
var_dump($usrUser);
示例10: BuyFixed
public static function BuyFixed($auctionId, $qty)
{
global $config, $user;
// validate args
$auctionId = (int) $auctionId;
$qty = (int) $qty;
if ($auctionId < 1) {
$_SESSION['error'][] = 'Invalid auction id!';
return FALSE;
}
if ($qty < 1) {
$_SESSION['error'][] = 'Invalid qty!';
return FALSE;
}
// has canBuy permissions
if (!$user->hasPerms('canBuy')) {
$_SESSION['error'][] = 'You don\'t have permission to buy.';
return FALSE;
}
// query auction
$auction = QueryAuctions::QuerySingle($auctionId);
if (!$auction) {
$_SESSION['error'][] = 'Auction not found!';
return FALSE;
}
$Item = $auction->getItemCopy();
// // is item allowed
// if (!itemAllowed($item->name, $item->damage)){
// $_SESSION['error'][] = $item->fullname.' is not allowed to be sold.';
// header("Location: ../myauctions.php");
// }
// buying validation
if ($auction->getSellerId() == $user->getId()) {
$_SESSION['error'][] = 'Can\'t buy from yourself!';
return FALSE;
}
if ($qty > $Item->getItemQty()) {
$_SESSION['error'][] = 'Not that many for sale!';
return FALSE;
}
$maxSellPrice = SettingsClass::getDouble('Max Sell Price');
$sellPrice = $auction->getPrice();
$priceTotal = $sellPrice * (double) $qty;
if ($maxSellPrice > 0.0 && $sellPrice > $maxSellPrice) {
$_SESSION['error'][] = 'Over max sell price of ' . SettingsClass::getBoolean('Currency Prefix') . $maxSellPrice . SettingsClass::getBoolean('Currency Prefix') . ' !';
return FALSE;
}
if ($priceTotal > $user->getMoney()) {
$_SESSION['error'][] = 'You don\'t have enough money!';
return FALSE;
}
// make payment from buyer to seller
UserClass::MakePayment($user->getName(), $user->getUUID(), $auction->getSeller(), $auction->getSellerUUID(), $priceTotal, 'Bought auction ' . (int) $auction->getTableRowId() . ' ' . $Item->getItemTitle() . ' x' . (int) $Item->getItemQty());
// remove auction
if (!self::RemoveAuction($auctionId, $qty < $Item->getItemQty() ? $qty : -1)) {
echo '<p style="color: red;">Error removing/updating auction!</p>';
exit;
}
// add to inventory
$Item->setItemQty($qty);
$tableRowId = ItemFuncs::AddCreateItem($user->getId(), $Item);
if (!$tableRowId) {
echo '<p style="color: red;">Error adding item to your inventory!</p>';
exit;
}
// add sale log
LogSales::addLog(LogSales::LOG_SALE, LogSales::SALE_BUYNOW, $auction->getSellerId(), $user->getId(), $Item, $sellPrice, FALSE, '', TRUE);
return TRUE;
}
示例11: var_dump
var_dump($Cats);
/* Lesson 11*/
$MyVar = 1;
echo "outside: {$MyVar} ";
example();
function example()
{
global $MyVar;
echo "inside: {$MyVar} ";
}
var_dump($GLOBALS);
/* Lesson 14*/
class UserClass
{
public $firstname;
function __construct($firstname)
{
$this->firstname = $firstname;
}
function GetName()
{
return $this->firstname;
}
function __destruct()
{
// TODO: Implement __destruct() method.
echo "DESCRUCTOR";
}
}
$User = new UserClass('BBB');
echo "CLASS" . $User->GetName();
示例12: trim
$uid = $_POST['uid'];
$phone = $_POST['phone'];
$mail = $_POST['mail'];
$workplace = $_POST['workplace'];
$job = $_POST['job'];
$grade = $_POST['grade'];
$major = $_POST['major'];
$qq = $_POST['qq'];
$wechat = $_POST['wechat'];
$blog = $_POST['blog'];
$github = $_POST['github'];
//$native = "西安";
$native = null;
$grade = trim($grade);
$workplace = trim($workplace);
$userObj = new UserClass();
print $userObj->update_userinfo($uid, $phone, $mail, $qq, $wechat, $blog, $github, $native, $major, $workplace, $job);
exit;
case 'refresh_activity':
$mid = $_POST['mid'];
$uid = $_POST['uid'];
$result = "";
for ($i = 0; $i < 5; ++$i) {
$b = get_message($uid, $mid, $i);
if ($b == 'false') {
if ($result == "") {
$result = 'false';
}
break;
}
$result .= $b;
示例13: array
require "settings.php";
include CONTROLLER_PATH . "manager/DataBaseController.php";
$_DB = DataBaseController::init();
include VIEW_PATH;
include MODEL_PATH . "forms/MainFormClass.php";
include MODEL_PATH . "forms/FieldClass.php";
include MODEL_PATH . "user/UserClass.php";
include MODEL_PATH . "rss/RssClass.php";
include MODEL_PATH . "paginator/PaginatorClass.php";
include CONTROLLER_PATH . "manager/MainRouter.php";
include CONTROLLER_PATH . "manager/MailController.php";
include CONTROLLER_PATH . "form/MainFormController.php";
include CONTROLLER_PATH . "form/RegisterFormController.php";
include CONTROLLER_PATH . "form/AuthFormController.php";
include CONTROLLER_PATH . "form/UpdateFormController.php";
include CONTROLLER_PATH . "form/RssFormController.php";
include CONTROLLER_PATH . "form/ValidatorController.php";
include CONTROLLER_PATH . "rss/RssController.php";
include CONTROLLER_PATH . "rss/RssItemsController.php";
include CONTROLLER_PATH . "paginator/PaginatorController.php";
$_ADDRESS = $_SERVER["REQUEST_URI"];
$pages = array("/" => "index.php");
$_ROUTER = MainRouter::createRouter($pages);
global $_USER;
if ($_COOKIE["login"]) {
$_USER = UserClass::getByLogin($_COOKIE["login"]);
if ($_USER->getProperty("active") == false) {
unset($_COOKIE["login"]);
unset($_USER);
}
}
示例14: setcookie
setcookie("userID", "", 0, "/");
setcookie("firstName", "", 0, "/");
setcookie("lastName", "", 0, "/");
setcookie("email", "", 0, "/");
unset($_COOKIE['userID']);
unset($_COOKIE['checkedLogin']);
unset($_COOKIE['firstName']);
unset($_COOKIE['lastName']);
unset($_COOKIE['email']);
if ($useSGU) {
/*
se estiver usando SGU e estiver no portal regional (Scielo.org), chama o logout do SGU
*/
if ($ini['this']['url'] == $ini['scielo_org_urls']['home']) {
require_once dirname(__FILE__) . "/../users/UserClassWS.php";
$usr = new UserClass();
$usr->setToken($_COOKIE['userToken']);
$usr->logout();
}
setcookie("userToken", "", 0, "/");
setcookie("tokenVisit", "", 0, "/");
unset($_COOKIE['userToken']);
}
ob_start();
?>
<html>
<body>
<p>Logout</p>
</body>
</html>
示例15:
<td>Modified By</td>
<td>Last Modified</td>
<td colspan="2">
<form action="adminPortal.php" method="post">
<input type="text" name="addPage" value="addPage" hidden />
<input type="Submit" id="addUser" name="addUser" value="Add User" />
</form>
</td>
</tr>
</thead>
<tbody>
<?php
require "../Business/UserClass.php";
$arrayOfPages = UserClass::retrieveUsers();
foreach ($arrayOfPages as $page) {
?>
<tr>
<td><?php
echo $page->getID();
?>
</td>
<td><?php
echo $page->getUsername();
?>
</td>
<td><?php
echo $page->getFistName();
?>
</td>