本文整理汇总了PHP中CUser::GetAcronym方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::GetAcronym方法的具体用法?PHP CUser::GetAcronym怎么用?PHP CUser::GetAcronym使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetAcronym方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CDatabase
/**
* This is a Hera pagecontroller.
*
*/
// Include the essential config-file which also creates the $anax variable with its defaults.
include __DIR__ . '/config.php';
$hera['stylesheets'][] = 'css/forms.css';
$db = new CDatabase($hera['database']);
$user = new CUser($db);
//metod som returerar användar object $profile
//flytta allt till CUser
// $html = $user->printProfile();
if ($user->IsAuthenticated()) {
if (isset($_GET['id'])) {
$user->getEntryByID($_GET['id']);
$html = $user->printAndPostUpdate();
} else {
$html = $user->printProfile($user->GetAcronym());
}
} else {
$html = "För att visa din profil behöver du <a href='login.php'>logga in</a>.";
}
// Do it and store it all in variables in the Hera container.
$hera['title'] = "Min sida";
$hera['main'] = <<<EOD
<h1>{$hera['title']}</h1>
{$html}
EOD;
//Finally, leave it all to the rendering phase of Hera.
include HERA_THEME_PATH;
示例2: CDatabase
<?php
/**
* This is a Hera pagecontroller.
*
*/
// Include the essential config-file which also creates the $anax variable with its defaults.
include __DIR__ . '/config.php';
$hera['stylesheets'][] = 'css/forms.css';
// Connect to a MySQL database using PHP PDO
$db = new CDatabase($hera['database']);
$user = new CUser($db);
if ($user->IsAuthenticated()) {
$output = "Du är inloggad som: {$user->GetAcronym()} ({$user->GetName()}) / <a href='logout.php'>Logga ut?</a>";
} else {
$output = "Du är INTE inloggad.";
}
// Check if user and password is okey
if (isset($_POST['Login'])) {
$user->Login($_POST['acronym'], $_POST['password']);
header('Location: login.php');
}
// Do it and store it all in variables in the Hera container.
$hera['title'] = "Login";
$hera['main'] = <<<EOD
<h1>{$hera['title']}</h1>
<form method=post>
<fieldset>
<legend>Logga in</legend>
<p><em>Du kan logga in med emsf14:emsf14 för att logga in som vanlig användare eller admin:admin för att logga in som administratör.</em></p>
<div class='box'>Inte medlem än? Klicka <a href='register.php'>här</a> för att registrera dig.</div>
示例3: CDatabase
<?php
/**
* This is a Hera pagecontroller.
*
*/
// Include the essential config-file which also creates the $anax variable with its defaults.
include __DIR__ . '/config.php';
$hera['stylesheets'][] = 'css/forms.css';
// Connect to a MySQL database using PHP PDO
$db = new CDatabase($hera['database']);
$user = new CUser($db);
if ($user->IsAuthenticated()) {
$output = "Du är inloggad som: {$user->GetAcronym()} ({$user->GetName()})";
} else {
$output = "Du är INTE inloggad. / <a href='login.php'>Logga in?</a>";
}
// Logout the user
if (isset($_POST['logout'])) {
$user->Logout();
header('Location: logout.php');
}
// Do it and store it all in variables in the Hera container.
$hera['title'] = "Logout";
$hera['main'] = <<<EOD
<h1>{$hera['title']}</h1>
<form method=post>
<fieldset>
<legend>Logga ut</legend>
<p><input type='submit' value='Logga ut' name='logout'></p>
<p>{$output}</p>