示例#1
0
文件: install.php 项目: npk/falcon
    $DB_site->server = $dbhost;
    $DB_site->user = $dbuser;
    $DB_site->password = $dbpass;
    $DB_site->connect();
}
if ($_GET['step'] == 3) {
    echo "<div class=\"step3\">";
    /**
     * // ------------------------------ -------- ------------------------------ //
     * STEP 3
     * // ------------------------------ -------- ------------------------------ //
     */
    echo "<div class=\"creat\">";
    if ($_GET['reset'] == 1) {
        echo "<p>正在重置数据库...";
        $result = $DB_site->query("SHOW tables");
        while ($currow = $DB_site->fetch_array($result)) {
            $DB_site->query("DROP TABLE IF EXISTS {$currow['0']}");
        }
        echo "已成功</p>";
    }
    $DB_site->reporterror = 0;
    $query[] = "CREATE TABLE {$table1} (\n`id` INT( 3 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n`username` VARCHAR( 30 ) NOT NULL ,\n`password` VARCHAR( 30 ) NOT NULL\n) ENGINE = MYISAM ";
    $explain[] = "创建 {$table1} 数据表";
    $query[] = "CREATE TABLE {$table2} (\n`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n`ip` VARCHAR( 40 ) NULL DEFAULT NULL ,\n`content` VARCHAR( 100 ) NULL DEFAULT NULL ,\n`source` TEXT( 65500 ) NULL DEFAULT NULL ,\n`level` INT( 11 ) NOT NULL DEFAULT '1',\n`remove` INT( 11 ) NOT NULL DEFAULT '0',\n`date` DATETIME NULL DEFAULT NULL\n) ENGINE = MYISAM \n";
    $explain[] = "创建 {$table2} 数据表";
    $time = date('Y-m-d H:m:s');
    $query[] = "INSERT INTO {$table2} VALUES (1,'127.0.0.1', '这是一条测试数据', 'this is sourcecode', '1','','{$time}')";
    doqueries();
    echo "</div>";
    if ($DB_site->errno != 0) {
示例#2
0
文件: login.php 项目: hewenhua/falcon
require_once 'vemplator.php';
$t = new vemplator();
$DB_site = new DB_Sql_vb();
$DB_site->database = $dbname;
$DB_site->server = $dbhost;
$DB_site->user = $dbuser;
$DB_site->password = $dbpass;
$DB_site->reporterror = 0;
$DB_site->connect();
$error = $DB_site->errno;
$t = new vemplator();
if (isset($_POST['submit']) && ctype_alnum($_POST['username'])) {
    $username = empty($_POST['username']) ? '' : trim($_POST['username']);
    $password = empty($_POST['password']) ? '' : trim($_POST['password']);
    $sql = "select username,password from {$table1} where username='******'and password='******'";
    $DB_site->query($sql);
    if ($DB_site->num_rows()) {
        $sid = session_id();
        $_SESSION['username'] = $sid;
        header('Location: index.php');
    } else {
        $message = "登录失败,密码或用户名错!";
        $t->assign('message', $message);
    }
}
echo $t->output('html/login.html');
include "footer.php";
?>
</div>
</body>
</html>