...

View Full Version : Explode URL and Use Script



Xibe
08-07-2007, 02:32 AM
Okay, so right now I have a script that I made that lets a user type in their username & country and then generates a signature image (PNG) for them to put as their signature in a forum.

Right now, they can go to:

http://mysitehere.com/sig.html

Type in Username, Country, and select a signature background image.

Then it will go through a script: sig.php that builds the image based on their username, country, and selected background.

The signature also shows their live status, either: Online (browsing the forum) or Offline (not logged in).

How do I make it so that anyone who goes to:

http://mysitehere/background1/usa/xibe
or
http://mysitehere/backgroundchoice/country/username

will be taken through the sig.php script and their signature made.

That way they can go to the forum and use:

http://mysitehere/backgroundchoice/country/username
as their sig.

I'm sorry this is confusing but does anyone get it??

TheShaner
08-07-2007, 02:54 AM
sig.html has a form that submits their user name, country, and background selection. These key and value pairs get sent to sig.php. So, if you want those same key and value pairs sent to sig.php, you would do:

http://mysitehere.com/sig.php?username=xibe&country=usa&background=1

This is all assuming that the form field for username is called username, the country form field is called country, and the background form fields are called background.

Also, since you will be posting the values to the query string, you have to make sure that your sig.php script checks both POST values and GET values (i.e. method=post form values and query string values). Or, if the script uses $_POST to grab the form values, you just change them to $_REQUEST, although some may argue you shouldn't use $_REQUEST anymore. And, your last alternative which I think is the best, is to change your form's method to method=get and change your sig.php script to use $_GET to grab the values.

-Shane

Xibe
08-07-2007, 03:12 AM
Thank you SOOO much.

That worked great.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum