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


PHP check_valid_user函数代码示例

本文整理汇总了PHP中check_valid_user函数的典型用法代码示例。如果您正苦于以下问题:PHP check_valid_user函数的具体用法?PHP check_valid_user怎么用?PHP check_valid_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: session_start

session_start();
//create short variable names
$username = isset($_POST["username"]) ? $_POST["username"] : "";
$password = isset($_POST["password"]) ? $_POST["password"] : "";
//first check whether the user has come from the front page by filling out the form
if ($username && $password) {
    //they have just tried to log in
    try {
        login($username, $password);
        //if they are in the database (as in they are a member), register their username to the session ID variable called valid_user
        $_SESSION["valid_user"] = $username;
    } catch (Exception $e) {
        //unsuccessful login
        do_html_header("Problem: ");
        echo "We could not log you in. You must be logged in to view this page.";
        do_html_url("login.php", "Login");
        do_html_footer();
        exit;
    }
}
//start the display
do_html_header("Home");
check_valid_user();
//get the bookmarks this user has saved
if ($url_array = get_user_urls($_SESSION["valid_user"])) {
    //gilho instead of session valid user
    display_user_urls($url_array);
}
//give menu options
display_user_menu();
do_html_footer();
开发者ID:HoGil,项目名称:phpUrlApp,代码行数:31,代码来源:member.php

示例2: session_start

session_start();
require_once '../function/data_holder.php';
require_once '../includes/output.html.php';
require_once '../database/connection.php';
require_once '../function/bog_info.php';
$conn = connection();
// database connection
error_reporting(0);
add_header("TodoLists");
?>
<div class='container'>
       <div class='row'>
         <div class='wrapper'>       
            <?php 
if (!check_valid_user()) {
    header("Location: http://time-box.tk//login.php?");
} else {
    ?>
              <?php 
    if (isset($_POST['submit'])) {
        // create short varibles
        $todo_list_name = stripslashes($_POST['TodoList_name']);
        $description = stripslashes($_POST['description']);
        $due_date = $_POST['due_date'];
        // find user todo_list_id
        try {
            $user = "SELECT * FROM users WHERE email='" . $_SESSION['valid_user'] . "'";
            $query = $conn->query($user);
            if ($query->num_rows) {
                while ($row = $query->fetch_assoc()) {
开发者ID:emmanuelal,项目名称:Todo_List-ported-to-PHP,代码行数:30,代码来源:new_todolist.php

示例3: session_start

<?php

$php_root_path = "..";
$privilege_root_path = "/admin";
require_once "includes/include_all_fns.inc";
session_start();
global $valid_user;
extract($_GET, EXTR_REFS);
$err_message = " Unable to process your request due to the following problems: <br>\n";
if (!check_valid_user(&$err_message)) {
    //This user is not login
    do_html_header("View File Failed", &$err_message);
    $err_message .= " Sorry, You must login to view this file. <br>\n";
    $err_message .= "<br><br> Go to <a href='{$php_root_path}/index.php'>Login</a> page.";
    do_html_footer(&$err_message);
    exit;
}
$db = adodb_connect(&$err_message);
if (!$db) {
    do_html_header("View File Failed", &$err_message);
    $err_message .= " Could not connect to database server - please try later.<br>\n";
    $err_message .= "<br><br> Try <a href='view_file.php?fileid=" . $_GET["fileid"] . "'>again</a>?";
    do_html_footer(&$err_message);
    exit;
}
$sql = "SELECT File,FileName,FileSize,FileType FROM " . $GLOBALS["DB_PREFIX"] . "File F , " . $GLOBALS["DB_PREFIX"] . "Paper P";
$sql .= " WHERE F.FileID=" . $_GET["fileid"] . " AND F.PaperID=P.PaperID";
$result = $db->Execute($sql);
$rows = $result->RecordCount();
if (!$result) {
    do_html_header("View File Failed", &$err_message);
开发者ID:alexzita,项目名称:alex_blog,代码行数:31,代码来源:view_file.php

示例4:

<?php

require_once '/home/newvis8/public_html/php/db_util.php';
require_once '/home/newvis8/public_html/php/session.php';
require_once '/home/newvis8/public_html/Templates/header_section.php';
echo <<<BODY_BEGIN
\t<body onload="MM_preloadImages('../img/icons/nvc_grey.png','../img/icons/pathway_grey.png','../img/icons/lighthouse.png','../img/icons/lighthouse_jr.png','../img/icons/aja_big.png')">
    <div id="wrapper" class="wrapper">
BODY_BEGIN;
//connect mysql database and retrieve NVC press dept. member list after verify that user is logged in.
if (check_valid_user()) {
    //logo section
    require_once '/home/newvis8/public_html/Templates/logo_login_section.php';
    //top-nav section
    require_once '/home/newvis8/public_html/Templates/top_nav_section.php';
    //slider section
    require_once '/home/newvis8/public_html/Templates/slider_section.php';
    //footer section
    //require_once('/home/newvis8/public_html/Templates/footer_section.php');
} else {
    echo "<h2>Please log in first before access NVC Press Team specific pages<h2><br />";
    echo "<h2><a href='login.html'>Login Page</a><h2><br />";
    echo "<h2><a href='index.html'>Home Page</a></h2>";
}
echo <<<BODY_END
\t</body>
\t</div><!--wrapper-->
BODY_END
;
开发者ID:nvcpress,项目名称:nvcpress_web30,代码行数:29,代码来源:login_required_msg.php


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