本文整理汇总了PHP中user::getUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP user::getUsername方法的具体用法?PHP user::getUsername怎么用?PHP user::getUsername使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::getUsername方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formAction
function formAction()
{
global $tpl, $login;
$commit = isset($_REQUEST['chkcommit']) ? $_REQUEST['chkcommit'] + 0 : 0;
$delete = isset($_REQUEST['chkdelete']) ? $_REQUEST['chkdelete'] + 0 : 0;
$disable = isset($_REQUEST['chkdisable']) ? $_REQUEST['chkdisable'] + 0 : 0;
$userid = isset($_REQUEST['userid']) ? $_REQUEST['userid'] + 0 : 0;
$user = new user($userid);
if ($user->exist() == false) {
$tpl->error(ERROR_UNKNOWN);
}
$username = $user->getUsername();
if ($delete == 1 && $disable == 1) {
$tpl->error('You cannot delete and disable the same time!');
}
if ($commit == 0) {
$tpl->error('You have to check that you are sure!');
}
if ($disable == 1) {
if ($user->disable() == false) {
$tpl->error(ERROR_UNKNOWN);
}
} else {
if ($delete == 1) {
if ($user->delete() == false) {
$tpl->error(ERROR_UNKNOWN);
}
}
}
$tpl->redirect('adminuser.php?action=searchuser&username=' . urlencode($username));
}
示例2: formAction
function formAction()
{
global $tpl, $login, $translate;
$commit = isset($_REQUEST['chkcommit']) ? $_REQUEST['chkcommit'] + 0 : 0;
$delete = isset($_REQUEST['chkdelete']) ? $_REQUEST['chkdelete'] + 0 : 0;
$disable = isset($_REQUEST['chkdisable']) ? $_REQUEST['chkdisable'] + 0 : 0;
$emailproblem = isset($_REQUEST['chkemail']) ? $_REQUEST['chkemail'] + 0 : 0;
$datalicense = isset($_REQUEST['chkdl']) ? $_REQUEST['chkdl'] + 0 : 0;
$userid = isset($_REQUEST['userid']) ? $_REQUEST['userid'] + 0 : 0;
$disduelicense = isset($_REQUEST['chkdisduelicense']) ? $_REQUEST['chkdisduelicense'] + 0 : 0;
$user = new user($userid);
if ($user->exist() == false) {
$tpl->error(ERROR_UNKNOWN);
}
$username = $user->getUsername();
if ($delete + $disable + $disduelicense > 1) {
$tpl->error($translate->t('Please select only one of the delete/disable options!', '', '', 0));
}
if ($commit == 0) {
$tpl->error($translate->t('You have to check that you are sure!', '', '', 0));
}
if ($disduelicense == 1) {
$errmesg = $user->disduelicense();
if ($errmesg !== true) {
$tpl->error($errmesg);
}
} else {
if ($disable == 1) {
if ($user->disable() == false) {
$tpl->error(ERROR_UNKNOWN);
}
} else {
if ($delete == 1) {
if ($user->delete() == false) {
$tpl->error(ERROR_UNKNOWN);
}
} else {
if ($emailproblem == 1) {
$user->addEmailProblem($datalicense);
}
}
}
}
$tpl->redirect('adminuser.php?action=searchuser&username=' . urlencode($username) . '&success=' . ($disduelicense + $disable));
}
示例3: user
if (isset($_REQUEST['emailaddress'])) {
$bEmailaddress = $_REQUEST['emailaddress'] == 1;
} else {
$own_user = new user($login->userid);
$bEmailaddress = $own_user->getUsermailSendAddress();
}
if (isset($_REQUEST['ok'])) {
$bError = false;
if ($subject == '') {
$bError = true;
$tpl->assign('errorSubjectEmpty', true);
}
if ($text == '') {
$bError = true;
$tpl->assign('errorBodyEmpty', true);
}
if ($bError == false) {
if ($user->sendEMail($login->userid, $subject, $text, $bEmailaddress)) {
$tpl->assign('success', true);
} else {
$tpl->assign('errorUnkown', true);
}
}
}
$tpl->assign('subject', $subject);
$tpl->assign('text', $text);
$tpl->assign('emailaddress', $bEmailaddress);
$tpl->assign('email_problems', $user->getEmailProblems());
$tpl->assign('userid', $user->getUserId());
$tpl->assign('username', $user->getUsername());
$tpl->display();
示例4: database
<?php
require '../includes/config.php';
require '../structure/database.php';
require '../structure/base.php';
require '../structure/user.php';
require '../structure/msgcenter.php';
$database = new database($db_host, $db_name, $db_user, $db_password);
$base = new base($database);
$msgcenter = new msgcenter($database);
$user = new user($database);
if (!$user->isLoggedIn()) {
$base->redirect('../index.php');
}
$user->updateLastActive();
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
$id = $_GET['id'];
if (!$msgcenter->canCreate($username, $rank) || $user->checkMute($username)) {
$content = 'You can\'t create a new conversation. <input type="button" class="button" value="Back" onclick="goBack()" />';
} elseif (!isset($_POST['title']) || !isset($_POST['reply'])) {
$content = '
<form action="create.php" method="POST">
<table>
<tr><td>Title</td><td align="left"><input type="text" class="button" name="title" maxlength="50"></td></tr>';
if ($rank > 3) {
$content .= '<tr><td>Mass Message</td><td align="left"><input type="checkbox" name="mass_message" id="mass"></td></tr><tr><td>Receiver</td><td align="left"><input type="text" class="button" name="receiver" id="receiver" maxlength="12"></td></tr>';
}
$content .= '
<tr><td>Message</td><td><textarea name="reply" class="button" cols="45" rows="20" maxlength="2000"></textarea></td></tr>
<tr><td></td><td align="left"><input type="submit" class="button" value="Create"></td></tr>
示例5: __construct
public function __construct()
{
// Construct a different html for ingame and the out-of-game browser.
global $IGB;
global $VERSION;
global $MySelf;
global $TIDY_ENABLE;
global $width;
global $URL;
global $IGB_VISUAL;
// Enable tidy, if we want to.
$this->useTidy = $TIDY_ENABLE;
// In case we are not logged in, or the object does not exist yet.
if (!is_object($MySelf)) {
$MySelf = new user(false, false);
}
if ($IGB && $IGB_VISUAL) {
// Use IGB, set header and footer.
$this->isIGB = true;
// $this->header = file_get_contents('./include/ingame/igb-header.txt');
$this->header = file_get_contents('./include/ingame/igb-header.php');
if ($MySelf->isValid()) {
$this->header .= makeMenu();
$this->header = str_replace("%%RANK%%", $MySelf->getRankName(), $this->header);
$this->header = str_replace("%%CREDITS%%", number_format(getCredits($MySelf->getID()), 2) . " ISK", $this->header);
$this->header = str_replace("%%USERNAME%%", ucfirst($MySelf->getUsername()), $this->header);
}
$this->header = str_replace("%%SITENAME%%", getConfig("sitename"), $this->header);
// $this->footer = file_get_contents('./include/ingame/igb-footer.txt');
$this->footer = file_get_contents('./include/ingame/igb-footer.php');
$this->footer = str_replace("%%VERSION%%", $VERSION, $this->footer);
} else {
// Use normal browser.
$this->isIGB = false;
if ($MySelf->isValid() == 1) {
// $this->header = file_get_contents('./include/html/header.txt');
$this->header = file_get_contents('./include/html/header.php');
} else {
// $this->header = file_get_contents('./include/html/header-notloggedin.txt');
$this->header = file_get_contents('./include/html/header-notloggedin.php');
}
// $this->footer = file_get_contents('./include/html/footer.txt');
$domainroot = $_SERVER['HTTP_HOST'];
// Add page footer
// use proper footer for sponcered sites.
if ($domainroot == "miningbuddy.us" or $domainroot == "miningbuddy.de" or $domainroot == "miningbuddy.net") {
$this->footer = file_get_contents('./include/html/mbh-footer.php');
} else {
$this->footer = file_get_contents('./include/html/footer.php');
}
// Generate the images.
$mainLogo = new graphic("title");
$mainLogo->setText(getConfig("sitename"));
$mainLogo->setBGColor("2D2D37");
// this is here to retain some code. Image caching seemed to be pretty useless.
$imageCaching = false;
if ($imageCaching) {
$loginLogo = new graphic("standard");
$loginLogo->setText(ucfirst($MySelf->getUsername()));
$loginLogo->setBGColor("2D2D37");
$loginLogo->setPrefixed(false);
$versionLogo = new graphic("long");
$versionLogo->setText($VERSION);
$versionLogo->setBGColor("2D2D37");
$versionLogo->setPrefixed(false);
$rankLogo = new graphic("standard");
$rankLogo->setText($MySelf->getRankName());
$rankLogo->setBGColor("2D2D37");
$rankLogo->setPrefixed(false);
$moneyLogo = new graphic("standard");
$moneyLogo->setText(number_format(getCredits($MySelf->getID()), 2) . " ISK");
$moneyLogo->setDirect(true);
$moneyLogo->setBGColor("2D2D37");
$moneyLogo->setPrefixed(false);
}
// Replace variables in the header.
$this->header = str_replace("%%SITENAME%%", getConfig("sitename") . " - " . $VERSION, $this->header);
$this->header = makeMenu($this->header);
$thisCharacterID = "";
if ($MySelf->isValid()) {
$api = new api($MySelf->getID());
$thisCharacterID = $api->getCharacterID();
}
if ($thisCharacterID == "") {
$this->header = str_replace("%%PILOT64%%", "", $this->header);
} else {
$this->header = str_replace("%%PILOT64%%", "<img width='64' height='64' align='left' src='https://image.eveonline.com/Character/" . $api->getCharacterID() . "_64.jpg' />", $this->header);
}
$this->header = str_replace("%%LOGO%%", $mainLogo->render(), $this->header);
if ($imageCaching) {
$this->header = str_replace("%%LOGGEDIN%%", $loginLogo->render(), $this->header);
//
$this->header = str_replace("%%RANK%%", $rankLogo->render(), $this->header);
$this->header = str_replace("%%CREDITS%%", $moneyLogo->render(), $this->header);
$this->footer = str_replace("%%IMG%%", $versionLogo->render(), $this->footer);
} else {
$this->header = str_replace("%%LOGGEDIN%%", " " . ucfirst($MySelf->getUsername()), $this->header);
$this->header = str_replace("%%RANK%%", " " . $MySelf->getRankName(), $this->header);
$this->header = str_replace("%%CREDITS%%", " " . number_format(getCredits($MySelf->getID()), 2) . " ISK", $this->header);
$this->footer = str_replace("%%IMG%%", $VERSION, $this->footer);
//.........这里部分代码省略.........
示例6:
$bError = true;
$tpl->assign('error_tos_not_ok', 1);
}
if ($bError == false) {
// try to register
$user->setActivationCode($user->CreateCode());
$user->setNode($opt['logic']['node']['id']);
if ($user->save()) {
// send confirmation
$user->sendRegistrationCode();
//display confirmation
$tpl->assign('confirm', 1);
} else {
$bReasonFound = false;
// username or email already exists
if ($user->existUsername($user->getUsername())) {
$tpl->assign('error_username_exists', 1);
$bReasonFound = true;
}
if ($user->existEMail($user->getEMail())) {
$tpl->assign('error_email_exists', 1);
$bReasonFound = true;
}
if ($bReasonFound == false) {
$tpl->assign('error_unkown', 1);
}
}
}
}
}
$rs = $countriesList->getRS($country == 'XX' ? null : $country, $show_all_countries);
示例7: username
public function username()
{
//$username=$_POST['username'];
//for ajax
$desc = $_POST['username'];
$describe = user::getUsername($desc);
$list = "";
foreach ($describe as $describe) {
$list .= $describe->username;
}
echo $list;
}
示例8:
<div id='picUname'><?php
echo $_SESSION['fullname'];
?>
</div>
</div>
<div id='profileInfo'>
I am : <span id=''><?php
echo $u->getFullname();
?>
</span><br />
email : <?php
echo $u->getEmail();
?>
<br />
here I am called : <span id='profileUsername'><?php
echo $u->getUsername();
?>
</span><br />
Insti Roll : <?php
echo $u->getRoll();
?>
(Helps us to give you better suggestions)<br />
</div>
</div>
</div><!-- /container -->
<?php
echo $bottomBar;
echo $scripts;
echo $piwik;
?>
示例9: sendEMail
function sendEMail($nFromUserId, $sSubject, $sText, $bSendEMailAddress)
{
global $opt, $translate;
if ($this->exist() == false) {
return false;
}
if ($this->getIsActive() == false) {
return false;
}
if ($this->getEMail() === null || $this->getEMail() == '') {
return false;
}
if ($sSubject == '') {
return false;
}
if ($sText == '') {
return false;
}
if (mb_strpos($sSubject, "\n") !== false) {
$sSubject = mb_substr($sSubject, 0, mb_strpos($sSubject, "\n"));
}
$sSubject = mb_trim($sSubject);
$fromUser = new user($nFromUserId);
if ($fromUser->exist() == false) {
return false;
}
if ($fromUser->getIsActive() == false) {
return false;
}
if ($fromUser->getEMail() === null || $fromUser->getEMail() == '') {
return false;
}
$language = $this->getLanguageCode();
if (!$language) {
$language = $opt['template']['locale'];
}
// ok, we can send ...
$mail = new mail();
$mail->name = 'usercontactmail';
$mail->to = $this->getEMail();
$mail->recipient_locale = $this->getLanguageCode();
$mail->from = $opt['mail']['usermail'];
if ($bSendEMailAddress == true) {
$mail->replyTo = $fromUser->getEMail();
$mail->returnPath = $fromUser->getEMail();
}
$mail->subject = $translate->t('E-Mail from', '', basename(__FILE__), __LINE__, '', 1, $language) . ' ' . $fromUser->getUsername() . ': ' . $sSubject;
$mail->assign('usersubject', $sSubject);
$mail->assign('text', $sText);
$mail->assign('username', $this->getUsername());
$mail->assign('sendemailaddress', $bSendEMailAddress);
$mail->assign('fromusername', $fromUser->getUsername());
$mail->assign('fromuserid', $fromUser->getUserId());
$mail->assign('fromuseremail', $fromUser->getEMail());
if ($mail->send()) {
// send copy to fromUser
$mail->assign('copy', true);
$mail->to = $fromUser->getEMail();
$mail->send();
// log
sql("INSERT INTO `email_user` (`ipaddress`, \n\t\t\t `from_user_id`, \n\t\t\t `from_email`, \n\t\t\t `to_user_id`, \n\t\t\t `to_email`)\n\t\t\t VALUES ('&1', '&2', '&3', '&4', '&5')", $_SERVER["REMOTE_ADDR"], $fromUser->getUserId(), $fromUser->getEMail(), $this->getUserId(), $this->getEMail());
return true;
} else {
return false;
}
}
示例10: database
<?php
require '../includes/config.php';
require '../structure/database.php';
require '../structure/forum.php';
require '../structure/forum.thread.php';
require '../structure/base.php';
require '../structure/user.php';
$database = new database($db_host, $db_name, $db_user, $db_password);
$thread = new thread($database);
$base = new base($database);
$user = new user($database);
$user->updateLastActive();
//useful variables
$rank = $user->getRank($user->getUsername($_COOKIE['user'], 2));
if ($rank < 4) {
$base->redirect('../index.php');
}
//toggle the maintenance status of the site
$m = $database->processQuery("SELECT `maintenance` FROM `config`", array(), true);
$database->processQuery("UPDATE `config` SET `maintenance` = ?", array($m[0]['maintenance'] == 0 ? 1 : 0), false);
$redirect = 'http://www.Asgarniax.org/admin/index.php';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:IE>
<!-- LeeStrong Runescape Website Source --!>
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"><!-- /Added by HTTrack -->
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
示例11:
<div id='container'>
<?php echo $topBar;
echo $feedback;
?>
<div id='editProfile'></div>
<div id='profileBox'>
<img id='editProfileButton' src='pics/settings.png'/ >
<div id='snapShot'>
<img src="<?php echo $u->getUserPicture(); ?>"/>
<div id='picUname'><?php echo $_SESSION['fullname']; ?> </div>
</div>
<div id='profileInfo'>
I am : <span id=''><?php echo $u->getFullname(); ?></span><br />
email : <?php echo $u->getEmail(); ?> <br />
here I am called : <span id='profileUsername'><?php echo $u->getUsername(); ?></span><br />
Institute Roll : <?php echo $u->getRoll(); ?> (Helps us to give you better suggestions)<br />
</div>
</div>
</div><!-- /container -->
<?php
echo $bottomBar;
echo $scripts;
echo $piwik;
?>
<script type="text/javascript">
$(document).ready(function() {
P.updateStoryBox('My Uploads')
.updateStoryBox('Liked videos')
.updateStoryBox('Disliked videos');
示例12: elseif
</form>
<?php
} elseif (!$user->doesExist($_POST['username'])) {
echo 'No user exists with that username! <input type="button" value="Back" onclick="goBack()" />';
} else {
//all the recovery questions we're working with
$questions[] = array();
$questions[0] = 'What was your first pet\'s name?';
$questions[1] = 'Type in a code you can remember.';
$questions[2] = 'Where is your favorite vacation spot?';
$questions[3] = 'Who is your favorite author?';
$questions[4] = 'What color was your first bedroom?';
$questions[5] = 'What was your first car?';
//extract data
$data = $database->processQuery("SELECT * FROM `recoveries` WHERE `userid` = ? LIMIT 1", array($user->getIdByName($_POST['username'])), false);
if ($database->getRowCount() == 0 || $user->getUsername($_COOKIE['user'], 2) == $_POST['username']) {
echo 'You can\'t do that for this user! <input type="button" value="Back" onclick="goBack()" />';
} elseif (!isset($_POST['answer'])) {
?>
<fieldset class="question">
<legend>Answer Recovery Question</legend>
Now is the time when you wrote down your questions is useful. To the best of your ability, feel out all questions with the answers you
<br/><br/>
<b>Please Note:</b> Only the characters a-z, A-Z, 0-9, space, and $ are allowed.
</fieldset>
<form action="recover.php" method="POST">
<input type="hidden" name="username" value="<?php
echo $_POST['username'];
?>
示例13:
$res = $user->setUsername($_POST['username']);
echo $res;
} else {
echo "Username already taken.";
}
} else {
if (isset($_POST['aboutMe'])) {
$res2 = $user->setAboutMe($_POST['aboutMe']);
echo $res2;
}
}
}
?>
</div>
Username: <?php
echo $user->getUsername();
?>
<br>
Change Username:<br>
<form action="#" method="POST">
<input name="username" type="text"/>
<input type="submit" name="submitUsername" value="Save" />
</form><br>
Email: <?php
echo $user->getEmail();
?>
<br>
Update Email:<br>
<form action="#" method="POST">
<input name="email" type="text"/>
<input type="submit" name="submitEmail" value="Save" />
示例14: int
$template->display('error.tpl');
die;
}
if ($connection->query("SHOW TABLES LIKE 'role'")->rowCount() == 0) {
$connection->exec("CREATE TABLE IF NOT EXISTS `role` (\r\n\t\t\t\t`rid` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t`role` text NOT NULL,\r\n\t\t\t\t`r_admin` tinyint(1) NOT NULL,\r\n\t\t\t\tPRIMARY KEY (`rid`)\r\n\t\t\t)");
$connection->exec("INSERT INTO role (`role`,`r_admin`) VALUES ('admin', 1);");
$connection->exec("INSERT INTO role (`role`,`r_admin`) VALUES ('default', 1);");
$connection->exec("INSERT INTO role (`role`,`r_admin`) VALUES ('normal', 1);");
// not table exist
}
if (!empty($_POST['loginUsername']) && !empty($_POST['loginPassword'])) {
$user = new user($_POST['loginUsername'], $_POST['loginPassword'], $connection);
$template->assign("allowedPluginInstances", $allowedPluginInstances);
if (isset($_SESSION["user"]) && $user->isValid()) {
if ($user->getWelcome()) {
$messages[] = "Welcome " . $user->getUsername() . '. Your last Login was at ' . $user->getLastLogin() . ' from adress ' . $user->getLastIp();
$user->disableWelcome();
}
} else {
$messages[] = "Wrong Password or user";
}
}
if (isset($_SESSION["user"])) {
if (usertools::containRoles($GLOBALS["adminRoles"], $_SESSION["user"]->getRoles())) {
$template->assign("admin", true);
$admin = true;
}
$user = $_SESSION["user"];
if ($admin) {
$user->setAdmin(true);
}