Některým webmasterům nevyhovuje umístění blokem a raději by měli tento formulář v headeru.
Spáchal sem pro tyto případy jednoduchou funkci, kterou je možno použít, libovolným způsobem.
Příklad si ukážeme na umístění přímo ve vzhledu.
Celou funkci umístíme do souboru themes/_VASE_THEME_/theme.php třeba nad funkci themeheader().
{ Kód }:
/************************************************************/
/* Function bw_login() */
/* */
/************************************************************/
function bw_login() {
global $admin, $user, $sitekey, $gfx_chk, $cookie;
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER['HTTP_USER_AGENT'] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 6);
$bwlogin_text = "<form action=\"modules.php?name=Your_Account\" method=\"post\">";
$bwlogin_text .= _NICKNAME.": ";
$bwlogin_text .= "<input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\" /> ";
$bwlogin_text .= _PASSWORD.": ";
$bwlogin_text .= "<input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\" /> ";
if (extension_loaded("gd") AND ($gfx_chk == 2 OR $gfx_chk == 4 OR $gfx_chk == 5 OR $gfx_chk == 7)) {
$bwlogin_text .= _SECURITYCODE.": <img src=\"?gfx=gfx&random_num=".$random_num."\" border=\"1\" style=\"width: 77px; height: 20px\" alt=\""._SECURITYCODE."\" title=\""._SECURITYCODE."\" /> \n";
$bwlogin_text .= "Opsat: <input type=\"text\" name=\"gfx_check\" size=\"7\" maxlength=\"6\" />\n";
$bwlogin_text .= "<input type=\"hidden\" name=\"random_num\" value=\"".$random_num."\" />\n";
} else {
$bwlogin_text .= "<input type=\"hidden\" name=\"random_num\" value=\"".$random_num."\" />";
$bwlogin_text .= "<input type=\"hidden\" name=\"gfx_check\" value=\"".$code."\" />";
}
$bwlogin_text .= "<input type=\"hidden\" name=\"op\" value=\"login\" />";
$bwlogin_text .= " <input type=\"submit\" value=\""._LOGIN."\" /></form>";
if (is_user($user)) {
cookiedecode($user);
$username = $cookie[1];
$bwlogin_text = _WELCOMEBACKU." : <strong>$username</strong> ! [ <a href=\"modules.php?name=Your_Account\"><strong>"._ACCOUNT."</strong></a> | <a href=\"modules.php?name=Your_Account&op=logout\"><strong>"._ODHLASIT."</strong></a> ]";
}
return $bwlogin_text;
}