2002-04-30 22:22:54 +00:00
|
|
|
<?php
|
|
|
|
|
2002-11-08 17:21:45 +00:00
|
|
|
// database-related functions.
|
|
|
|
// Presentation code (HTML) shouldn't be here
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
function db_init() {
|
2002-05-29 23:25:21 +00:00
|
|
|
$retval = mysql_pconnect();
|
|
|
|
if (!$retval) {
|
|
|
|
exit();
|
|
|
|
}
|
2002-08-27 04:59:55 +00:00
|
|
|
$fp = fopen("db_name", "r");
|
2002-08-05 23:20:57 +00:00
|
|
|
$db_name = fgets($fp, 1024);
|
2002-08-06 21:18:03 +00:00
|
|
|
$db_name = rtrim($db_name);
|
2002-08-05 23:20:57 +00:00
|
|
|
mysql_select_db($db_name);
|
|
|
|
fclose($fp);
|
2002-08-12 22:16:34 +00:00
|
|
|
return $db_name;
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function lookup_user_auth($auth) {
|
|
|
|
$result = mysql_query("select * from user where authenticator='$auth'");
|
2002-08-12 22:16:34 +00:00
|
|
|
if ($result) {
|
|
|
|
$user = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
|
|
|
return $user;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|