Hi
I made a page which check the login information if it is true or not but the code didn't work there is no errors just empty page !

<?php
session_start();
?>
<html>
<head>
<meta http-equiv="content" content="text/html" charset="UTF-8" />
<title>Login checking</title>
</head>
<body>
<?php
require_once('inc/config.php');




$username = $_POST['username'];
$password = $_POST['password'];
$md5      = md5($password);



if(empty($username) or empty($password)) {
echo "Fill all fields";
}else{
$sql = "SELECT * FROM users WHERE username='".$username."'";
$query = mysql_query($sql) or die(mysql_error());
$result = mysql_fetch_assoc($query);
$result['username'];
$result['password'];
if($username == $result['username'] and $md5 == $result['password']) {
$SESSION['user'] = $username;
echo "Welcome".$username;
header("Refresh: 5;index.php");
}else {
    echo "the username or the password is wrong";
}
?>
</body>
</html>

There might be some errors in your script(s), but your web server is not telling you about them since most probably the display of errors is turned off. Change the following settings in your php.ini:

error_reporting=E_ALL
display_errors=On

and restart your web server.

The errors could be in the included inc/config.php or are there simply because maybe $_POST elements do not exist. You can avoid the later by wrapping the code in an if check:

if(isset($_POST['username']) && isset($_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $md5 = md5($password);
    ...
}

Thanks it was because of the php.ini setting as you said.The error was because I forgot to but bracket inthe end of the code ! :(
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.