When I login with the correct username and password I get an error "Wrong Username or Password" the database connection works and I think there is something wrong with the password + username check.
<?php
$host="mysql12-int.cp.hostnet.nl"; // Host name
$username="u33936_mick"; // username
$password="//password was correct"; // password
$db_name="db33936_axe"; // Database name
$tbl_name="users"; // Table name
mysql_connect("$host", "$username", "$password");
mysql_select_db("$db_name");
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql = 'SELECT * FROM `users` LIMIT 0, 30 WHERE username="$myusername" and
password="$mypassword"';
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("username");
session_register("password");
header("location:index.php");
} else {
echo "Wrong Username or Password";
}
?>
This is my form
<form name="login" method="post" action="login.php">
<fieldset id="inputs">
<input id="myusername" type="text" name="myusername"
placeholder="Username" required="">
<input id="mypassword" type="password" name="mypassword"
placeholder="Password" required="">
</fieldset>
<fieldset id="login.php">
<input type="submit" id="submit" value="Login">
</style>
</fieldset>
</form>
mysql_*functions, they are officially deprecated, no longer maintained and will be removed in the future. You should update your code with PDO or MySQLi to ensure the functionality of your project in the future.limitclause need to go at the end of the query?mysql_functions is a critical problem in any code. No solution is complete or even ethical when it does not entail advise on discarding deprecated techniques. The widespread use ofmysql_is dangerous to the language and to internet security in general, and is actually a bigger problem than whatever minor and temporary problem he is asking about here. He'll figure out the string concatenation with the answers he has, but if he doesn't figure out PDO he's got bigger problems.