vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Login form redirection (https://vborg.vbsupport.ru/showthread.php?t=66659)

Jolten 06-28-2004 11:09 PM

Login form redirection
 
Hi,

I dislike the little login form on the forum home page. yes it can be handy, but for my site it's just overkill. So, I've done a little modifying and created an html login page which has the same functionality but allows me to you a log in link on other pages. it works just perfectly however, there's one slight problem ? page redirection. After the user clicks "login" they are taken tot he redirection page and told to hang on while they are logged in. Thenthey are redirected back to the log in form. What I would like to do is redirect them to the home page after log in. Can anyone assist me in changing the redirection? Thanks.

Here's the form code as it stands.

HTML Code:

<form action="login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password)">
                <script type="text/javascript" src="clientscript/vbulletin_md5.js"></script>
                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                <tr><td><br /><br /><br /></td></tr>
                <tr>
                        <td align="center" class="smallfont" valign="middle">Username</td></tr>
                        <tr><td valign="middle" align="center"><input type="text" class="button" name="vb_login_username" id="navbar_username" size="15" accesskey="u" tabindex="1" value="" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
                </tr>
                <tr><td><br /></td></tr>
                <tr>
                        <td class="smallfont" valign="middle" align="center">Password</td></tr>
                        <tr><td valign="middle" align="center"><input type="password" class="button" name="vb_login_password" size="15" accesskey="p" tabindex="2" /></td>
                        </tr>
                        <tr><td><br /></td></tr>
        <tr>
        <td class="smallfont" <label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="3" id="cb_cookieuser_navbar" accesskey="c" checked="checked" />Remember Me</label></td></tr><tr>

<td align="center"><input type="submit" class="button" value="  Log In  " tabindex="4" title="Enter username to login" accesskey="s" /></td>


                </tr>
                <tr><td><br /><br /><br /></td></tr>
                </table>
                <input type="hidden" name="s" value="$session[sessionhash]" />
                <input type="hidden" name="do" value="login" />
                <input type="hidden" name="forceredirect" value="1" />                       
                <input type="hidden" name="vb_login_md5password" />
                </form>
                <!-- / login form -->
                       
                </td>


Jolten 07-01-2004 07:11 AM

Nvermind I got it working... and now run without that little log in form for guests :)

Berethorn 07-05-2004 12:54 AM

That's just what I need now for my page! :)

I'm curious - how did you fix it?

Jolten 07-05-2004 02:41 AM

I added a conditional to the template that displays a different message if the user is logged in. Therefore, when a user gets redirected to the same page it simply tells them they have logged in successfully.

I thought about realeasing this as a hack. But it's pretty much the tip created by Gary W. here https://vborg.vbsupport.ru/showthrea...=Powered+pages with my own special template modification.

I'm including the internal parts of the template here, minus header and footer content. Remember to check all link paths to be certain they are correct for your forums. I've not coded this for general release.

HTML Code:


General page start and header content here (use the general or blank shell templates if needed and just paste the information below between the header and footer.)

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="30%" align="center">
<tr>
                       
                       
                        <td class="alt2" width="100%" align="center">

<!-- Show to Logged in users -->
                        <if condition="$bbuserinfo['userid']">
                        <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                        <td align="center" class="smallfont" valign="middle"><b>Hi $bbuserinfo[username]!</b><br />
You have been logged in successfully. </td></tr>
                        </table>
                       
<!-- /Show to Logged in users -->
                       
                        <else />
                       
<!-- login form -->

                <form action="/login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password)">
                <script type="text/javascript" src="/clientscript/vbulletin_md5.js"></script>
                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                <tr><td><br /></td><td></tr>
                <tr>
                        <td align="center" class="smallfont" valign="middle">Username</td></tr>
                        <tr><td valign="middle" align="center"><input type="text" class="button" name="vb_login_username" id="navbar_username" size="15" accesskey="u" tabindex="1" value="" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
                </tr>
                <tr><td><br /></td></tr>
                <tr>
                        <td class="smallfont" valign="middle" align="center">Password</td></tr>
                        <tr><td valign="middle" align="center"><input type="password" class="button" name="vb_login_password" size="15" accesskey="p" tabindex="2" /></td>
                        </tr>
                        <tr><td><br /></td></tr>
        <tr>
        <td class="smallfont" <label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="3" id="cb_cookieuser_navbar" accesskey="c" checked="checked" />Remember Me</label></td></tr><tr>

<td align="center"><input type="submit" class="button" value="  Log In  " tabindex="4" title="Enter username to login]" accesskey="s" /></td>


                </tr>
                <tr><td><br /></td></tr>
                </table>
                <input type="hidden" name="s" value="$session[sessionhash]" />
                <input type="hidden" name="do" value="login" />
                <input type="hidden" name="forceredirect" value="0" />                       
                <input type="hidden" name="vb_login_md5password" />
                </form>

<!-- / login form -->
                       
                </td>
</tr>
</table><br /><br />
</if>
</td></tr></table>
<br /><br />

General footer and closing content here


Berethorn 07-05-2004 03:10 AM

That's exactly what I did just now with mine! :D I tried to add a history.back link for logged in users, but that link keeps sending me back to the logged in page.

HTML Code:

        <if condition="$bbuserinfo['userid']">
<br />

<center>
You are logged in.<br /><a href="#" onclick="history.back(1)" return="false">Click here to go the last page you visited</a>
</center>
<br />
 </if>


knary 01-07-2005 07:09 PM

I added a hidden field to an external login form that sets a variable to the URL of the original referring page. I then added that URL to the list of acceptable global variables. And, finally, tweaked the standard redirect page to use that url IF that variable is set. This way, a user can login anywhere in the site and not get pushed back to the login page, but the actual page where they clicked "login". Make sense?

Jolten 01-11-2005 04:48 AM

knary can you post an example of the code? I'd love to do what you're describing rather than just a conditional for page content.


All times are GMT. The time now is 10:00 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01137 seconds
  • Memory Usage 1,770KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete