for my page I created a login. It works all as planned, but how do I make it redirect to another page automatically when the login was successfull and to a different page when it was not?
Different topic, I am new to this page, how do I make four spaces for the quote automatically? Putting four spaces manually in front of each line seems a bit weird. Thanks for any help :) Chris
<?php session_start()?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>checklogin</title>
</head>
<body>
<?php
$con = mysqli_connect("mysql.freehostingnoads.net","u291_admin","...","u291_login");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql= "SELECT * FROM login_data";
$result= mysqli_query ($con, $sql);
$row= mysqli_fetch_array($result);
if($row["username"] == $_POST["user"] && $row["password"] == $_POST["pwd"]){
$_SESSION['username'] =$_POST["user"];
echo "You succesfully logged in";
echo '<br /> If you are not redirected automatically please click <a href="showdata.php">here</a>';
//header("location:hidden.php");
}
else
{ echo "Wrong username or password";
// header("location: www./index.html");
}
?>
</body>
</html>