Topic: adusting the login box
So I have a login box that appears on the title page of every page on my site (thanks to ontap for his tutorial).
It has a login/logout and says if you are logged in or not....I also have a link to "forgot your password" and "need to register"....basically what I want to have is these two links (forgot password and register) dissappear if the user is logged in (as they are not necessary anymore).
Here is my code:
this is for the homepage file:
<p>
<a href="http://www.mysite.com/forum/register.php" tabindex="4">not registered?</a><br />
<a href="http://www.mysite.com/forum/login.php?action=forget" tabindex="5">forgot your password?</a>
</p>
<p><?php
define('PUN_ROOT', './pun/');
include './pun/include/common.php';
include './login_function.inc.php';
login_menu();
?></p>
the homepage file calls this function:
<?php
function login_menu() {
global $pun_user;
if ($pun_user['is_guest']) {
echo "<form id=\"login\" method=\"post\" action=\"/pun/login.php?action=in\" onsubmit=\"return process_form(this)\">
<input type=\"hidden\" name=\"form_sent\" value=\"1\" />
<input type=\"hidden\" name=\"redirect_url\" value=\"".$_SERVER['SCRIPT_NAME']."\" />
<input type=\"text\" name=\"req_username\" size=\"25\" maxlength=\"25\" />
<input type=\"password\" name=\"req_password\" size=\"16\" maxlength=\"16\" />
<input type=\"submit\" name=\"login\" value=\"Login\" />
</form>";
}
else {
echo "Logged in as: ".pun_htmlspecialchars($pun_user['username'])."
<br>Click <a href=\"/pun/login.php?action=out&id=".$pun_user['id']."&location_out=".$_SERVER['SCRIPT_NAME']."\">here</a> to log out.</div>";
}
}
?>
any help would be great
I'm a total noob so please be patient.
cheers
Nick
see my hack to integrate punbb with wordpress comment system.
Illustration Community