Source of /mysql.php


<?
if ($_SERVER['SCRIPT_FILENAME'] == __FILE__)
{
    
$allowviewsource = 1;
    require_once(
"common.php");
    if (!isset(
$_REQUEST['viewsource']))
        
error_page("This page cannot be viewed alone.");
}
require_once(
"mysql_passwords.php");

function
db_errorpage($msg)
{
    require_once(
"common.php");
    
$e = mysql_error();
    if (
$e)
        
error_page("$msg\n$e", 1);
    else
        
error_page("$msg", 1);
}
function
db_connect($user, $db)
{
    global
$mysql_passwords;
    
$conn = @mysql_connect("mrphlip.db", "$user", $mysql_passwords[$user]);
    if (!
$conn)
        
db_errorpage("Could not connect to database server");
    if (!
mysql_select_db("$db", $conn))
        
db_errorpage("Could not select database \"$db\"");
    return
$conn;
}
function
db_query($sql, $conn)
{
    
$result = mysql_query($sql, $conn);
    if (!
$result)
        
db_errorpage("Query failed: $sql");
    if (
$result === TRUE)
        return
mysql_affected_rows($conn);
    
$rows = array();
    while (
$row = mysql_fetch_assoc($result))
        
$rows[] = $row;
    return
$rows;
}
function
db_close($conn)
{
    
mysql_close($conn);
}
function
db_fromdatetime($datetime)
{
    if (!
preg_match('/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/', $datetime, $matches))
        return -
1;
    return
mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
}
?>


Valid HTML 4.01 StrictValid CSSLevel Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0
Retrieved from https://​www.mrphlip.com/​mysql.php?​viewsource=yep.
Copyright © 2006–13 Phillip Bradbury. Some rights reserved.
This page is best viewed in a web browser at a screen resolution. Attempts to do otherwise may fail miserably.
Contact me