當前位置: 首頁>>代碼示例>>PHP>>正文


PHP factory::user方法代碼示例

本文整理匯總了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);
開發者ID:CodeEmperor,項目名稱:inba,代碼行數:31,代碼來源:upload.php

示例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';
開發者ID:CodeEmperor,項目名稱:inba,代碼行數:31,代碼來源:register.php

示例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) {
開發者ID:CodeEmperor,項目名稱:inba,代碼行數:31,代碼來源:zaloguj.php

示例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';
開發者ID:CodeEmperor,項目名稱:inba,代碼行數:31,代碼來源:users.php


注:本文中的factory::user方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。