Hi there,
I'm using Jmemeber77's user script (updated by another source for better security) over at http://gamer-cafe.net/ and I'm having a little trouble.
I would like to show the log in area to guests;
<form action="process.php" method="POST">
<p class="Loginform">Username:<input type="text" name="user" maxlength="15" value="<?php echo $form->value("user"); ?>"><?php echo $form->error("user"); ?>
     
Password:<input type="password" name="pass" maxlength="15" value="<?php echo $form->value("pass"); ?>"><?php echo $form->error("pass"); ?>
   
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login" style="position: absolute; left: -9999px; width: 1px; height: 1px;">
<input type="checkbox" name="remember" <?php if($form->value("remember") != ""){ echo "checked"; } ?>>
<a href="forgotpass.php">Forgot Password?</a></p>
</form>
then, once a users credentials are established and logged in, remove it and replace it with;
<?php
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
echo "<h1>Logged In</h1>";
echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] "
."[<a href=\"useredit.php\">Edit Account</a>] ";
if($session->isAdmin()){
echo "[<a href=\"admin/index.php\">Admin Center</a>] ";
}
echo "[<a href=\"process.php\">Logout</a>]";
}
else
?>
I know that's using echo, but I would like to use the system;
<?php if ($session->logged_in) ?>
/* Content for logged in users */
<?php else ?>
/* Content for guests */
Which I had set-up previously for my user management, but when I use it with this, it gives me an unexpected error (or it displays the site content twice). I have skimmed through Session.php (http://ideone.com/FkxVfH) but I'm not really sure what to use.
What am I doing wrong?