当前位置: 首页>>代码示例>>PHP>>正文


PHP CUser::GetName方法代码示例

本文整理汇总了PHP中CUser::GetName方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::GetName方法的具体用法?PHP CUser::GetName怎么用?PHP CUser::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUser的用法示例。


在下文中一共展示了CUser::GetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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>
开发者ID:EmilSjunnesson,项目名称:rental,代码行数:31,代码来源:logout.php

示例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>
开发者ID:EmilSjunnesson,项目名称:rental,代码行数:31,代码来源:login.php

示例3: addEntry

 private function addEntry()
 {
     // Get parameters
     $title = isset($_POST['title']) ? $_POST['title'] : null;
     $slug = isset($_POST['slug']) ? $_POST['slug'] : null;
     $data = isset($_POST['data']) ? $_POST['data'] : array();
     $published = isset($_POST['published']) ? strip_tags($_POST['published']) : array();
     $updatedBy = isset($_POST['updatedBy']) ? $_POST['updatedBy'] : null;
     $publishedBy = strip_tags(CUser::GetName());
     $category = isset($_POST['category']) ? $_POST['category'] : null;
     if (empty($published)) {
         $published = null;
     }
     $sql = '
 INSERT INTO rm_news (slug, title, data, published, created, updatedBy, publishedBy, category) 
 VALUES(?,?,?,?,NOW(),?,?,?)
 ';
     $slug = empty($slug) ? null : $this->slugify($slug);
     $category = empty($category) ? null : $this->slugify($category);
     $params = array($slug, $title, $data, $published, $updatedBy, $publishedBy, $category);
     $this->db->ExecuteQuery($sql, $params);
     header("Location: edit_news.php");
 }
开发者ID:EmilSjunnesson,项目名称:rental,代码行数:23,代码来源:CContent.php


注:本文中的CUser::GetName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。