Location: PHPKode > scripts > PHP Online Invoice System > php-online-invoice-system/login.php
<?php
/*
 * Exemplar Web hosting
 * http://www.exemplar.biz
 *
 * Title: PHP Online Invoice System
 * Version: 2.0
 * Author: Exemplar
 * Date: 01-01-2006
 *                 
*/
include("inc/config.php");
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
$query = "SELECT * FROM clients WHERE name = '$name' AND password = '$password'";
$result = mysql_db_query($database, $query, $connection);
if (mysql_num_rows($result) == 1)
	{
	session_start();

	session_register("client_id");
	session_register("client_name");
	session_register("client_email");
	session_register("client_company");
	list($clientid, $name, $pass, $email, $company) = mysql_fetch_row($result);
	$client_id = $clientid;
	$client_name = $name;
	$client_email = $email;
	$client_company = $company;
	
	header("Location: menu.php");
	mysql_free_result ($result);	

	mysql_close($connection);
	}
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
$query = "SELECT * FROM admins WHERE name = '$name' AND password = '$password'";
$result = mysql_db_query($database, $query, $connection);
if (mysql_num_rows($result) == 1)
	{
	session_start();

	session_register("client_id");
	session_register("client_name");
	session_register("client_email");
	list($clientid, $name, $pass, $email) = mysql_fetch_row($result);
	$client_id = $clientid;
	$client_name = $name;
	$client_name = "admin";
	$client_email = $email;
	
	header("Location: menu.php");
	mysql_free_result ($result);	

	mysql_close($connection);
	}
else
	{
	mysql_free_result ($result);	
	mysql_close($connection);

	header("Location: index.php");
	exit;
	}
?>
Return current item: PHP Online Invoice System