示例#1
0
function &open_dod_master()
{
    $host = ysecure_get_key("dd.dod.host");
    $port = ysecure_get_key("dd.dod.port");
    $dbname = ysecure_get_key("dd.dod.dbname");
    $user = ysecure_get_key("dd.dod.dbuser");
    $password = ysecure_get_key("dd.dod.dbpwd");
    $dsn = "pgsql:host={$host} port={$port} dbname={$dbname}";
    /*
    	$user = '******';
    	$password = '******';
    	$dsn = "pgsql:host=pi1.sds.cnb.yahoo.com port=5432 dbname=dod";
    */
    try {
        $pgdbh = new PDO($dsn, $user, $password);
        return $pgdbh;
    } catch (PDOException $e) {
        error_log('PG Connection failed: ' . $e->getMessage() . "\n");
    }
}
}
$view_pruned = false;
if (isset($_GET['view_pruned'])) {
    $view_pruned = true;
}
?>


<html>
<head>
</head>
<body>
<?php 
include '/home/y/share/htdocs/ztcommon/commonvars.inc.php';
$log = fopen($logdir . "log_happenings.txt", "a+");
$dbpassword = ysecure_get_key('ztroot');
if (!$dbpassword) {
    fwrite($log, "Could not get password");
}
$link = mysql_connect('localhost', 'ztroot', $dbpassword);
if (!$link) {
    fwrite($log, '$logID:Could not connect : ' . mysql_error() . "\n\n");
    fclose($log);
    die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('happenings', $link);
if (!$db_selected) {
    fwrite($log, '$logID:Cannnot use happenings : ' . mysql_error() . "\n\n");
    fclose($log);
    die('Cannnot use happenings : ' . mysql_error());
}