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


PHP users::fetch方法代码示例

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


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

示例1: get_users

function get_users()
{
    $obj = new users();
    $result = $obj->get_all_users();
    if ($result) {
        while ($row = $obj->fetch()) {
            echo $row['username'];
            echo "<br>";
            echo $row['user_type'];
            echo "<br>";
            echo $row['permission'];
            echo "<br>";
        }
    }
}
开发者ID:Wainaina3,项目名称:pos,代码行数:15,代码来源:user_func.php

示例2: htmlentities

    $var = htmlentities($var);
    $var = strip_tags($var);
    return $var;
}
if (isset($_REQUEST['user'])) {
    $obj = new users();
    $user = $_REQUEST['user'];
    $pass = sanitizeString($_REQUEST['pass']);
    $pass_encrypt = $obj->encrypt("{$pass}");
    if ($user == "" || $pass == "") {
        echo 'not all fields have been filled';
    } else {
        if (!$obj->get_user($user)) {
            echo 'invalid username or password';
        } else {
            $row = $obj->fetch();
            $password = $row['password'];
            if ($password == $pass_encrypt) {
                if ($row['admin'] == 0) {
                    session_start();
                    $id = $row['id'];
                    echo $id;
                    include_once 'nurses.php';
                    $user_nurse = new nurses();
                    $user_nurse->get_nurse($id);
                    $user_row = $user_nurse->fetch();
                    $_SESSION['user'] = $user;
                    $_SESSION['fname'] = $user_row['nurse_fname'];
                    $_SESSION['sname'] = $user_row['nurse_sname'];
                    $_SESSION['id'] = $id;
                    $_SESSION['admin'] = false;
开发者ID:kennethmensah,项目名称:software_engineering_project,代码行数:31,代码来源:login.php

示例3: searchUser

function searchUser()
{
    if (!isset($_REQUEST['st'])) {
        //return error
        echo '{"result":0,"message": "search did not work."}';
    }
    $txt = $_REQUEST['st'];
    include "users.php";
    $obj = new users();
    if (!$obj->searchUsers($txt)) {
        //return error
        echo '{"result":0,"message": "search did not work."}';
        return;
    }
    //at this point the search has been successful.
    //generate the JSON message to echo to the browser
    $row = $obj->fetch();
    echo '{"result":1,"users":[';
    //start of json object
    while ($row) {
        echo json_encode($row);
        //convert the result array to json object
        $row = $obj->fetch();
        if ($row) {
            echo ",";
            //if there are more rows, add comma
        }
    }
    echo "]}";
    //end of json array and object
}
开发者ID:Wainaina3,项目名称:pos,代码行数:31,代码来源:userManipulation.php

示例4: users

echo $_SERVER['PHP_SELF'];
?>
 " method="POST"> 
	<input type="text" name="username" id="username" size="30">
	<input type="text" name="userpass" id="userpass" size="30">
	<input type="submit" value="Login" >
	</form>
	
	<?php 
include "users.php";
if (!empty($_REQUEST['username'])) {
    $obj = new users();
    $usname = $_REQUEST['username'];
    $uspass = $_REQUEST['userpass'];
    $sql = "select * from users where user_name='{$usname}' and user_pass='{$uspass}'";
    $obj->query($sql);
    $res = $obj->fetch();
    if (isset($res['user_name'])) {
        session_start();
        $_SESSION['user_name'] = $res['user_name'];
        $_SESSION['user_type'] = $res['user_type'];
        $_SESSION['user_id'] = $res['user_id'];
        header('location:search.php');
        echo "<script> window.locatioin='search.php' </script>";
    }
    echo "Wrong User name or password";
}
?>
	</body>

</html>
开发者ID:Wainaina3,项目名称:pos,代码行数:31,代码来源:login.php


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