Hello, I was wondering what my error was for the fact I can not find it anywhere… I fixed the error where it said unexpected T_STRING, now it gives me this error…
Parse error: syntax error, unexpected 'endif' (T_ENDIF) in /home.php on line 177
What’s on line 177 is this…
[php] <?php
endif;
?>[/php]
Here’s what entire home.php file is…
[php]<?php
require ‘core/init.php’;
$general->logged_in_protect();
if (isset($_POST[‘submit’])) {
if(empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email'])){
$errors[] = 'All fields are required.';
}else{
if ($users->user_exists($_POST['username']) === true) {
$errors[] = 'That username already exists';
}
if(!ctype_alnum($_POST['username'])){
$errors[] = 'Please enter a username with only alphabets and numbers';
}
if (strlen($_POST['password']) <6){
$errors[] = 'Your password must be atleast 6 characters';
} else if (strlen($_POST['password']) >18){
$errors[] = 'Your password cannot be more than 18 characters long';
}
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
$errors[] = 'Please enter a valid email address';
}else if ($users->email_exists($_POST['email']) === true) {
$errors[] = 'That email already exists.';
}
}
if(empty($errors) === true){
$username = htmlentities($_POST['username']);
$password = $_POST['password'];
$email = htmlentities($_POST['email']);
$users->register($username, $password, $email);
header('Location: register.php?success');
exit();
}
}
?>
<?php if($_POST['submit']=='Login') { $general->logged_in_protect(); $username = trim($_POST['username']); $password = trim($_POST['password']); if (empty($username) === true || empty($password) === true) { $errors[] = 'Sorry, but we need your username and password.'; } else if ($users->user_exists($username) === false) { $errors[] = 'Sorry that username doesn\'t exists.'; } else if ($users->email_confirmed($username) === false) { $errors[] = 'Sorry, but you need to activate your account. Please check your email.'; } else { if (strlen($password) > 18) { $errors[] = 'The password should be less than 18 characters, without spacing.'; } $login = $users->login($username, $password); if ($login === false) { $errors[] = 'Sorry, that username/password is invalid'; }else { session_regenerate_id(true);// destroying the old session id and creating a new one $_SESSION['id'] = $login; header('Location: home.php'); exit(); } } } ?>if($_SESSION[‘msg’])
{
// The script below shows the sliding panel on page load
$script = '
<script type="text/javascript">
$(function(){
$("div#panel").show();
$("#toggle a").toggle();
});
</script>';
}
?>
<link rel="stylesheet" type="text/css" href="demo.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/slide.css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<!-- PNG FIX for IE6 -->
<!-- http://24ways.org/2007/supersleight-transparent-png-in-ie6 -->
<!--[if lte IE 6]>
<script type="text/javascript" src="js/pngfix/supersleight-min.js"></script>
<![endif]-->
<script src="js/slide.js" type="text/javascript"></script>
<?php echo $script; ?>
The Sliding jQuery Panel
A register/login solution
You are free to use this login and registration system in you sites!
A Big Thanks
This tutorial was built on top of Web-Kreation's amazing sliding panel.
<?php
if($user_id);
?>
<div class="left right">
<!-- Login Form -->
<form class="clearfix" action="" method="post">
<h1>Member Login</h1>
<?php
if(empty($errors) === false){
echo '<p>' . implode('</p><p>', $errors) . '</p>';
}
?>
<label class="grey" for="username">Username:</label>
<input type="text" name="username" value="<?php if(isset($_POST['username'])) echo htmlentities($_POST['username']); ?>" />
<label class="grey" for="password">Password:</label>
<input class="field" type="password" name="password" id="password" size="23" />
<div class="clear"></div>
<input type="submit" name="submit" value="Login" class="bt_login" />
</form>
Forgot your username/password?
<div class="left">
<h1>Members panel</h1>
<p>You can put member-only data here</p>
<a href="index.php?page=profile">View your profile information and edit it</a>
<p>- or -</p>
<a href="index.php?page=logout">Log off</a>
</div>
<div class="left right">
</div>
<?php
endif;
?>
</div>
</div> <!-- /login -->
<!-- The tab on top -->
<div class="tab">
<ul class="login">
<li class="left"> </li>
<li>Hello <?php echo $_SESSION['usr'] ? $_SESSION['usr'] : 'Guest';?>!</li>
<li class="sep">|</li>
<li id="toggle">
<a id="open" class="open" href="#"><?php echo $_SESSION['id']?'Open Panel':'Log In | Register';?></a>
<a id="close" style="display: none;" class="close" href="#">Close Panel</a>
</li>
<li class="right"> </li>
</ul>
</div> <!-- / top -->
A Cool Login System
Easy registration management with PHP & jQuery
<div class="container">
<p>This is a simple example site demonstrating the <a href="http://tutorialzine.com/2009/10/cool-login-system-php-jquery/">Cool Login System tutorial</a> on <strong>Tutorialzine</strong>. You can start by clicking the <strong>Log In | Register</strong> button above. After registration, an email will be sent to you with your new password.</p>
<p><a href="registered.php" target="_blank">View a test page</a>, only accessible by <strong>registered users</strong>.</p>
<p>The sliding jQuery panel, used in this example, was developed by <a href="http://web-kreation.com/index.php/tutorials/nice-clean-sliding-login-panel-built-with-jquery" title="Go to site">Web-Kreation</a>.</p>
<p>You are free to build upon this code and use it in your own sites.</p>
<div class="clear"></div>
</div>
<div class="container tutorial-info">
This is a tutorialzine demo. View the <a href="http://tutorialzine.com/2009/10/cool-login-system-php-jquery/" target="_blank">original tutorial</a>, or download the <a href="demo.zip">source files</a>. </div>
</div>
If you could help me figure out my error, as I do not know what the issue is here, I could be missing a bracket… Not sure… It would be greatly appreciated! Thanks!