Location: PHPKode > projects > Shell Providers Customer/Accounts DB > shelldb/login.php
<?php include("includes/session.php");?><?

include("includes/config.php");
$url = $shelldb_url . "/logout.php";
if($username && $password)
{

	// if the user has tried to login
	
	$db_conn = mysql_connect($shelldb_host, $shelldb_user, $shelldb_pass);
	mysql_select_db($shelldb_db, $db_conn);
	$pass = crypt($password, "DB");
	$query = "SELECT * FROM login where username = '$username' and password = '$pass'";
	$result = mysql_query($query, $db_conn);
	
	if (mysql_num_rows($result) == 1 )
	{
		// if they are in the database register the id
		$row = mysql_fetch_array($result);
		
		if($row["isadmin"] == "yes") {
		$administrator = $username;
		session_register("administrator");
		} else {
		$validuser = $username;
		session_register("validuser");
		}
	}
}

 
  
if (is_admin() || is_user()) {
	echo '<A href="/index.php">You are now logged in, click here</A>';
	exit;
} 

if (isset($username)) {
	echo '<bgcolor="#FFFFFF"> FAILED</body>';
	exit;
}
?>

<style type="text/css">
<!--
.table {  font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; background-color: #000099}
-->
</style>

<body bgcolor="#000099">
<div align="center"> 
  <p>
    </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <form name="Login" method="post" action="login.php">
    <table width="25%" border="1">
      <tr> 
        <td class="table" width="40%"><span class="table">Username</span></td>
        <td width="60%">
          <input type="text" name="username">
        </td>
      </tr>
      <tr> 
        <td width="40%" class="table">Password</td>
        <td width="60%">
          <input type="text" name="password">
        </td>
      </tr>
    </table>
    <br>
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" name="reset" value="Reset">
  </form>
  <p>&nbsp;</p>
</div>
Return current item: Shell Providers Customer/Accounts DB