Jump to content

Recommended Posts

I really don't know whats going on... I have other smaller forms on my site that send POST info to the Action page and work. but this on is not...

 

This form is just a User Login form. my registration form works perfectly, just the login fails...

 

all i get from this is of course just empty user name and password $_POST... its not sending the info after submit

 

Form Code:

<form method="post" name="userlogin" action="checklogin.php">
<table>
<tr>
<td>
 User Name:
</td>
<td>
 <input type="text" id="user_name" size="25">
</td>
</tr>
<tr>
<td>
 Password:
</td>
<td>
 <input type="password" id="password" size="25">
</td>
</tr>
<tr>
<td>
 <input type="submit" name="Submit" value="Login">
</td>
</tr>
</table>
</form>

 

checklogin.php code:

<?php
ob_start();

// username and password sent from form
$user_name = $_POST['user_name'];
$password = $_POST['password'];

if(empty($user_name)){
$user_name = 'Empty User Name';
echo $user_name;
die;
}
if(empty($password)){
$password = 'Empty Password';
echo $password;
die;
}

$securepassword = md5($password);
include('connect.php');
$sql = "SELECT * FROM member WHERE user_name='$user_name' and password='$password'";
$result = mysql_query($sql)
or die('Query Failed: '.mysql_error());

// Mysql_num_row is counting table row
$count = mysql_num_rows($result);

// If result matched $user_name and $password, table row must be 1 row
if($count==1){

// Register $user_name, $password and redirect to file "login_success.php"
session_register("user_name");
session_register("password");
header("location:index.php");
}
else {
echo "Wrong Username or Password<br>";
echo $user_name.'<br>'.$password.'<br>'.$securepassword;
}
ob_end_flush();
?>

Edited by Guber-X
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.