Jump to content

Login help


t-r-a-x

Recommended Posts

I have a problem, I'd like to write an error from one script in another script, but I don't know how can someone help me??

 

these are the scripts:

<?php
session_start(); 
$submit = $_POST['submit'];
$email = strip_tags($_POST['email']);
$password = strip_tags($_POST['password']);
if ($submit)
{
if($email)
{
if($password)
{
	$connect = mysql_connect("localhost","root","") or die ("Couldn't connect to the database");
	mysql_select_db (proba,$connect) or die ("Couldn't find database");
	$password=md5($password);
	$query=mysql_query("Select * from login where email='$email' and password='$password'");
	if (mysql_num_rows($query)==1)
	{
	$_SESSION['email']=$email;
	header('Location:reg_div.php');
	}
	else
	{
	$greska= 'User with this e-mail address and password does not exist!';
	header('Location:login.php');
	}
}
else //password
	echo "You forgot to put in your password!";
} //email
else
echo "You forgot to put in your E-mail";
}//submit

?>

<form action="login_script.php" method="post" name="Log in">
<?php
include 'login_script.php';
echo $greska;
?>
    <table style="border-width:3px;">
    <tr>
    <td colspan="2" align="left">
      <label id="cjeline" >Log in</label><br />
      <img src="crta.jpg" /> 
    </td> 
    </tr>
    <tr>
    <td align="right">
    <label id="label">E-mail:</label>
    </td>
    <td align="left">
    <input name="email" type="text" style="witdh:150px;" maxlength="50"/>
    </td>
    </tr>
    <tr>
  	<td align="right"><label id="label">Password:</label>  
  	</td>
  	<td align="left">
  	<input name="password" type="password" style="witdh:150px;" maxlength="25" />
	</td>
  	</tr>
    <tr>
	<td colspan="2">
  	<br /> 
  	</td>
  	</tr>
    </table>
<input type="submit" name="submit" value="Log in" />
</form>

 

 

Link to comment
https://forums.phpfreaks.com/topic/193197-login-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.