PDA

View Full Version : Redirect to the previous page


A.Chakery
03-10-2014, 09:13 PM
Hello,

I created a custom login page for my forum but I have a problem with redirecting the logged in members to the previous page which they have been viewing as guest!

is there any way to do this ?

Thank you.

ozzy47
03-11-2014, 09:59 PM
What is the code you used for the custom login page?

A.Chakery
03-14-2014, 10:21 PM
What is the code you used for the custom login page?
Thank you for your reply,

This is a part of code which is related to login section :

<td class="alt1">
<div align="center"><strong style="font-size:16px;">Sign-in</strong></div>
<script type="text/javascript" src="clientscript/vbulletin_md5.js?v=$vboptions[simpleversion]"></script>
<form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">

<blockquote><p>$errormessage</p></blockquote>

<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" align="center">
<tr>
<td>$vbphrase[username]:<br /><input type="text" class="bginput" name="vb_login_username" size="25" accesskey="u" tabindex="1" /></td>
</tr>
<br /><br />
<tr>
<td>$vbphrase[password]:<br /><input type="password" class="bginput" name="vb_login_password" size="25" tabindex="1" /></td>
</tr>
<tr>
<td>
<label for="cb_cookieuser"><input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser" tabindex="1" />$vbphrase[remember_me]</label>
</td>
</tr>
<tr>
<td align="$stylevar[center]">
<br /><br /><br />
<div align="center"><input type="submit" class="va-button-b2" value="$vbphrase[log_in]" accesskey="s" tabindex="1" /></div>
</td>
</tr>
</table>
<input type="hidden" name="do" value="login" />
<input type="hidden" name="url" value="$vboptions[bburl]" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
<input type="hidden" name="mapfb" value="true" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
</form>

</td>

Thank you again

ozzy47
03-14-2014, 10:32 PM
I think you may need to change this:
<input type="hidden" name="url" value="$vboptions[bburl]" />

To this:
<input type="hidden" name="url" value="$scriptpath" />

A.Chakery
03-14-2014, 10:49 PM
Thank you for the reply,

But there is a bug issue with "$scriptpath", if I use this variable it will redirects the user to the login page again after signing in not the previous URL.

ozzy47
03-14-2014, 10:53 PM
Hmmmm, so your site has no quick login box, it is a separate form for them to log in from? If that is the case, then I don't believe you can send them back two pages, but I am not totally sure.

A.Chakery
03-15-2014, 07:59 AM
Yes, because of the performance issues I have removed the quick login box on all pages and its a separate sign-in page.

Well, is it possible that I use this action : "onClick="history.go(-2)" in some way ?

thank you for the help