Een van die fouten is deze:
Warning: Undefined array key "menu" in /data/sites/web/******/www/test/inc/login.php on line 2
daarna als ik inlog, wat werkt, krijg ik deze fouten :
Warning: Cannot modify header information - headers already sent by (output started at /data/sites/web/*******/www/test/inc/dbase.php:13) in /data/sites/web/*******/www/test/inc/login.php on line 43
daarn doe ik een refresh, waardoor ik daarna wil uitloggen, dan krijg ik deze fout
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
de index.php
<?php
session_start();
error_reporting(0);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include('./inc/dbase.php');
if(!isset($_SESSION['Username'])){
include("./inc/login.php");
}else{
echo "<br>Welcome User: ";
echo $_SESSION['Username'];
}
echo "<br><a href='./inc/logout.php'>logout</a>";
?>
inlog.php
<?php
if($_GET['menu'] == 'login' && $_GET['action'] == 'check' ) {
$user = $_POST['username'];
$pass = md5($_POST['password']);
$key = $_POST['key'];
$sql = "SELECT * FROM AdminUsers WHERE Username='".$user."' AND Passwd='".$pass."' AND LoginKey='".$key."'";
$result = mysqli_query($connect, $sql);
$logindetails = mysqli_fetch_all($result, MYSQLI_ASSOC);
foreach($logindetails as $detail) {
echo "This we got from DBase<br>";
echo "Username : ".$detail['Username']."<br>";
echo "Password : ".$detail['Passwd']."<br>";
echo "LoginKey : ".$detail['LoginKey']."<br>";
echo "Name : ".$detail['Name']."<br>";
echo "Level : ".$detail['Access']."<br>";
}
echo "<div class='login'>";
if($detail['Username'] == $user) {
echo "<br>Username OK<br>";
} else {
echo "Username not OK<br>";
}
if($detail['Passwd'] == $pass) {
echo "Password OK<br>";
} else {
echo "Password not OK<br>";
}
if($detail['LoginKey'] == $key) {
echo "Key OK<br>";
} else {
echo "Key not OK<br>";
}
echo "<br>Nu gaan we een sessie aanmaken<br>";
/* session_start(); */
$_SESSION['Name'] = $detail['Name'];
$_SESSION['Username'] = $detail['Username'];
$_SESSION['Passwd'] = $detail['Passwd'];
$_SESSION['Level'] = $detail['Access'];
$_SESSION['ID'] = $detail['ID'];
header("location: ./index.php");
echo "</div>";
}else{
?>
<html>
<head>
<title>Sexy Devil</title>
<link href='inc/login.css' rel='stylesheet' type='text/css' media='screen'/>
</head>
<body>
<!-- Start framework login page -->
<?php echo"
<div class='login'>
<form id='login' action='".htmlspecialchars($_SERVER["PHP_SELF"]."?menu=login&action=check")."' method='POST'>
<fieldset>
<input type='text' name='username' placeholder='Username'>
<input type='password' name='password' placeholder='Password'>
<input type='text' name='key' placeholder='Keycode'>
<button type='submit' name='submit'>Login</button>
</fieldset>
</form>
<img id='img-login' src='./img/page/Sexy-Devil.jpg'>
</div>";
?>
<!-- End framework login page -->
</body>
</html>
<?php
}
?>
logout.php
<?php
session_start();
error_reporting(0);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
unset($_SESSION['Username']);
session_destroy();
header("location : ./index.php");
?>
Waar zit hier de fout?
Normaal werkt het op een andere site wel