Example #1
0
<?php

require_once '../configure.php';
loadLocalConf('secrect.conf');
if (!$argv[1]) {
    print "generate hash for this system.\n";
    print "input password !\n";
    exit;
} else {
    $md5 = md5($argv[1] . PASSWORD_SEED);
    print "md5 = {$md5}\n";
}
Example #2
0
<?php

loadLocalConf('db.conf');
class BaseDB
{
    const ERROR_NO_SESSION = 'you do not login ! you need to login.';
    protected $pdo;
    function __construct($options = null)
    {
        $this->pdo = $options['PDO'];
        if (!$this->pdo) {
            $this->pdo = new PDO(sprintf("mysql:dbname=%s;host=%s", DB_NAME, DB_HOST), DB_USERNAME, DB_PASSWORD);
            $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $this->pdo->query("SET NAMES utf8;");
        }
    }
}