1
angaran
Problem with redirections
  • 2006/4/23 8:08

  • angaran

  • Not too shy to talk

  • Posts: 103

  • Since: 2003/8/17


Hi,
I have a site using XOOPS 2.2.4 and every time there is a redirection ( for example when a user is logged in or the user posts a message ) the site add a "?" to the redirection URL. So if the URL was

http://www.mysite.com/modules/news/index.php

it becomes

http://www.mysite.com/modules/news/index.php?

With the question marks on the URL string I have some problems because even when the user is redirected to download a file the site append this "?" and the file isn't found.

What can I do?

Thanks for your help!

2
Dave_L
Re: Problem with redirections
  • 2006/4/23 10:39

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Is the definition for XOOPS_URL correct in mainfile.php?

Are you using any kind of URL mapping, such as redirection in an .htaccess file?

I'm just making wild guesses. I use 2.2.4, and haven't seen this problem.

3
angaran
Re: Problem with redirections
  • 2006/4/23 13:18

  • angaran

  • Not too shy to talk

  • Posts: 103

  • Since: 2003/8/17


No, I don't even have a .htaccess file.
I have checked the mainfile but it's correct.
Any other guess?

4
angaran
Re: Problem with redirections
  • 2006/4/23 14:59

  • angaran

  • Not too shy to talk

  • Posts: 103

  • Since: 2003/8/17


I think the problem is here in te functions.php file in the redirect_header function.

if (defined('SID') && (! isset($_COOKIE[session_name()]) || ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']])))) {
        if (!
strstr($url'?')) {
            
$url .= '?' SID;
        } else {
            
$url .= '&'.SID;
        }


Anyway, SID it's not appended to $url.

5
angaran
Re: Problem with redirections
  • 2006/4/24 20:46

  • angaran

  • Not too shy to talk

  • Posts: 103

  • Since: 2003/8/17


Up!

6
angaran
Re: Problem with redirections
  • 2006/4/26 13:24

  • angaran

  • Not too shy to talk

  • Posts: 103

  • Since: 2003/8/17


My supposition was exact. That is the code snipet responsible of the problem. I have made a workaround disabling personalized sessions. Is there any disadvantage from this?

7
angaran
Re: Problem with redirections
  • 2006/6/28 21:05

  • angaran

  • Not too shy to talk

  • Posts: 103

  • Since: 2003/8/17


A long time after I looked again to this and found a simple solution. I modified the code like this

if (defined('SID') && (! isset($_COOKIE[session_name()]) || ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']])))) {
if (
SID){
            if (!
strstr($url'?')) {
                
$url .= '?' SID;
            } else {
                
$url .= '&'.SID;
            }
}
}


So I added a little check to see if SID has a true value. This way the "?" is not added if SID is an empty string.

Login

Who's Online

274 user(s) are online (183 user(s) are browsing Support Forums)


Members: 0


Guests: 274


more...

Donat-O-Meter

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

Latest GitHub Commits