Register and Login problem
Posted: Thu Feb 09, 2012 2:01 pm
I have a problem where when I push submit on my login page it doesn't do anything :/ Here is all my code and a link to my website is here: http://tumabackup.x10.mx/
Login page: http://tumabackup.x10.mx/login.php/
Code for login.php:
Login page: http://tumabackup.x10.mx/login.php/
Code for login.php:
<?php error_reporting(E_ALL); ini_set('display_errors', 1); include('core/init.inc.php'); $errors = array(); if (isset($_POST['username'], $_POST['password'])){ if (empty($_POST['username'])){ $errors[] = 'The username cannot be empty.'; } mysql_error(); if (empty($_POST['password'])){ $errors[] = 'The password cannot be empty.'; } if (empty($errors) && valid_credentials($_POST['username'], $_POST['password']) === false){ $errors[] = 'Username or password are incorrect.'; } if (empty($errors)){ $_SESSION['username'] = htmlentities($_POST['username']); header('Location: protected.php'); die(); } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>NewCo | Login</title> <link rel="shortcut icon" href="favicon.ico"> <link href='http://fonts.googleapis.com/css?family= ... cento+Sans' rel='stylesheet' type='text/css'> <link href="/ext/style/style-login.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div> <?php if (empty($errors) === false){ ?> <ul> <?php foreach ($errors as $error){ echo "<li>{$error}</li>"; } ?> </ul> <?php }else{ echo 'Need an account ? <a href="index.php">Register here</a>'; } ?> </div> <form action="" method="post"> <p> <label for="name">Username:</label> <input type="text" id="name" placeholder="Username" value="<?php if (isset($_POST['username'])) echo htmlentities($_POST['username']); ?>" /> </p> <p> <label for="password">Password:</label> <input type="password" id="password" placeholder="Password"> </p> <p> <input type="submit" value="Submit" /> </p> </form> </body> </html>Please reply with all possible fixes as I am going to bed