Location: PHPKode > projects > WBBlog > checkuser.php
<?
/*

WBBlog - Single User Blog
Version 1.0
Michael Lintz - LIQUA Web Solutions
hide@address.com - http://www.liqua.com
Copyright (C) 2005 

This program is free software; you can redistribute it and/or modify it under the terms of 
the GNU General Public License as published by the Free Software Foundation; either version 
2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; 
if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

*/

session_start();  // Start Session

include './inc/config.inc.php';

// Convert to simple variables

$u_email = $_POST['u_email'];

$u_password = $_POST['u_password'];



if((!$u_email) || (!$u_password))
{
?>
	
<meta http-equiv="Refresh"content="0;url=index.php?cmd=error">


<?
}



$sql = mysql_query("SELECT u_id,u_fname,u_lname,u_add1,u_add2,u_city,u_state,u_zip,u_phone,u_email,u_login,u_access FROM user WHERE u_email='$u_email' AND u_password='$u_password'");



$login_check = mysql_num_rows($sql);




if($login_check > 0)

{

	while($row = mysql_fetch_array($sql))

	{

	foreach( $row AS $key => $val )

	{

		$$key = stripslashes( $val );

	}

	

		$_SESSION["u_id"] = $u_id;

		$_SESSION["u_fname"] = $u_fname;

		$_SESSION["u_lname"] = $u_lname;

		$_SESSION["u_add1"] = $u_add1;

		$_SESSION["u_add2"] = $u_add2;

		$_SESSION["u_city"] = $u_city;

		$_SESSION["u_state"] = $u_state;

		$_SESSION["u_zip"] = $u_zip;

		$_SESSION["u_phone"] = $u_phone;

		$_SESSION["u_email"] = $u_email;

		$_SESSION["u_login"] = DATE('F j, Y, g:i a',strtotime($u_login));

		$_SESSION["u_access"] = $u_access;



		mysql_query("UPDATE user SET u_login=now() WHERE u_id='$u_id'");

		if($u_access != 1)
		{		
		

?>

<meta http-equiv="Refresh"content="0;url=index.php"> 

<?

	        }
		else
		{
 
	?>
	
	<meta http-equiv="Refresh"content="0;url=index.php"> 
	<?
	        }


	}

} else {

	
	?>
	<meta http-equiv="Refresh"content="0;url=index.php?cmd=error"> 
<?
}

?>
Return current item: WBBlog