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


PHP USER::loggedin方法代码示例

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


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

示例1: USER

<?php

include_once 'php/config.php';
define("PAGENAME", "Create New");
include_once 'include/header.php';
$user = new USER($conn);
if (!$user->loggedin()) {
    $user->redirect('login');
}
$userID = $_SESSION['user_session'];
$stmt = $conn->prepare("SELECT * FROM user WHERE userID=:userID");
$stmt->execute(array(":userID" => $userID));
$userRow = $stmt->fetch(PDO::FETCH_ASSOC);
if (isset($_POST['send_post'])) {
    $title = trim($_POST['title']);
    $subtitle = trim($_POST['subtitle']);
    $preview = trim($_POST['preview']);
    $main_text = trim($_POST['main_text']);
    //improving quality of the code, adding empty method to check for empty variables
    if (empty($title)) {
        $error[] = "Oh no! You need a title for your post!";
    } else {
        if (empty($subtitle)) {
            $error[] = "Oh no! You need a subtitle for your post!";
        } else {
            if (empty($preview)) {
                $error[] = "Oh no! What's your extract?";
            } else {
                if (empty($main_text)) {
                    $error[] = "Oh no! C'mon, you need to write your post! This is a blog, afterall!";
                } else {
开发者ID:IrinaTheNerd,项目名称:bloggie,代码行数:31,代码来源:new_post.php

示例2:

?>
 </title>


			<link href="css/import.css" rel="stylesheet" type="text/css">
			<meta name="viewport" content="width=device-width, initial-scale=1">
			<!-- meta tags for SEO-->
			<meta name="description" content="Bloggie, content oriented blogging platform">
			<meta http-equiv="content-type" content="text/html;charset=UTF-8">

		</head>
		<body>
			<!-- Navigation -->

				<?php 
if (!$session->loggedin()) {
    ?>
				<nav>
				<div class="first">
					<a href="index"><img src="img/logo-small.png" alt="logo, or get back to the index page" class="logo" width="100" height="77"></a>
					<!-- only shows up on a mobile device: tablet or a phone -->
					<span class="icon-search responsive hidden"></span>
				</div>

				<div class="middle">
					<a href="all_posts">latest blogs</a>
				</div>
				<div class="middle">
					<a href="login">login</a>
				</div>
				<div class="middle">
开发者ID:IrinaTheNerd,项目名称:bloggie,代码行数:31,代码来源:header.php

示例3: USER

<?php

require_once 'php/session.php';
require_once 'php/user.php';
//new user object
$user_logout = new USER($conn);
//if user login has a session redirects to index
if ($user_logout->loggedin() != "") {
    $user_logout->redirect('index');
}
//if the session and url gets logout then logout and redirect
if (isset($_GET['logout']) && $_GET['logout'] == "true") {
    $user_logout->logout();
    $user_logout->redirect('index.php');
}
开发者ID:IrinaTheNerd,项目名称:bloggie,代码行数:15,代码来源:logout.php

示例4: USER

<?php

include_once 'php/config.php';
define("PAGENAME", "Register");
include_once 'include/header.php';
$user = new USER($conn);
//creating object user
if ($user->loggedin() != "") {
    $user->redirect('dashboard.php');
    //redirect to dashboard
}
//once signup input is clicked ...
if (isset($_POST['signup'])) {
    //getting rid of whitespace around sqlite_unbuffered_query
    $email = trim($_POST['email']);
    $password = trim($_POST['password']);
    $confirmed_password = trim($_POST['confirm_password']);
    //checking whether the form is filled correctly
    if ($email == "") {
        $error[] = "Provide your email!";
    } else {
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $error[] = 'Please enter a valid email address!';
        } else {
            if ($password == "") {
                $error[] = "Provide a password!";
            } else {
                if (strlen($password) < 6) {
                    $error[] = "Password must be atleast 6 characters";
                } else {
                    if (strlen($confirmed_password) < 6) {
开发者ID:IrinaTheNerd,项目名称:bloggie,代码行数:31,代码来源:register.php

示例5: USER

<?php

include_once 'php/config.php';
$login = new USER($conn);
define("PAGENAME", "Login");
include_once 'include/header.php';
//if logged in already rediret
if ($login->loggedin() != "") {
    $login->redirect('dashboard');
}
//if not, then check details through running a method
if (isset($_POST['login_button'])) {
    $email = $_POST['email'];
    $pass = $_POST['password'];
    if ($login->login($email, $pass)) {
        $login->redirect('dashboard');
    } else {
        $error = "Wrong Details!";
    }
}
?>

				<header class="big-header">
						<h1 class="no-margin">Please, log in</h1>
			</header>

			<div class="intro bottom-margin">
				<form method="post" class="inputs feat first">
					<div class="light-green">
						<h2>Just fill in your details</h2>
					</div>
开发者ID:IrinaTheNerd,项目名称:bloggie,代码行数:31,代码来源:login.php


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