git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit c47de27c authored by Evan Prodromou's avatar Evan Prodromou

beginnings of PHP

darcs-hash:20080507164807-84dde-ef7d205a0fedca42064a337786d2f203cdcc5a45.gz
parent d0e8a3b9
<?php
function handle_login() {
if ($_REQUEST['METHOD'] == 'POST') {
if (login_check_user($_REQUEST['user'], $_REQUEST['password'])) {
} else {
}
} else {
if (user_logged_in()) {
} else {
login_show_form();
}
}
}
function login_show_form() {
html_start();
html_head("Login");
html_body();
}
function login_check_user($username, $password) {
}
\ No newline at end of file
<?php
function handle_showstream() {
$profile_name = $_REQUEST['profile'];
}
<?php
# global configuration object
// default configuration, overwritten in config.php
$config =
array('site' =>
array('name' => 'Just another µB'),
'dsn' =>
array('phptype' => 'mysql',
'username' => 'stoica',
'password' => 'apasswd',
'hostspec' => 'localhost',
'database' => 'thedb')
'dboptions' =>
array('debug' => 2,
'portability' => DB_PORTABILITY_ALL));
require_once(INSTALLDIR . '/config.php');
require_once('DB.php');
function common_database() {
global $config;
$db =& DB::connect($config['dsn'], $config['dboptions']);
if (PEAR::isError($db)) {
common_server_error($db->getMessage());
} else {
return $db;
}
}
function common_read_database() {
// XXX: read from slave server
return common_database();
}
function common_server_error($msg) {
header('Status: 500 Server Error');
header('Content-type: text/plain');
print $msg;
exit();
}
<?php
$dsn = array(
'phptype' => 'pgsql',
'username' => 'someuser',
'password' => 'apasswd',
'hostspec' => 'localhost',
'database' => 'thedb',
);
$options = array(
'debug' => 2,
'portability' => DB_PORTABILITY_ALL,
);
$db =& DB::connect($dsn, $options);
if (PEAR::isError($db)) {
die($db->getMessage());
}
$config['db'] =
array( 'username' => 'stoica',
'password' => 'replaceme',
<?php
define('INSTALLDIR', dirname(__FILE__));
require_once(INSTALLDIR . "/common.php");
$action = $_REQUEST['action'];
$actionfile = INSTALLDIR."/actions/$action.php";
if (file_exists($actionfile)) {
require_once($actionfile);
$action_function = 'handle_' . $action;
if (function_exists($action_function)) {
call_user_func($action_function);
} else {
// redirect to main
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment