New to php & MySQL. Followed a tutorial on Youtube but after messing around a bit I managed to bypass and access my site using admin'# as the username and a blank password. See here.
My code (PHP):
<?php
$username = "***";
$password = "****";
$hostname = "mysql1.000webhost.com";
$database = "***_login";
$dbhandle = mysql_connect($hostname, $username, $password );
$selected = mysql_select_db("a7653250_login", $dbhandle)
or die("Could not connect to database");
$myusername = $_POST['user'];
$mypassword = $_POST['pass'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$query = "SELECT * FROM Users WHERE Username='$myusername' and Password='$mypassword'";
$result = mysql_query ($query) or die(mysql_error());
$count = mysql_num_rows($result);
if($count==1){
$seconds = 186400 + time();
setcookie(loggedin, date("F jS - g:i a"), $seconds);
header("location:index.php");}
else{
header("location:loginfailed.php");
}
mysql_close()
?>
I've read about using some sort of parameters but I don't know where or how to use them.
Many thanks