本文整理汇总了PHP中getUsername函数的典型用法代码示例。如果您正苦于以下问题:PHP getUsername函数的具体用法?PHP getUsername怎么用?PHP getUsername使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUsername函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printUserBox
function printUserBox()
{
global $userData;
global $isLoggedIn;
global $authUrl;
handleNameChange();
echo "<div class='userBox box header'>";
if ($isLoggedIn) {
echo "<img class='circle-image' src='" . $userData['picture'] . "' width=100px height=100px /><br/>";
if (!isset($_GET["settings"])) {
echo "<p class='welcome'>Welcome <a href='" . $userData['link'] . "'>" . getUsername($userData) . "</a></p>";
} else {
echo "<form action='" . getUrl() . "' method='post'>";
echo "<p class='welcome'>Welcome";
echo "<input type='text' name='displayName' value='" . getUsername($userData) . "'/>";
echo "<input type='submit' value='Submit'>";
echo "</p></form>";
}
echo "<div class='userBoxBottom'>";
echo "<div class='settings'><a href='?settings'><img src='Settings.png' width=16px height=16px /></a></div>";
echo "<div class='logout'><a href='?logout'>Logout</a></div></div>";
} else {
echo "<a href='{$authUrl}'>Sign in using Google</a>";
}
echo "</div>";
}
示例2: tambahAdminsubmit
public function tambahAdminsubmit()
{
$this->form_validation->set_rules('USERNAME', 'USERNAME', 'required');
$this->form_validation->set_rules('PASSWORD', 'PASSWORD', 'required');
$this->form_validation->set_rules('PASSWORD2', 'Confrim password', 'required|matches[PASSWORD]');
if ($this->form_validation->run() == FALSE) {
$this->session->set_flashdata('notif', validation_errors());
$this->session->set_flashdata('clr', 'danger');
redirect('admin_user');
}
$cekpass = $this->user->tampilData('mp_user');
foreach ($cekpass as $row) {
if ($row->PASSWORD == acakPass($this->input->post('PASSWORD'))) {
$this->session->set_flashdata('notif', 'Ulangi Password sudah terpakai');
$this->session->set_flashdata('clr', 'warning');
redirect('admin_user');
}
}
$dataadmin = array('NAMA' => $this->input->post('NAMA'), 'NO_TELP' => $this->input->post('NO_TELP'), 'USERNAME' => getUsername($this->input->post('USERNAME'), 'admin'));
$insertadmin = $this->user->tambahData($dataadmin, 'mp_admin');
$data = array('ID_LEVEL' => '1', 'ID_AUTH' => $this->db->insert_id(), 'USERNAME' => getUsername($this->input->post('USERNAME'), 'admin'), 'PASSWORD' => acakPass($this->input->post('PASSWORD')));
$insert = $this->user->tambahData($data, 'mp_user');
if ($insert) {
$this->session->set_flashdata('notif', 'admin berhasil di tambah');
$this->session->set_flashdata('clr', 'success');
redirect('admin_user');
} else {
$this->session->set_flashdata('notif', 'maaf data tidak bisa masuk ulangi lagi');
$this->session->set_flashdata('clr', 'warning');
redirect('admin_user');
}
}
示例3: changeUsername
/**
* Changes user's username.
* User must enter security number to prevent robot attacks.
*/
public function changeUsername()
{
checkUnauthorizedAccess();
$main = new Main();
$main->setPageTitle("Username settings");
$changeUsername = new ChangeUsername();
$main->setBody($changeUsername);
echo $main;
$oldUsername = getUsername();
if (post('change-username')) {
$newUsername = post('first');
$confirmNewUsername = post('second');
$userSecurityNumber = post('security');
$error = false;
if (!ctype_alnum($newUsername) || strlen($newUsername) < 4 || strlen($newUsername) > 25) {
$error = true;
}
if (!ctype_alnum($confirmNewUsername) || strlen($confirmNewUsername) < 4 || strlen($confirmNewUsername) > 25) {
$error = true;
}
if ($userSecurityNumber < 1113 || $userSecurityNumber > 1207) {
$error = true;
}
if ($newUsername === $confirmNewUsername && !$error) {
UserRepository::changeUsername($oldUsername, $newUsername);
$_SESSION['username'] = $newUsername;
}
}
}
示例4: addAlbum
function addAlbum($aData = array(), $bCheck = true)
{
if ($bCheck) {
$iCheck = $this->_checkAlbumExistence($aData);
if ($iCheck != 0) {
return $iCheck;
}
}
$iOwner = (int) $aData['owner'];
if (isset($aData['AllowAlbumView'])) {
$iAllowAlbumView = (int) $aData['AllowAlbumView'];
} elseif (strpos($aData['caption'], getUsername($iOwner)) !== false) {
$iAllowAlbumView = BX_DOL_PG_ALL;
} else {
$iAllowAlbumView = BX_DOL_PG_NOBODY;
}
$aFields = array('Caption' => $aData['caption'], 'Uri' => $this->getCorrectUri($aData['caption'], $iOwner, $bCheck), 'Location' => $aData['location'], 'Description' => $aData['description'], 'AllowAlbumView' => $iAllowAlbumView, 'Type' => $this->sType, 'Owner' => $iOwner, 'Status' => getParam('sys_album_auto_app') == 'on' ? 'active' : 'passive', 'Date' => time(), 'LastObjId' => isset($aData['lastObjId']) ? (int) $aData['last_obj'] : 0);
$sqlBegin = "";
$sqlCond = "";
$sqlBody = $this->_getSqlPart($aFields);
$sqlBegin = "INSERT INTO ";
$sqlQuery = "{$sqlBegin} `{$this->sAlbumTable}` SET {$sqlBody} {$sqlCond}";
$GLOBALS['MySQL']->res($sqlQuery);
return $GLOBALS['MySQL']->lastId();
}
示例5: getBaseUrl
function getBaseUrl()
{
$aEntry = $this->_oModule->oAlbums->getAlbumInfo(array('fileid' => $this->getId()));
if (empty($aEntry) || !is_array($aEntry)) {
return '';
}
return BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'browse/album/' . $aEntry['Uri'] . '/owner/' . getUsername($aEntry['Owner']);
}
示例6: getBasicFileInfoForm
function getBasicFileInfoForm(&$aInfo, $sUrlPref = '')
{
$aForm = parent::getBasicFileInfoForm($aInfo, $sUrlPref);
if (!empty($aInfo['albumCaption']) && !empty($aInfo['albumUri'])) {
$aForm['album'] = array('type' => 'value', 'value' => getLink($aInfo['albumCaption'], $sUrlPref . 'browse/album/' . $aInfo['albumUri'] . '/owner/' . getUsername($aInfo['medProfId'])), 'caption' => _t('_bx_files_album'));
}
return $aForm;
}
示例7: getCacheOwnername
function getCacheOwnername($cacheid)
{
$sql = "SELECT user_id FROM caches WHERE cache_id='" . sql_escape(intval($cacheid)) . "'";
$query = mysql_query($sql) or die;
if (mysql_num_rows($query) > 0) {
return getUsername(mysql_result($query, 0));
}
return null;
}
示例8: auth
function auth()
{
$u = getUsername();
$p = getPassword();
if (!trim($u) || !trim($p)) {
return false;
}
return smfapi_authenticate(trim($u), trim($p), true);
}
示例9: getLevel
function getLevel()
{
$koneksi = mysql_connect('localhost', 'root', '');
mysql_select_db('mtrain', $koneksi);
$query = "SELECT level FROM admin WHERE username='" . getUsername() . "'";
$mQuery = mysql_query($query);
$result = mysql_fetch_array($mQuery);
return $result['level'];
mysql_close();
}
示例10: testGetUsername
public function testGetUsername()
{
// try basic
$this->assertEquals($_SESSION['username'], 'old_user');
$this->assertEquals(getUsername(), 'old_user');
unset($_SESSION['username']);
// try with not setted SESSION
$this->assertFalse(isset($_SESSION['username']));
$this->assertEquals(getUsername(), null);
}
示例11: checkLoggedIn
function checkLoggedIn()
{
// if logged in:
if (isset($_SESSION['user_id']) && $_SESSION['user_id'] > 0) {
$user = array("username" => getUsername(), "wood" => calcCurrentResources()["wood"], "iron" => calcCurrentResources()["iron"], "clay" => calcCurrentResources()["clay"], "level" => getLevel(), "villagers_in_use" => getVillagers(), "max_villagers" => getMaxVillagers());
} else {
// not logged in:
$user = null;
}
return $user;
}
示例12: login4
function login4($sUser, $sPwdClear)
{
$iId = 0;
$aProfileInfo = getProfileInfo(getID($sUser));
if ($aProfileInfo && ((32 == strlen($sPwdClear) || 40 == strlen($sPwdClear)) && BxDolXMLRPCUtil::checkLogin($sUser, $sPwdClear))) {
$iId = $aProfileInfo['ID'];
} elseif ($aProfileInfo && getParam('enable_dolphin_footer') != 'on' && check_password($aProfileInfo['ID'], $sPwdClear, BX_DOL_ROLE_MEMBER, false)) {
$iId = $aProfileInfo['ID'];
}
return new xmlrpcresp(new xmlrpcval(array('member_id' => new xmlrpcval($iId, "int"), 'member_pwd_hash' => new xmlrpcval($iId ? $aProfileInfo['Password'] : ""), 'member_username' => new xmlrpcval($iId ? getUsername($iId) : ""), 'protocol_ver' => new xmlrpcval(BX_XMLRPC_PROTOCOL_VER, "int")), "struct"));
}
示例13: checkResetID
function checkResetID()
{
if (isset($_GET['resetid'])) {
$db = new DbObject();
$resUser = $db->select("username", "Member", 'resetID="' . $_GET['resetid'] . '"');
$username = getUsername($resUser);
return $username;
} else {
return false;
}
}
示例14: parseContent
function parseContent($sContent, $aKeys, $iMemberId = 0)
{
$aResultKeys = $this->getDefaultKeys();
if ($iMemberId != 0) {
$aProfile = getProfileInfo($iMemberId);
$aResultKeys = array_merge($aResultKeys, array('recipientID' => $aProfile['ID'], 'RealName' => getNickName($aProfile['ID']), 'NickName' => getNickName($aProfile['ID']), 'Username' => getUsername($aProfile['ID']), 'RecipientUrl' => getProfileLink($aProfile['ID']), 'Email' => $aProfile['Email'], 'Password' => $aProfile['Password'], 'SiteName' => getParam('site_title')));
}
if (is_array($aKeys)) {
$aResultKeys = array_merge($aResultKeys, $aKeys);
}
return $GLOBALS['oSysTemplate']->parseHtmlByContent($sContent, $aResultKeys, array('<', '>'));
}
示例15: serviceSetAvatar
function serviceSetAvatar($iPhotoID, $iAuthorId = 0)
{
if (!$iAuthorId) {
$iAuthorId = getLoggedId();
}
$aFileInfo = $this->_oDb->getFileInfo(array('fileId' => $iPhotoID));
$sProfileAlbumUri = uriFilter(str_replace('{nickname}', getUsername($iAuthorId), $this->_oConfig->getGlParam('profile_album_name')));
if ($sProfileAlbumUri != $aFileInfo['albumUri']) {
return false;
}
return $this->_oDb->setAvatar($iPhotoID, $aFileInfo['albumId']);
}