Location: PHPKode > scripts > Open4Listing > cont/login.php
<?php

include('../setari.php');

$cxn = @ConnectToDb($dbServer, $dbUser9, $dbPass9, $dbName9);

if(isset($_COOKIE['vanzinch_email']))

{ 

$username = $_COOKIE['vanzinch_email']; 

$pass = $_COOKIE['vanzinchv_pass'];

$check = mysql_query("SELECT * FROM clienti WHERE email = '$username'")or die(mysql_error());

while($info = mysql_fetch_array( $check )) 

{

if ($pass != $info['parola']) 

{

}

else

{

header("Location: cont.php");



}

}

}



//if the login form is submitted

if (isset($_POST['submit'])) { // if form has been submitted



// makes sure they filled it in

if(!$_POST['username'] | !$_POST['pass']) {

die('Please fill all fields!');

}

// checks it against the database



if (!get_magic_quotes_gpc()) {

$_POST['email'] = addslashes($_POST['email']);

}



$check = mysql_query("SELECT * FROM clienti WHERE email = '".$_POST['username']."'")or die(mysql_error());



//Gives error if user dosen't exist

$check2 = mysql_num_rows($check);

if ($check2 == 0) {

die('Wrong username or password!<br><a href=login.php>press here to try again!</a>');

}

while($info = mysql_fetch_array( $check )) 

{

$_POST['pass'] = stripslashes($_POST['pass']);

$info['parola'] = stripslashes($info['parola']);



//gives error if the password is wrong

if ($_POST['pass'] != $info['parola']) {

die('Wrong password.');

}

 

else 

{ 



// if login is ok then we add a cookie 

$_POST['username'] = stripslashes($_POST['username']); 

$hour = time() + 12200; 

setcookie(vanzinch_email, $_POST['username'], $hour); 

setcookie(vanzinch_pass, $_POST['pass'], $hour); 



//then redirect them to the members area 

header("Location: cont.php"); 

} 

} 

} 

else 

{ 



// if they are not logged in 

?> 









<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd"> 



<html>

<head>
<title>SignIn</title>
</head>

<body bgcolor="#333333">
<div align="left">
	<div align="center">

	&nbsp;<p>&nbsp;</p>

	<table border="0" width="600" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF">

		<tr>

			<td>

			<table border="0" width="100%" cellspacing="0" cellpadding="0">

				<tr>

					<td bgcolor="#FFFFFF">



					</td>

				</tr>

				<tr>

					<td bgcolor="#FFFFFF">

					<table border="0" width="100%" cellspacing="0" cellpadding="0">

						<tr>

							<td width="100%" align="right" bgcolor="#FFFFFF" valign="top">

							<div align="center">

								<div align="center">

								<table border="0" width="100%" cellspacing="0" cellpadding="0">

											<tr><td>

	

	

	

	<div align="center">

												<table border="0" width="100%" cellpadding="3">

													<tr>

														<td bgcolor="#CC3300">

														<p style="margin-top: 0; margin-bottom: 0" align="left">

														<b>

														<font face="Arial" color="#FFFFFF">
														Sign In</font></b></td>
													</tr>

												</table>

												<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> </p>

													<p>&nbsp;</p>

<table border="0" width="331" cellpadding="3"> 

<tr><td colspan=2 bgcolor="#000000">

	<p align="left" style="margin-top: 0; margin-bottom: 0"><b><font face="Verdana" size="2" color="#FFFFFF">
	Sign In</font><font face="Verdana" size="1" color="#FFFFFF">

	</font><font face="Verdana" size="1">.</font></b></td></tr> 

<tr><td bgcolor="#DDE8F4" align="left" width="65">

	<font size="1" face="Verdana" color="#585858">Email:</font></td>

	<td bgcolor="#DDE8F4" align="left" width="248"> 

<input type="text" name="username" maxlength="40" size="33"> 

</td></tr> 

<tr><td bgcolor="#DDE8F4" align="left" width="65">

	<font size="1" face="Verdana" color="#585858">Password:</font></td>

	<td bgcolor="#DDE8F4" align="left" width="248"> 

<input type="password" name="pass" maxlength="50" size="33"> 

</td></tr> 

<tr><td colspan="2" align="right" bgcolor="#DDE8F4"> 
<input type="submit" name="submit" value="Sign In"> 
</td></tr> 

</table> 

<p style="margin-top: 0; margin-bottom: 0">

							&nbsp;</p>

													<p style="margin-top: 0; margin-bottom: 0">

							&nbsp;</p>

													<font face="Verdana">

													<p>&nbsp;</div>

												</td></tr>						

									

								</table>

								</div>

								</div>

							</td>

						</tr>

					</table>

					</td>

				</tr>

			</table>

			</td>

		</tr>

	</table>

	</div>

</div>



<div align="center">
</div>



</body>



</html>

<?php }?>
Return current item: Open4Listing