PDA

View Full Version : A Login Bug on custom pages?


memobug
10-21-2004, 08:24 PM
I created my first vBa customized page today. I chose all the defaults. Hurray! Bad news is it doesn't seem to work right.

1. The first thing I noticed in trying to test it was that the login screen that pops up if you are not logged in does not work

Maybe it's the relative path on the vbulletin message javascript? I thinks so:

<script type="text/javascript" src="clientscript/vbulletin_md5.js"></script>

needs to be

<script type="text/javascript" src="http://www.mydomain.com/forum/clientscript/vbulletin_md5.js"></script>

I fixed clientscript in

STANDARD_ERROR
STANDARD_ERROR_LITE

But it still doesn't work.

So to summarize,

a) I can login and logout on cmps_index.php
b) my cmps_index.php?page=contributor loads up and displays correctly if I am already logged in
c) if I am not logged in it pops up the permissions message and a login box
d) if I try to login there it accepts the password and redirects http://forum.bonsaitalk.com/login with a 404 Page Not Found and
e) I am still not logged in when I type in the forum URL

Brian
10-21-2004, 08:37 PM
http://www.vbadvanced.com/forum/showthread.php?t=1660 ;)

Our Sponsors
 

memobug
10-22-2004, 02:38 AM
Thank you very much for this link. I appreciate you taking the time to point it out.

That fix got me closer. I can login, where I couldn't before, but the redirect doesn't work.

After I login, the redirect sends me to

http://forum.mydomain.com/cmps_index.php?page=contributor

whereas the absolute URL of the cmps page I came from was here:

http://www.mydomain.com/cmps_index.php?page=contributor

The problem now is that the redirect link appears to be relative:

<input type="hidden" name="url" value="/cmps_index.php?page=contributor" />

When it should be absolute?

UPDATE

I am sure there is a more elegant solution, to correct the problem of having this redirect not work, I did the following:

1. find this section of vba_cmps_include_bottom.php:


else
{
$logincode = construct_login_code();
$scriptpath = htmlspecialchars_uni(SCRIPTPATH);
$show['permission_error'] = true;
}


and replace the $scriptpath= line with this:


$scriptpath = "http://www.URL-OF-ROOT-DIRECTORY-CONTAINING-YOUR-CMPS_INDEX.PHP/".htmlspecialchars_uni(SCRIPTPATH);


For me, that is simply the domain with a trailing slash. Note - you don't want the index.php in there:

$scriptpath = "http://www.mydomain.com/".htmlspecialchars_uni(SCRIPTPATH);

Regards,

What that will do is when there is an error from one of your vbacmps pages, it will insert an absolute reference in front of the redirect URL that is passed to Standard Error - so it will stop trying to redirect to nonexistent forum pages.

Regards,

Matt