Esempio n. 1
0
<?php

#date_default_timezone_set('RPC');
$dsn = "mysql:host=localhost;dbname=zero_php";
$pdo = new PDO($dsn, "root", "root");
#$result = $pdo->exec($sql); // 用于insert update delete
$sql = "select * from zp_user order by uuid desc";
$result = $pdo->query($sql);
// $userList = NULL;
if (!$result) {
    $userList = $pdo->errorinfo();
}
$userList = $pdo->query($sql);
// 用于select
include_once zeroPath('/pages/index.php');
exit;
foreach ($userList as $user) {
    // var_dump($user);
    echo "username============>" . $user['user_name'] . "<br>";
    echo "password============>" . $user['password'] . "<br>";
    if ($user['sex'] == 0) {
        echo "sex============>女<br>";
    } else {
        echo "sex============>男<br>";
    }
    echo "age============>" . $user['age'] . "<br>";
    echo "avatar============>" . $user['avatar'] . "<br>";
    echo "login_time============>" . $user['time'] . "<br>";
    echo "last_time============>" . $user['last_time'] . "<br>";
    echo "login_ip============>" . $user['login_ip'] . "<br>";
    echo "-------------------------------------------------------------------------------<br>";
Esempio n. 2
0
<?php

require_once 'config.php';
$c = $_GET['c'];
$modules = array('user', "pdo");
if (!in_array($c, $modules)) {
    include_once zeroPath('/error/404.php');
} else {
    $c = ucfirst($c);
    // 首字母大写
    include_once zeroPath('/controller/' . $c . 'Controller.php');
}
Esempio n. 3
0
<?php

/**
 *	MYSQL 的封装
 **/
require_once zeroPath('/common/config.php');
class Mysql
{
    private $host;
    // 数据库服务器的ip地址
    private $username;
    // 数据库的用户名称
    private $password;
    // 数据库的用户密码
    private $dbname;
    // 数据库的名称
    private $conn;
    // 连接数据库的句柄
    function __construct($host = DB_HOST, $username = DB_USER_NAME, $password = DB_PASSWORD, $dbname = DB_NAME)
    {
        $this->host = $host;
        $this->username = $username;
        $this->password = $password;
        $this->dbname = $dbname;
        // echo $this->host." ,". $this->password." ,". $thisnavl-v7nn-ejxq-fqm4->password;
        // $this->conn = mysql_connect($this->host, $this->password, $this->password, true);
        $this->conn = mysql_pconnect($this->host, $this->password, $this->password, true);
        if (!$this->conn) {
            if (file_exists("/tmp/log/zero_php.log")) {
                fopen("/tmp/log/zero_php.log", "w");
            }
Esempio n. 4
0
a<?php 
require_once zeroPath('Mysql.class.php');
$uuid = getUuid();
$sql = "insert into zp_user (uuid, user_name, password, sex, age, avatar, time, login_ip) values ('" . $uuid . "', 'zero', '" . md5('111111') . "', 1, 25, 'http://pics.sc.chinaz.com/files/pic/pic9/201511/apic16807.jpg', '" . date('Y:m:d h:i:s', time()) . "', '" . getIp() . "')";
$result = $db->adu($sql);