1
kjs222
Register to Post Redirect and checklogin.php
  • 2003/11/1 13:33

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


I looked through a number of other posts and can't find one that seems to address this problem.

Scenerio:
1. User comes to site
2. User browses to topic
3. User wants to post, so presses register to post.
4. User is directed to login page, URL =
XOOPSURL/user.php?xoops_redirect=/modules/newbb/viewtopic.php?topic_id=167&forum=38
5. User logs in correctly.
6. User is redirected to an incorrect URL (note, forum= is missing):
XOOPSURL/modules/newbb/viewtopic.php?topic_id=167
7. Instead of being directed to the correct topic (since the forumID is not there), I am directed to main forum page.

I have a feeling that it doesn't like having a "&" as part of the redirect URL (treats it as a new var).

My problem is that even though I'm running 2.0.3, I'm not sure if the problem is fixed in 2.0.5 (I've got CVS latest version of the following checklogin lines):

checklogin.php lines 65-85

    
if (!empty($HTTP_POST_VARS['xoops_redirect']) && !strpos($HTTP_POST_VARS['xoops_redirect'], 'register')) {
        
$parsed parse_url(XOOPS_URL);
        
$url = isset($parsed['scheme']) ? $parsed['scheme'].'://' 'http://';
        if (isset(
$parsed['host'])) {
            
$url .= isset($parsed['port']) ?$parsed['host'].':'.$parsed['port'].trim($HTTP_POST_VARS['xoops_redirect']): $parsed['host'].trim($HTTP_POST_VARS['xoops_redirect']);
        } else {
            
$url xoops_getenv('HTTP_HOST').trim($HTTP_POST_VARS['xoops_redirect']);
        }
    } else {
        
$url XOOPS_URL.'/index.php';
    }


So then, if my checklogin script is up-to-date; has this been fixed somewhere else? (possibly on some forum file?)

Hope this makes sense,
thanks,
Keith

2
kjs222
Re: Register to Post Redirect and checklogin.php
  • 2003/11/1 13:46

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


I just checked, the problem occurs in this site [xoops.org] too. So then that means it's almost garunteed to be a problem where the '&' is being interpretted as a new var... I'm not great with php internals...


Ohh, just remembered this has as much to do with user.php as with checklogin.php... here's the code that's rendered in the form on user.php:

notecouldn't figure out how to render this properly: [& amp;] (no spaces)... hopefully you can figure it out.
<input type="hidden" name="xoops_redirect" value="/user.php?xoops_redirect=/modules/newbb/viewtopic.php?topic_id=147[& amp;]forum=1[& amp;]jump=1" />
</form>


So... the problem seems to be interpretting " & a m p ; " as an & in the checklogin.php

Well, that's enough for me for the moment... I'm really not great at php, so I hope one of you pros will come along and hammer this out in a couple seconds.

Thanks so much,
Keith

3
DobePhat
Re: Register to Post Redirect and checklogin.php
  • 2003/11/1 18:21

  • DobePhat

  • Friend of XOOPS

  • Posts: 656

  • Since: 2003/4/15


I'm trying to follow your post as I have a similar problem but with standard log-in redirect. With yours Im trying to figure out why you are defining the "topic Id" url...?
just curios our problems may or may not be related.


4
kjs222
Re: Register to Post Redirect and checklogin.php
  • 2003/11/1 21:23

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


Quote:

why you are defining the "topic Id" url...?


The topic_id is important because that's the topic that the user is browsing when they click on "register to post". So, for this post, if you simply navigate to this post, you'll have the url:

https://xoops.org/modules/newbb/viewtopic.php?topic_id=13376&forum=20

To test the exact problem, [first, you must not be logged-in] and then from the link above, click "register to post".

After going through the login procedure at that "register to post" page, you will find yourself being redirected to the following address:

https://xoops.org/modules/newbb/viewtopic.php?topic_id=13376

So, it keeps the topic you were in, but because part of the string is after an "&", it doesn't include the forum... the result is an error message, "no forum selected", and then a redirection to the forum index (which is not the post you were previously navigating).

Hope that clarifies,

Thanks,
Keith

Login

Who's Online

215 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 215


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits