Jump to content

Recommended Posts

i have problem. i think it's simple but i don't why my script didn't work

 

configuration.php

---------------

<?php $local='localhost';

$user='user';

$pass='pass';

$dbase='mylogin';

mysql_connect($local,$user,$pass);

mysql_select_db($dbase);?>

 

index.php

-------------------------

<form name="check" action="authenticate.php" method="POST">

<input type="text" name="user">

<input type="text" name="pass">

<input type="submit">

 

 

authenticate.php

-------------------

<?php require_once('configuration.php');?>

<?php

$user=$_POST['user'];

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

$query="SELECT * FROM mytable WHERE user='$user' AND password='$pass'";

$mysql=mysql_query($query);

$sql_num=mysql_num_rows($mysql);

if($sql_num==1){

echo "login work";

}

else {

echo "Wrong Username or Password";

}?>

 

 

can anyone give me some guide?

 

 

Link to comment
https://forums.phpfreaks.com/topic/173533-solved-login-authentication/
Share on other sites

You need to make sure error reporting is on and you should also verify the data in your database with the data in your script.  Is the column length for the password in your database 32 characters?  You need it to be that long in order to store an MD5 hash.

my script didn't work

 

Yes, we know that because you are posting on a php programming help forum. Just telling us something does not work is pointless. What exactly is it doing? A blank page? A php error? Your "Wrong Username or Password" message?

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.