Location: PHPKode > projects > HypatiaDB > hypatiadb/index.php
<?php

//If the following conditional is true, then 'index.php' has been loaded as a result of
//a user selecting the File->Exit menu option. As a result, we destroy the current PHP 
//sesssion


require("common_db.php");
include("functions.php");

//Check for the existence of the HypatiaDB database
if(!file_exists('database-password.php') || filesize('database-password.php')==0) {
	//evidently not installed
	header("Location: install.php");
	headers();
	html();
	head("");
	echo('<p><a href="install.php">Please install</a> HypatiaDB.</p>');
	endhtml();
}

dbconnect($host, $username, $password);

$strings = loadStrings($lang, 'LOGIN');
headers();
html();
head('Welcome to HypatiaDB');
menu('', true, false);


if(isset($_REQUEST['exit']) && $_REQUEST['exit'] == "yes")
{
   header("Cache-control: private"); //IE 6 Fix 
   $_SESSION = array();
   session_destroy();
}
 

 
?>

<div id="login">
<h2><?php echo($strings['LOGIN_HEADING']); ?></h2>
<form method="post" action="home.php"> 
<?php
 //we need to check for an abscence of users
 //if there are no users at all, we print out an informational
 //message telling the client this
 mysql_select_db('HypatiaDB');
 $query = "SELECT COUNT(*) AS c FROM users";
 if(mysql_result(mysql_query($query), 0, 'c') == 0) {
	echo('<p>' . $strings['LOGIN_NOUSERS'] . '</p>');
 }
?>
<div><label for="login_name"><?php echo($strings['LOGIN_USERNAME']); ?><input type="text" id="login_name" name="login_name" /></label>
<label for="login_password"><?php echo($strings['LOGIN_PASSWORD']); ?><input type="password" id="login_password" name="login_password" /></label>

<input type="submit" value="Log in" /></div>

<?php
//<P><A HREF="passwd.php">Forgotten Your Password?</A></P>
?>
<p style="color: #E0E0E0"><?php echo($strings['LOGIN_LOSTPASS']); ?></p>

</form></div>
<?php
endhtml();
?>
Return current item: HypatiaDB