Warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/password/login.php on line 44
login.php
<?ob_start();?>
<?php
include('core/init.inc.php');
$errors = array();
if (isset($_POST['username'], $_POST['password'])){
if (empty($_POST['username'])){
$errors[] = 'Prosim vnesi Up.ime: .';
}
if(empty($_POST['password'])){
$errors[] = 'Prosim vnesi Geslo: .';
}
if (valid_credentials($_POST['username'], $_POST['password']) === false){
$errors = 'Up.ime: / Geslo: neplavilno.';
}
if (empty($errors)){
$_SESSION['username'] = htmlentities($_POST['username']);
header('Location: protected.php');
die();
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml/DTD/xhtml-strict.dtd">
<html xmlns="http//www.w3.org/1999/xhtml" />
<head>
<meta http-equiv="Content-Type" content="text/html; charst=utf-8" />
<link rel="stylesheet" type="text/css" href="ext/css/still.css"
<title> Polna Pljuca "Prijava" </title>
</head>
<body>
<div>
<?php
if (empty($errors) === false){
?>
<ul>
<?php
foreach ($errors as $error){
echo "<li>{$error}</li>";
}
?>
</ul>
<?php
}else{
echo 'Nov racun? <a href="register.php">Registriraj se...</a>';
}
?>
</div>
<form action="" method="post">
<p>
<label for="username">Up.Ime:</label>
<input type="text" name="username" id="username" value="<?php if (isset($_POST['username'])) echo htmlentities($_POST['username']); ?>" />
</p>
<p>
<label for="password">Geslo:</label>
<input type="password" name="password" id="password" />
</p>
<p>
<input type="submit" value="Prijava"
</p>
</form>
</body>
</html>
<?ob_flush();?>
We can ask how to help, are you in advance thank you. 