本文整理汇总了PHP中get_login函数的典型用法代码示例。如果您正苦于以下问题:PHP get_login函数的具体用法?PHP get_login怎么用?PHP get_login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_login函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_page
function show_page($page)
{
$template = "view/templates/default_template.php";
if (file_exists($template) && is_file($template)) {
require_once $template;
} else {
require_once "view/templates/default_template.php";
}
echo get_document_head();
echo get_header_start();
if (is_logged_in()) {
echo get_logout();
} else {
}
echo get_header_end();
if (is_logged_in()) {
echo get_menu();
} else {
echo get_guest_menu();
}
if (is_logged_in()) {
if ($page == "startpage") {
echo "startpage";
} else {
if ($page == "fileupload") {
echo get_fileupload();
} else {
if ($page == "nyheter") {
echo get_news();
} else {
if ($page == "flowing") {
echo get_flowing();
} else {
if ($page == "event") {
echo get_event();
} else {
if ($page == "profile") {
$user_id = 1;
echo get_profile($user_id);
} else {
echo get_default("");
}
}
}
}
}
}
} else {
echo get_login();
}
echo get_footer();
echo get_document_end();
}
示例2: audit
/**
* Audits an important action in the global audit log
*/
function audit($action, $message)
{
$now = new DateTime();
$when = $now->format('Y-m-d H:i:s');
$ip = $_SERVER["REMOTE_ADDR"];
$user = get_login();
if ($user == NULL) {
$user = "unknown user";
}
$db = DB::get_db();
$sql = sprintf("INSERT INTO audit_logs (`when`, ip, user, action, message)" . "VALUES ('%s', '%s', '%s', '%s', '%s')", $db->real_escape_string($when), $db->real_escape_string($ip), $db->real_escape_string($user), $db->real_escape_string($action), $db->real_escape_string($message));
if (!$db->query($sql)) {
error_log("Unable to insert into audit_logs: " . $db->error . " (sql: {$sql})");
return FALSE;
}
return TRUE;
}
示例3: post_comment
function post_comment()
{
$post = $_POST['idpost'];
$source = $_SESSION['id'];
if (strlen($_POST['content']) < 2) {
header('Location: ../index.php?r=2');
exit;
}
$content = $_POST['content'];
$content = htmlentities($content);
include database;
$req = $connection->prepare("INSERT INTO comments (idpost, idusercible, content, timedate) VALUES (" . $post . ", " . $source . ", '" . $content . "', NOW());");
$req->execute();
$message = "Vous avez un nouveau commentaire sur l'un de vos posts";
include 'users.php';
$login = get_login($_POST['iduser']);
$mail = get_mail_user($login);
mail($mail, 'Camagru - Nouveau Commentaire', $message);
header('Location: ../index.php?r=3#' . $post);
}
示例4: index
function index()
{
if (!is_logged()) {
redirect(base_url());
}
include APPPATH . "config/evote.php";
$this->data['title'] = lang('off_vote');
$text = icon('64x64/chart_up.png') . '<h2>Голосование на TOP EMUDEV</h2><p>После голосования нажмите получить бонус.</p><p>При простом голосовании вы получите <b>' . $config['normal'] . '</b> BP,
При смс голосе вы получите <b>' . $config['sms'] . '</b> BP.</p>';
$smslink = str_replace('server', 'sms', $config['votelink']);
$text .= icon('32x32/comment.png') . '<a href="' . $config['votelink'] . '" target="_blank">Голосовать</a>' . br(1);
$text .= icon('32x32/sms.png') . '<a href="' . $smslink . '" target="_blank">Голосовать через SMS</a>' . br(1);
$this->load->model('Account');
$this->Account->login = get_login();
$array = $this->Account->char_array();
$form = form_dropdown('char', $array);
$text .= form_open('evote/getbonus') . $form . form_submit('mysubmit', 'Получить бонус') . icon('32x32/note_accept.png') . form_close();
$this->data['content'] = $text;
compile();
}
示例5: initProgramlib
/**
* @return void
* @param
* @param
* @desc A generic function, that can be used by all programs. Does all the basic login stuff.
*/
function initProgramlib($ctype = null)
{
global $gbl, $sgbl, $login, $ghtml;
// /*
// --- solution for some scripts running well in slave
// REVERT - back to original
if ($sgbl->is_this_slave()) {
print "This is a Slave Server. Operate it at the Master server.\n";
exit;
}
// */
static $var = 0;
$var++;
$progname = $sgbl->__var_program_name;
lfile_put_contents($sgbl->__var_error_file, "");
set_exception_handler("lx_exception_handler");
//xdebug_disable();
set_error_handler("lx_error_handler");
//setcookie("XDEBUG_SESSION", "sess");
if ($var >= 2) {
dprint("initProgramlib called twice \n <br> ");
}
if ($ctype === 'superadmin') {
$sgbl->__var_dbf = $sgbl->__path_supernode_db;
$sgbl->__path_admin_pass = $sgbl->__path_super_pass;
$sgbl->__var_admin_user = $sgbl->__var_super_user;
$login = new SuperClient(null, null, 'superadmin', 'login', 'forced');
$login->get();
return;
} else {
if ($ctype === "guest") {
$login = new Client(null, null, "____________", "guest");
$login->get();
return;
} else {
if ($ctype != "") {
$login = new Client(null, null, $ctype, "login", "forced");
$login->get();
return;
}
}
}
$sessobj = null;
if ($ghtml->frm_consumedlogin === 'true') {
$clientname = $_COOKIE["{$progname}-consumed-clientname"];
$classname = $_COOKIE["{$progname}-consumed-classname"];
$session_id = $_COOKIE["{$progname}-consumed-session-id"];
get_login($classname, $clientname);
$login->__session_id = $session_id;
$sessobj = $login->getObject('ssession');
} else {
if (isset($_COOKIE["{$progname}-session-id"])) {
$clientname = $_COOKIE["{$progname}-clientname"];
$classname = $_COOKIE["{$progname}-classname"];
$session_id = $_COOKIE["{$progname}-session-id"];
if ($classname === 'superclient') {
$sgbl->__var_dbf = $sgbl->__path_supernode_db;
$sgbl->__path_admin_pass = $sgbl->__path_super_pass;
$sgbl->__var_admin_user = $sgbl->__var_super_user;
}
if ($classname === 'slave') {
$sgbl->__var_dbf = $sgbl->__path_slave_db;
}
if ($classname) {
get_login($classname, $clientname);
$login->__session_id = $session_id;
$sessobj = $login->getObject('ssession');
}
}
}
if (!$sessobj || $sessobj->dbaction === 'add') {
if ($ghtml->frm_ssl) {
$ssl = unserialize(base64_decode($ghtml->frm_ssl));
$string = $ssl['string'];
$ssl_param = $ssl['ssl_param'];
$encrypted_string = base64_decode($ssl['encrypted_string']);
if (!$string || !checkPublicKey($string, $encrypted_string)) {
print "SSL Connection Failed <br> \n";
exit;
}
$class = 'client';
$clientname = 'admin';
get_login($class, $clientname);
do_login($class, $clientname, $ssl_param);
$sessobj = $gbl->c_session;
$sessobj->write();
$sessobj->dbaction = 'clean';
}
}
//get_savedlogin($classname, $clientname);
//print_time('login_get', "Login Get");
//dprintr($login);
//avoid some php warnings
if (isset($login)) {
//.........这里部分代码省略.........
示例6: session_start
<?php
const USER = 'user';
const PASS = 'password';
session_start();
switch ($_SERVER["REQUEST_METHOD"]) {
case 'GET':
get_login();
break;
case 'POST':
post_login();
break;
case 'DELETE':
delete_login();
break;
default:
http_response_code(405);
die;
}
function get_login()
{
if ($_SESSION["loggedin"] == true) {
echo json_encode(array('loggedin' => true, 'status' => 'logged in'));
} else {
echo json_encode(array('loggedin' => false, 'status' => 'not logged in'));
}
}
function post_login()
{
$data = json_decode(file_get_contents('php://input'));
if (isset($data->user) && $data->user == USER && isset($data->password) && $data->password == PASS) {
示例7: session_start
session_start();
$masssending = new masssending();
if (empty($_SESSION['masssending_total_filesize'])) {
$_SESSION['masssending_total_filesize'] = 0;
}
if (empty($_SESSION['masssending']['files'])) {
$_SESSION['masssending']['files'] = array();
}
if (count($_SESSION['masssending']['files']) >= masssending::MAX_FILES) {
$error = 'Максимальное кол-во прикрепленных файлов - ' . masssending::MAX_FILES;
} else {
if ($_SESSION['masssending_total_filesize'] + $_FILES['attach']['size'] > masssending::MAX_FILE_SIZE) {
$error = 'Максимальный объем прикрепленных файлов - ' . masssending::MAX_FILE_SIZE / (1024 * 1024) . ' Mб';
} else {
if ($uid = get_uid(false)) {
$login = get_login($uid);
$file = new CFile($_FILES['attach']);
$file->table = 'file';
$file->max_size = masssending::MAX_FILE_SIZE;
$filename = $file->MoveUploadedFile("{$login}/contacts");
$filetype = $file->getext();
$error = $file->error;
} else {
$error = 'Вы не авторизованы';
}
if (!$file->id && !$error) {
$error = 'Ошибка при загрузке файла. Пожалуйста, попробуйте еще раз.';
}
$masssending->AddFile($file->id, session_id());
}
}
示例8: get_login
<div class="b-layout__right b-layout__right_width_72ps b-layout__right_float_right">
<h1 class="b-page__title b-page__title_padbot_30">Добро пожаловать на Free-lance.ru</h1>
</div>
<div class="b-layout__right b-layout__right_width_72ps b-layout__right_float_right">
<div class="b-fon b-fon_inline-block b-fon_padbot_20">
<div class="b-fon__body b-fon__body_pad_15 b-fon__body_padleft_30 b-fon__body_lineheight_18 b-fon__body_padright_40 b-fon__body_fontsize_13 b-fon__body_bg_f0ffdf">
<span class="b-icon b-icon_sbr_gok b-icon_margleft_-25"></span>Вы успешно зарегистрированы, и теперь вам доступны все бесплатные функции сайта.
</div>
</div>
<div class="b-layout__txt b-layout__txt_fontsize_22">— Перейти на <a class="b-layout__link" href="/">главную страницу</a></div>
<div class="b-layout__txt b-layout__txt_fontsize_11 b-layout__txt_padleft_30 b-layout__txt_padbot_40">и начать самостоятельный поиск работы.</div>
<div class="b-layout__txt b-layout__txt_fontsize_22">— Перейти в <a class="b-layout__link" href="/users/<?php
echo get_login(get_uid(0));
?>
/">личный кабинет</a></div>
<div class="b-layout__txt b-layout__txt_fontsize_11 b-layout__txt_padleft_30 b-layout__txt_padbot_40">указать профессиональную информацию и заполнить портфолио.</div>
</div>
<?php
if (!empty($_SESSION['is_new_user'])) {
unset($_SESSION['is_new_user']);
?>
<script language="javascript" src="http://www.everestjs.net/static/st.v2.js"></script>
<script language="javascript">
var ef_event_type="transaction";
var ef_transaction_properties = "ev_reg_worker=1&ev_reg_employer=0&ev_reg_worker_master=0&ev_reg_employer_master=0&ev_transid=<?php
echo md5($_SESSION['uid']);
?>
";
/*
示例9: AddMail
/**
* Добавить новую рассылку
*
* @param string $subject тема email
* @param string $message текст email
* @param array $attaches прикрепленные файлы
* @param string $contact_ids идентификаторы получателей
*/
function AddMail($subject, $message, $attaches, $contact_ids)
{
global $DB;
$files = '';
$fs = array();
if ($attaches['file']) {
$f = new CFile($attaches['file']);
$f->max_size = 2097152;
$dir = get_login(get_uid(false));
$f_name = $f->MoveUploadedFile($dir . "/upload");
array_push($fs, $f_name);
}
for ($i = 1; $i <= 5; $i++) {
if ($attaches['file_' . $i]) {
$f = new CFile($attaches['file_' . $i]);
$f->max_size = 2097152;
$dir = get_login(get_uid(false));
$f_name = $f->MoveUploadedFile($dir . "/upload");
array_push($fs, $f_name);
}
}
if ($fs) {
foreach ($fs as $v) {
$files .= $v . ',';
}
$files = preg_replace("/,\$/", "", $files);
}
$sql = "INSERT INTO contacts_mails(subject,message,attaches,contact_ids,user_id) VALUES(?, ?, ?,? , ?i)";
$DB->query($sql, pg_escape_string($subject), pg_escape_string(nl2br($message)), $files, $contact_ids, get_uid(false));
}
示例10: require_once
/****************************************************************/
// $Id$
if (!defined('AT_INCLUDE_PATH')) { exit; }
global $db;
global $_base_href, $msg, $_config;
$link_limit = 3; // Number of links to be displayed on "detail view" box
require_once("bbb_api_conf.php");
require_once("bbb_api.php");
$bbb_joinURL;
$_moderatorPassword="mp";
$_attendeePassword="ap";
$_logoutUrl= $_base_href.'index.php';
$username=get_login(intval($_SESSION["member_id"]));
$meetingID=$_SESSION['course_id'];
$bbb_welcome = _AT('bbb_welcome');
$salt = $_config['bbb_salt'];
$url = $_config['bbb_url']."/bigbluebutton/";
$response = BigBlueButton::createMeetingArray($username,$meetingID,$bbb_welcome, $_moderatorPassword,$_attendeePassword, $salt, $url,$_logoutUrl);
//Analyzes the bigbluebutton server's response
if(!$response){//If the server is unreachable
$msg->addError("UNABLE_TO_CONNECT_TO_BBB");
}
else if( $response['returncode'] == 'FAILED' ) { //The meeting was not created
if($response['messageKey'] == 'checksumError'){
$msg->addError("CHECKSUM_ERROR_BBB");
}
示例11: array
* ### NB per ora check non e' implementato ###
*
*/
if ($_GET['type'] === "student") {
$alunni = array();
// file di log
$log_file = fopen("../tmp/studenti" . date("Ymd"), "w+");
$index = 0;
$incompleti = 0;
$sel = "SELECT id_alunno, nome, cognome, username, password FROM alunni WHERE attivo = 1";
$res = $db->execute($sel);
while ($_alunno = $res->fetch_assoc()) {
if ($_alunno['username'] == '') {
$al = new Alunno($_alunno);
$incompleti++;
$al->username = get_login($db, $al->nome, $al->cognome);
$al->password = get_password($al->nome, $al->cognome, &$al->clean_pwd);
//print ($al->username).":".$al->password."<br/>";
$upd = "UPDATE alunni SET username = '" . $al->username . "', password = '" . $al->password . "' WHERE id_alunno = " . $al->id_alunno;
$r = $db->execute($upd);
$str_log = $al->nome . " " . $al->cognome . ":" . $al->username . ":" . $al->password . ":" . $al->clean_pwd . "\n";
fwrite($log_file, $str_log);
}
}
} else {
}
?>
<html>
<head>
<title>Creazione account</title>
示例12: logout
}
}
function logout()
{
setcookie("auth", '', 0, "/");
echo "Logged out";
}
if (!init_db(get_server_config())) {
error_page("can't open DB");
}
$action = get_str("action", true);
if ($action == "login") {
login_action();
exit;
}
$source = get_login();
if (!$source) {
login_page();
exit;
}
switch ($action) {
case 'edit_store_action':
edit_store_action();
break;
case 'edit_store_form':
edit_store_form();
break;
case 'file_search_action':
file_search_action();
break;
case 'file_search_form':
示例13: GiftOrderedTarif
/**
* Взять заявки по определенному тарифу
*
* @param integer $bill_id ИД оплаты
* @param integer $gift_id ИД подарка
* @param integer $gid ИД подарка
* @param integer $fid ИД пользователя
* @param integer $transaction_id ИД транзакции
* @param integer $time Время
* @param integer $comments Комментарий оплаты
* @param integer $tarif ИД Тарифа (см. таблицу op_codes)
* @return array Данные выборки
*/
function GiftOrderedTarif(&$bill_id, &$gift_id, $gid, $fid, $transaction_id, $time, $comments = "Аккаунт PRO в подарок", $tarif = 52)
{
global $DB;
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
$account = new account();
$error = $account->Gift($bill_id, $gift_id, $transaction_id, $tarif, $fid, $gid, "Все разделы", $comments, 10 * ($tarif == 52 || $tarif == 16 ? $time : 1));
if (!$error) {
$sql = "INSERT INTO orders (from_id, to_date, tarif, ordered, billing_id, payed) VALUES (?, ?, ?, true, ?, true)";
if ($DB->query($sql, $gid, is_numeric($time) ? "{$time} month" : $time, $tarif, $bill_id)) {
$login = get_login($gid);
if ($gid == $_SESSION['uid'] && !is_pro()) {
$_SESSION['is_pro_new'] = 't';
}
if ($gid == $_SESSION['uid']) {
$pro_last = payed::ProLast($login);
$_SESSION['pro_last'] = $pro_last['freeze_to'] ? false : $pro_last['cnt'];
} else {
$session = new session();
$session->UpdateProEndingDate($login);
}
return true;
}
}
return false;
}
示例14: date
$date2 = date('Y-m-d', strtotime($date2));
echo "<span class='heure'>" . $date2 . "</span>";
echo "<span class='texte'>" . $post['content'] . "</span>";
echo "<img src='" . $post['link'] . "'/>";
echo "<img class='pp' src='upload/profilpictures/" . get_pp($login) . "'/>";
echo "<a href='profile?login=" . $login . "'><span class='login'>" . $login . "</span></a>";
//echo "<span class='heure'> report content(" . $post['report'] .") </span>";
echo "<span class='like'>" . get_nblike($post['id']) . " likes - <span class='opencomments'>";
echo get_nb_comments($post['id']) . " comments </span></span>";
$comments = get_comments($post['id']);
echo "<div class='comments active'>";
foreach ($comments as $com) {
$date = $com['timedate'];
$date = date('d/m/Y', strtotime($date));
echo "<div class='com'>";
$user = get_login($com['idusercible']);
echo "<div class='userinfos'><img class='pp' src='upload/profilpictures/" . get_pp($user) . "'/>";
echo "<a href='profile?login=" . $login . "'><span class='login'> Par " . $user . " le " . $date . "</span></a> </div>";
echo "<div class='texte'>" . $com['content'] . "</div>";
echo "</div>";
}
if (isset($_SESSION['login'])) {
?>
<form action="model/comments.php" name="commenter" method="post">
<input type="hidden" name="idpost" value="<?php
echo $post['id'];
?>
"/>
<input type="hidden" name="iduser" value="<?php
echo $post['iduser'];
?>
示例15: UpdateFoto
/**
* Обновляет фото пользователя
*
* @param integer $fid id пользователя
* @param object $foto файл фотографии
* @param integer $del флаг удаления фото (1 - удалить, 0 - перезакачаь)
* @return string текст ошибки в случае неуспеха
*/
function UpdateFoto($fid, $foto, $del)
{
// если юзер меняет аватар пока предыдущий еще не отмодерирован - будет история изменений
$aChange = $GLOBALS['DB']->row("SELECT id, old_val, new_val FROM users_change WHERE user_id = ?i AND ucolumn = 'photo'", $fid);
$aDelFile = array();
// файлы которые нужно будет удалять сразу
$dir = get_login($fid);
$err = "";
if (!$dir) {
$error = "Имя пользователя не определено";
}
$this->photo = $this->GetField($fid, $err, "photo");
$old_foto = $this->photo;
$error .= $err;
if ($del == 1) {
$this->photo = "";
} else {
if ($foto && !$error) {
$foto->max_size = 102400000;
$foto->max_image_size = array('width' => 100, 'height' => 100, 'less' => 0);
$foto->resize = 1;
$foto->proportional = 1;
$foto->topfill = 1;
$cFile->crop = 1;
$foto->allowed_ext = array_diff($GLOBALS['graf_array'], array('swf', 'gif'));
$this->photo = $foto->MoveUploadedFile($dir . "/foto");
$error .= $foto->StrError('<br />');
if (!$error && !$foto->img_to_small("sm_" . $this->photo, array('width' => 50, 'height' => 50))) {
$error .= "Невозможно уменьшить картинку.";
}
}
}
if (!$error) {
$error .= $this->Update($fid, $res);
// определяемся какие файлы нужно удалить
if ($del == 1) {
// удаляем аватар
if ($aChange) {
// если хранили версии аватара на случай возврата - то грохаем обе
if ($aChange['old_val']) {
$aDelFile[] = $aChange['old_val'];
}
$aDelFile[] = $aChange['new_val'];
} else {
// иначе просто грохаем аватар
$aDelFile[] = $old_foto;
}
} elseif ($foto) {
// меняем аватар
if ($aChange && $aChange['new_val']) {
// грохаем только промежуточную версию, если была
$aDelFile[] = $aChange['new_val'];
}
}
}
// удаление не нужных файлов (если нет ошибок при сохранении разумеется)
if ($aDelFile && !$error) {
foreach ($aDelFile as $file) {
$foto->Delete(0, "users/" . substr($dir, 0, 2) . "/" . $dir . "/foto/", $file);
$foto->Delete(0, "users/" . substr($dir, 0, 2) . "/" . $dir . "/foto/", "sm_" . $file);
}
}
return $error;
}