Redirect with spaces in the $_GET varible???

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
itsallgood
Registered User
Posts: 76
Joined: Wed May 05, 2004 8:54 pm

Redirect with spaces in the $_GET varible???

Post by itsallgood »

Alright guys,

I'm redirecting to the login page with this "newpage.php?name= John Smith"

Ok, the name gets to the login page, as when i use echo $_Get['redirect']

Its right, both names are still there, John and Smith

BUT, when the page actually redirects to newpage.php

The name has become just John. The smith has gone. It must be because of the space, but like i say, its all good up til the login page redirecting to the new page.

So, what part in login.php is stripping out spaces, and where is the part that redirects (theres so many "redirects" in there :cry: )

Cheers guys! :lol: :lol: :lol:
$userdata
I've Been Banned!
Posts: 5
Joined: Mon Jan 30, 2006 3:57 pm

Post by $userdata »

try replacing spaces with underscores (_), it will work alot better and look alot cleaner.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

urlencode() will take a URL and encode it so that spaces are replaced by %20 and other special characters are handled as well.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
itsallgood
Registered User
Posts: 76
Joined: Wed May 05, 2004 8:54 pm

Post by itsallgood »

Ok thanks guys,

But where abouts in the login.php does it actually redirect after a correct username and password is entered?

I found this:

Code: Select all

if( $session_id 						$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "index.$phpEx";
						 redirect(append_sid($url, true));//redirect(append_sid($url, true));
}
Which is seems right, but $HTTP_POST_VARS['redirect'] already has the Second name removed???

Thanks again.

(p.s $userdata, the spaces are required as its the persons name, and there are already 300 users. cheers for the idea though man.)
itsallgood
Registered User
Posts: 76
Joined: Wed May 05, 2004 8:54 pm

Post by itsallgood »

Forget that guys, thanks again.

I actually used $userdatas idea, i sent the varible with _ using;

$usename = str_replace(" " , "_" , $usename);

then on the other page, i changed it back using:

$usename = str_replace("_" , " " , $usename);


Thanks for your help :lol:
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

itsallgood wrote: Forget that guys, thanks again.

I actually used $userdatas idea, i sent the varible with _ using;

$usename = str_replace(" " , "_" , $usename);

then on the other page, i changed it back using:

$usename = str_replace("_" , " " , $usename);

Then what do you do if someone has a username as "User_Name" ;-)

You will change the _ back into a space, when it was an _ all along, correct? ;-)
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
itsallgood
Registered User
Posts: 76
Joined: Wed May 05, 2004 8:54 pm

Post by itsallgood »

drathbun wrote:
itsallgood wrote:Forget that guys, thanks again.

I actually used $userdatas idea, i sent the varible with _ using;

$usename = str_replace(" " , "_" , $usename);

then on the other page, i changed it back using:

$usename = str_replace("_" , " " , $usename);

Then what do you do if someone has a username as "User_Name" ;-)

You will change the _ back into a space, when it was an _ all along, correct? ;-)


lol good point matey, and i wouldnt of even thought of that.

Lucky this fourm has been made only for the 200 or so users that have been added with the csv mod, and no-one else will be added.

Thanks for everyones help.

Regards.
Post Reply

Return to “[2.0.x] MOD Writers Discussion”