Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-18-2002, 01:17 PM   #1
3Xguru
Confirmed User
 
Join Date: Sep 2001
Location: Iasi
Posts: 1,281
PHP help please

I want to make a script with a plug and play adult flash e-card that webmasters can put on their website. I have searched the web resources but I cannot seem to understand how to make the script load in a variable the adress of the script(the complete addres).


So if the script is located at http://www.domain.com/script.php I want to load this URL into a variable dynamicaly, and if the script name is changed, so does the variable.

Can anione help?
__________________
-=Free Webmaster Tools=-
3Xguru is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 01:21 PM   #2
notjoe
Confirmed User
 
Industry Role:
Join Date: May 2002
Location: Toronto, Canada
Posts: 5,599
Quote:
Originally posted by 3Xguru
I want to make a script with a plug and play adult flash e-card that webmasters can put on their website. I have searched the web resources but I cannot seem to understand how to make the script load in a variable the adress of the script(the complete addres).


So if the script is located at http://www.domain.com/script.php I want to load this URL into a variable dynamicaly, and if the script name is changed, so does the variable.

Can anione help?

Create a file, phpinfo.php for example, and put <?phpinfo();?>
. you will find the variable (and many more) in the output.

Joe
notjoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 01:24 PM   #3
Rory
Confirmed User
 
Join Date: Jul 2002
Location: I Love Ixtapa, Mexico ö
Posts: 616
$_SERVER['PHP_SELF'] will give you the path of the php file that is executing...... so do this :

$current_page = $_SERVER['PHP_SELF'];
$full_web = "http://www.yourdomain.com" . $current_page;
Rory is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 01:28 PM   #4
Rory
Confirmed User
 
Join Date: Jul 2002
Location: I Love Ixtapa, Mexico ö
Posts: 616
That will work for PHP 4.1+ .. for lower version numbers (get your ass current lol) try $HTTP_SERVER_VARS instead of $_SERVER . That should work even if php is buried in several different dirs. So DONT change the "http://www.yourdomain.com" part to something like "http://www.yourdomain.com/path/to" . Just thought I would clarify.

Rory
Rory is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 01:39 PM   #5
3Xguru
Confirmed User
 
Join Date: Sep 2001
Location: Iasi
Posts: 1,281
Quote:
Originally posted by Rory
$_SERVER['PHP_SELF'] will give you the path of the php file that is executing...... so do this :

$current_page = $_SERVER['PHP_SELF'];
$full_web = "http://www.yourdomain.com" . $current_page;
Yes, I understand the PHP_SELF part, but I also need the name of the domain to be loaded dynamicaly. How do I do that?
__________________
-=Free Webmaster Tools=-
3Xguru is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 01:42 PM   #6
Rory
Confirmed User
 
Join Date: Jul 2002
Location: I Love Ixtapa, Mexico ö
Posts: 616
$_SERVER['HTTP_HOST'] then
Rory is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 01:53 PM   #7
Rory
Confirmed User
 
Join Date: Jul 2002
Location: I Love Ixtapa, Mexico ö
Posts: 616
So here is everything you need :
PHP Code:
$current_host $_SERVER['HTTP_HOST'];
$current_path $_SERVER['PHP_SELF'];

$full_web_path "http://" $current_host $current_path
Now the variable $full_web_path contains the correct info. The "http://" is optional. Like I said above if your PHP < 4.1 you will need to use $HTTP_SERVER_VARS instead of $_SERVER. So this would replace if you are running an earlier version of PHP :
PHP Code:
$current_host $HTTP_SERVER_VARS['HTTP_HOST'];
$current_path $HTTP_SERVER_VARS['PHP_SELF'];

$full_web_path "http://" $current_host $current_path
Hope that helps.

Rory
Rory is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 02:08 PM   #8
3Xguru
Confirmed User
 
Join Date: Sep 2001
Location: Iasi
Posts: 1,281
I have seen some of the variables that PHP has using the phpself() function and I now know how to solve the problem.
hanks to all, especialy to NotJoe
__________________
-=Free Webmaster Tools=-
3Xguru is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 02:09 PM   #9
Rory
Confirmed User
 
Join Date: Jul 2002
Location: I Love Ixtapa, Mexico ö
Posts: 616
http://www.php.net/manual/en/reserved.variables.php
Rory is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-18-2002, 02:17 PM   #10
3Xguru
Confirmed User
 
Join Date: Sep 2001
Location: Iasi
Posts: 1,281
Quote:
Originally posted by Rory
So here is everything you need :
PHP Code:
$current_host $_SERVER['HTTP_HOST'];
$current_path $_SERVER['PHP_SELF'];

$full_web_path "http://" $current_host $current_path
Now the variable $full_web_path contains the correct info. The "http://" is optional. Like I said above if your PHP < 4.1 you will need to use $HTTP_SERVER_VARS instead of $_SERVER. So this would replace if you are running an earlier version of PHP :
PHP Code:
$current_host $HTTP_SERVER_VARS['HTTP_HOST'];
$current_path $HTTP_SERVER_VARS['PHP_SELF'];

$full_web_path "http://" $current_host $current_path
Hope that helps.

Rory
Thanks again. We need more helping people like you on this board.
__________________
-=Free Webmaster Tools=-
3Xguru is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.