Custom Login Page
by
07 Sep 2009
Rating: (1 vote
- 4.00 average)
I personally hate seeing that ugly login box at the top of the screen in the navbar template. I came up with this quick and easy fix, have a separate page for it. If you'd like a custom login page, and simply have to link to it in your navbar, then follow the quick steps below. Step 1) Create a new .php file called clogin.php (it must be named this, do not change the name), and upload it to your forum root directory. Step 2) Put the below code in your new clogin.php file: Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'clogin'); // change this depending on your filename // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( ); // get special data templates from the datastore $specialtemplates = array( ); // pre-cache templates used by all actions $globaltemplates = array( 'clogin', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits[$parent] = 'Login'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('clogin') . '");'); ?> Step 4) Insert the following code into your "clogin" (without the quotation marks): Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> <title>$vboptions[bbtitle]</title> $headinclude </head> <body> $header $navbar <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tr> <td class="tcat">Login</td> </tr> <tr> <td class="alt1"> <if condition="$show['member']"> <meta HTTP-EQUIV="REFRESH" content="0; url=index.php"> </if> Welcome to SITENAME, Guest.<br /><br /> You appear to either not have an account, or not be logged in. If you have an account, please login using this page right below this text. If you do not have an account already, please visit the <i>register</i> page by clicking <a href="register.php">here</a>.<br /><br /> By being a member of SITENAME, you will have rights to create threads, and posts, release and download software, and do so much more. Please login below.<br /><br /> <!-- login form --> <form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])"> <script type="text/javascript" src="clientscript/vbulletin_md5.js?v=$vboptions[simpleversion]"></script> <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0"> <tr> <td class="smallfont" style="white-space: nowrap;"><label for="navbar_username">$vbphrase[username]</label></td> <td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td> <td class="smallfont" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />$vbphrase[remember_me]</label></td> </tr> <tr> <td class="smallfont"><label for="navbar_password">$vbphrase[password]</label></td> <td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" /></td> <td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="104" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td> </tr> </table> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" /> <input type="hidden" name="do" value="login" /> <input type="hidden" name="vb_login_md5password" /> <input type="hidden" name="vb_login_md5password_utf" /> </form> <!-- / login form --> </td> </tr> </table> $footer </body> </html> You must change all of the "SITENAME" text in your new template to your actual site name. Please post here if you need assistance, please. Credits to Gary King! (How to create your own vBulletin-powered page! (uses vB templates)) |