本文整理汇总了PHP中factory::user方法的典型用法代码示例。如果您正苦于以下问题:PHP factory::user方法的具体用法?PHP factory::user怎么用?PHP factory::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类factory
的用法示例。
在下文中一共展示了factory::user方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: session_start
<?php
session_start();
ob_start();
/*
* This site check and savesan image added by user.
*/
require_once 'loader.php';
try {
$check_session = factory::user();
if ($check_session->check_session() == true) {
$check_session->check_admin();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$title = $_POST['title'];
$text = $_POST['text'];
$filename = $_FILES['img']['name'];
$rozmiar0 = $_FILES['img']['size'];
$rodzaj = $_FILES['img']['type'];
try {
if ($title != null && $text != null && $filename != null && $rozmiar0 != null) {
$file_info = upload::getInfo($title, $rozmiar0, $rodzaj, $text);
//Title
echo nl2br($file_info[0]);
//Size in MB
echo nl2br($file_info[1]);
//Description
echo nl2br($file_info[3]);
//Type of image
echo nl2br($file_info[2]);
$object = factory::upload_factory();
$object->sprawdz_bledy($_FILES['img']['error']);
$check = $object->sprawdz_typ($filename);
示例2: session_start
session_start();
require_once 'loader.php';
/*
* Here, you can register a new user account.
*/
try {
$check_session = factory::user();
if ($check_session->check_session() == true) {
echo '<a href="http://projects.e-kei.pl/inba/upload.php"><h1 class="text-center" style="color:grey;">Przejdź na stronę wysyłania pliku</h1></a>';
} else {
include 'form/register_form.html';
}
} catch (Exception $e) {
echo nl2br("<h1 class=\"text-center\" style=\"color:grey;\">" . $e->getMessage() . "</h1>\n");
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
try {
if (!empty($_POST['login']) && !empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['password_repeat'])) {
if ($_POST['password'] == $_POST['password_repeat']) {
$register = factory::user();
$register->register($_POST['login'], $_POST['password'], $_POST['email']);
echo nl2br("<h1 class=\"text-center\" style=\"color:grey;\">Rejestracja pomyślna!</h1>\n");
} else {
throw new InvalidArgumentException("Podane hasła nie zgadzają się!");
}
}
} catch (Exception $e) {
echo nl2br("<h1 class=\"text-center\" style=\"color:grey;\">" . $e->getMessage() . "</h1>\n");
}
}
include 'footer.html';
示例3: session_start
<?php
session_start();
require_once 'loader.php';
/*
* This site allows you to login in your account on website.
*/
$check_session = factory::user();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
try {
if ($check_session->check_session() != true) {
if (!empty($_POST['login']) && !empty($_POST['password'])) {
$login = $_POST['login'];
$password = $_POST['password'];
$logowanie = factory::user();
$logowanie->login($login, $password);
}
}
} catch (Exception $e) {
echo nl2br("<h1 class=\"text-center\" style=\"color:grey;\">Wystąpił błąd o komunikacie: " . $e->getMessage() . "</h1>\n");
}
}
try {
if ($check_session->check_session() == true) {
$check_session->check_admin();
} else {
include 'form/login_form.html';
echo '<a href="http://projects.e-kei.pl/inba/register.php"><h1 class="text-center white">Nie masz konta? Zarejestruj się!</h1></a>';
throw new Exception('Logowanie');
}
} catch (Exception $e) {
示例4: Exception
echo '<tr>
<td>' . $row['login'] . '</td>
<td>' . $row['email'] . '</td>
<td>' . $row['permissions'] . '</td>
<td><a href="http://projects.e-kei.pl/inba/users.php?delete=true&id=' . $row['id'] . ' "><p class="img2" style="color:red;"><i class="fa fa-times fa-2x"></i></p></a>
</td>
</tr>';
}
echo " </table><hr>";
} else {
throw new Exception('Niestety, nie masz uprawnień do przeglądania tej strony!');
}
} else {
throw new Exception('Zaloguj się!!');
}
} catch (Exception $e) {
echo '<h1 class="text-center grey">' . $e->getMessage() . '</h1>';
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
try {
if (isset($_GET['delete']) && isset($_GET['id'])) {
$decision = factory::user();
$decision->delete((int) $_GET['id']);
header("refresh:1;url=http://projects.e-kei.pl/inba/users.php");
}
} catch (Exception $e) {
echo 'Wystąpił błąd bazy danych: ' . $e->getMessage();
}
}
ob_end_flush();
include 'footer.html';