Topic: Login box instead of the "You are not logged in." message
Hi,
This is a great tool and I use it a lot, so here is my small contribution... I hope you like it.
I find it nice to show the login box instead of the usual "You are not logged in." message, so here is what I have done below.
First step, backup! backup! backup!
1. Open header.php and locate (approx line 153)
// START SUBST - <pun_status>
if ($pun_user['is_guest'])
$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<p>'.$lang_common['Not logged in'].'</p>'."\n\t\t".'</div>';
and replace with
// START SUBST - <pun_status>
// Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';
if ($pun_user['is_guest'])
$tpl_temp = '<div id="brdwelcome" class="inbox" align="right">'."\n\t\t\t".'<p><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="redirect_url" value="'.$redirect_url.'" />Username: <input type="text" name="req_username" size="16" maxlength="25" tabindex="1" /> Password:<input type="password" name="req_password" size="16" maxlength="16" tabindex="2" /> <input type="submit" name="login" value="login" tabindex="3" /></p>'."\n\t\t".'</div>';
note: I have aligned my boxes on the right portion due to preferences only, you can align them on left by changing the value on <div id="brdwelcome" class="inbox" align="right"> to "left"
save the file
2. open main.tpl inside include\template and locate the <pun_status> approx line 20 and do the following
<form id="login" method="post" action="login.php?action=in" onsubmit="return process_form(this)">
<pun_status>
</form>
save and upload
That's it... I tried this on most versions and it seems to work fine...
I hope it helps.
Paul