Jump to content

[SOLVED] login authentication


robert_gsfame

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?

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.