Jump to content


Photo

Help what is wrong with my login script


  • Please log in to reply
1 reply to this topic

#1 tbobker

tbobker
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 05 July 2006 - 07:51 PM

What is wrong with this?

Here is my login part:

<html>
<body>

<div align="center">
<form method="post" action="login.php">
	Username:&nbsp;<input type="text" name="username"><br>
	Password:&nbsp;<input type="text" name="password"><br>
	<input type="submit">
</form>
</div>

</body>
</html>


and here is the login script:

<?php 	

	include("dbconnect.inc");

	$sql = "select * from login";
	$result = mysql_query($sql, $conn);
	$row = mysql_fetch_assoc($result);


	
	if($_POST[username] && $_POST[password] == $row[username] && $row[password]){
		include("index.php");
	}
		else {
	echo "wrong login <a href='index.html'>Go back</a>";
	}	
?>

Why isnt it working? there are no errors just wont login.

#2 mschrank

mschrank
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 05 July 2006 - 07:55 PM

Try $row[0]['username'] etc...

the best thing to do if that doesn't work is print_r($row) which will show you the data structure of the array so you can code accordingly.

Good luck.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users