Page 1 of 2
[solved] easy question
Posted: Fri Feb 06, 2004 9:56 pm
by Illusionist
Hey, im a little brain dead, and im nto really int he mood to be searching through this big book on how to do this: anways, i have a script taht when someone view my page it takes int heir anem and such, but if there is a space in their name it wont add... hmm... wonder why? i tried stripslahes() and trim() but nothing seems to work.. Any ideas?!
Posted: Sat Feb 07, 2004 12:17 am
by Illusionist
i found that it is because the URL contains the spaces... but there isn't anything i can do about that... because i'm getting the name from somewehre else and have no control over how it is formated before it gets passed through my page....
Posted: Sat Feb 07, 2004 6:54 am
by qads
Code: Select all
<?php
$name = $_GET['name'];
$name = str_replace(" ", "_",$name);
?>
put that on the top of page where you want to add the name to db or whatever, it will replace spaces with underscore, when u need to display it just replace underscore with space

.
Posted: Sat Feb 07, 2004 1:23 pm
by Illusionist
thansk bud, but that doesn't work!!! the GET stops at the first space it comes to... so if the name was like Bob Marley, it will only get Bob
Posted: Sun Feb 08, 2004 3:08 pm
by Illusionist
Anyone else got any ideas that might help?!?!?!?!?!?!?!?!?!?!?!?!
Posted: Sun Feb 08, 2004 4:58 pm
by DuFF
What is the output if you use this?
Code: Select all
<?php
echo $_SERVER['REQUEST_URI'] . "<br />";
echo $_SERVER['QUERY_STRING'];
echo "<pre>";
print_r($_GET);
echo "</pre>";
?>
You might be able to use one of those to get the name. I don't know why your script isn't working. When I tested it on my server it kept adding "%20" in between the two parts of my name. (In case you didn't know, %20 = blankspace).
Posted: Sun Feb 08, 2004 7:05 pm
by Illusionist
ya i know %20 is a blankspace... this si what i get:
Code: Select all
/profile/?sn=encryptedsn=encryptedArray
(
їsn] => encrypted
)
and the screename is encrypted bug
it always messes up with there is a space int eh screenname
Posted: Sun Feb 08, 2004 7:15 pm
by Illusionist
hmm.... if i type it into the url, i get teh ocrrect result:
Code: Select all
/profile/?sn=encrypted%20%20bug
sn=encrypted%20%20bug
Array
(
їsn] => encrypted bug
)
but the other way is comming from a link in the AIM profile window and im using %n to get teh screenname, but it still shows the screenname as encrypted bug, but the page doesn't get it....
Posted: Wed Feb 11, 2004 1:31 pm
by Illusionist
*BUMP*
anyone got any ideas? It seems as if a name is passed in through a link with spaces in it, the $_GET['name'] will not work... it only gets the first part until it reaches the first space... Anyone got ANY other ideas on how i can get the full string after name= ??
Thanks
Posted: Wed Feb 11, 2004 1:34 pm
by jason
Do you have any control over how the name is being passed?
If so, use urlencode() on the name before passing it over.
Posted: Wed Feb 11, 2004 1:57 pm
by Illusionist
Illusionist wrote:i found that it is because the URL contains the spaces... but there isn't anything i can do about that... because i'm getting the name from somewehre else and have no control over how it is formated before it gets passed through my page....
no i dont... What im doing is making sub-profiles for my friends like buddyprofile.com... But the only thing i can't get over now is that when a s/n with spaces clicks teh link it only GETS teh first part of the name fromt he URL. If you know anyone that has a profile hosted by buddyprofile.com, and you have AIM format your s/na nd put a few spaces in it, and then look at their profile. before you click the sub-profile link, look at the URL it has your name at the end witht he spaces, but once you click through if the person has it setup to show the person's name then it will have your name there, wiht no spaces... If not then look at the links for soem of the other pages, they should also have your name int here without the spaces.... How did they format it so that it removes the spaces?! because i haven't even been succesful in retrieve the second part of a name!
Thanks for the help
Posted: Wed Feb 11, 2004 7:50 pm
by Illusionist
someone's gotta know something!!! come on experts help me out

Posted: Wed Feb 11, 2004 8:01 pm
by markl999
The passed value has to have no spaces, or be urlencoded (or rawurlencoded) .. that's pretty much it.
Posted: Wed Feb 11, 2004 8:03 pm
by d3ad1ysp0rk
Maybe AIM removes it for you?
Posted: Fri Feb 20, 2004 5:31 pm
by Illusionist
BUMP