View Full Version : Log in Page Help needed please

01-04-2012, 06:58 PM
I am a newbie trying to create a log in page and the page will not even display now.
I have altered a few errors in my php log file and the last one says unexpected $end at line 101 ( which is the last line)

My idea was to check that everything is ok and then run mysqli to check the database the value are in the database but the page is just blank.
some guiding help would be great .

//start session

//form error alerts
$error['alert'] = '';
$error['user'] = '';
$error['pass'] = '';
$input['user'] = '';
$input['pass'] = '';

if($_POST['username'] == '' || $_POST['password'] == '')
if($_POST['username'] == '') {$error['user'] = 'required!';
if($_POST['password'] == '') {$error['pass'] = 'required!';
$error['alert'] = 'Please fill in the required fields!';

$input['user'] = $_POST['username'];
$input['pass'] = $_POST['password'];

$input['user'] = htmlentities($_POST['username'], ENT_QUOTES);
$input['pass'] = htmlentities($_POST['password'], ENT_QUOTES);

if ($stmt = $mysqli->prepare("SELECT username, password FROM user WHERE username=? AND password = ? "))

$stmt->bind_param('ss', $input['user'], md5($input['pass'].$config['secure']));

if ($stmt->num_rows > 0)

$_SESSION['username'] = $input['user'];

header("Location: index.php");

// else
// {
// $error['alert'] = "Username or Password incorrect !";
// }

echo "ERROR could not do the MYSQLI ....";


else {

// show the form
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />

<title>Concept HQ Log in</title>

<meta name="keywords" content="AddContentOf YourSite" />
<link rel="stylesheet" href="css/style.css?v=1.0" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>

<section id="loginphp">
<h1>Log In</h1>
<div id="content">
<form method="post" action="">

<label for="username">Username *</label>
<input type="text" name="username" value="" />

<label for="password">Password *</label>
<input type="password" name="password" value="" />

<p class="required">* required fields</p>

<input type="submit" name="submit" value="Submit" class="submit"/>
} //end else statement


01-04-2012, 09:12 PM
Put an opening { after the "if" statement on line 31 ...

and put a closing } on line 50 (for that "if" statement).

01-04-2012, 09:34 PM
Thanks for the help I have tried and it still doesn't show up. I'm lost as what to do. i just want a login in script with prepare statements.
Thank you for your help.

01-04-2012, 09:46 PM
You get a blank white page because there is an error
and your PHP error reporting is turned off. You need
to enable it with your webhost config ... or you can
try putting this line at the top ... see red ...

//start session
error_reporting(E_ALL ^ E_NOTICE);

Let us know what the error says, and which line.


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum