|
|||||||
Join now to download all the free website templates or post on the forum. If you have never been on a forum before read the
FAQ. It's quick, easy and free to join!
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Hi folks,
I need a script which enables me to refer users to a specific websites according to a parameter. Example: URL of page with script: www.abc.de/page.php?out=vareside.com Refered to URL: www.vareside.com How to do this? Tutorials, links, snippets or hints are welcome. |
|
||||
|
Better to use $_SERVER["HTTP_REFERER"] to know the referer URL. If the user followed a link to the current page then the referer is theURL that the user has come to the current page from. If they typed in the URL directly or came from their bookmarks then the referer is generally empty. PHP makes the referer automatically available in the variable: $HTTP_REFERER - the url the client just came from. The referer is actually stored in an environment variable which you canget using getenv():
A basic script <?php if (!isset($_SESSION['referrer'])) $_SESSION['referrer']=$_SERVER['HTTP_REFERRER']; if((strpos($a, 'www.foo.com') > -1) || ($a == '')) { // good referer } ?>
__________________
cleandeck - lawn mower undercoating and wilmargraphite - graphite lubricants |
|
||||
|
I have been looking at this one and it would depend upond your version of php.
the foreach construct in php 4 gives an easy way to iterate over arrays. foreach works only on arrays, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. Unless the array is referenced, foreach operates on a copy of the specified array and not the array itself. foreach has some side effects on the array pointer. Don't rely on the array pointer during or after the foreach without resetting it. Reference of a $value and the last array element remain even after the foreach loop. It is recommended to destroy it by unset(). You will get extremely hard-to-find bugs if you leave out the unset(). $_GET['id'] In PHP 4.2.0 and later, the default value for the PHP directive register globals is off. To get DOCUMENT_ROOT you'll use $_SERVER['DOCUMENT_ROOT'] substr Returns the portion of string specified by the start and length parameters. substr($site, 4, -1); If start is negative, the returned string will start at the start 'th character from the end of string. If start is non-negative, the returned string will start at the start 'th position in string , counting from zero. so I'm not understanding the 4.
__________________
cleandeck - lawn mower undercoating and wilmargraphite - graphite lubricants |
|
||||
|
Here is a Java IP (InetAddress) Locator from SourceForge
Java and ColdFusion libraries to lookup country code and language from IP address. It uses a local copy of the WHOIS database to perform fast, accurate lookups of country codes. Useful for log analysis, internationalization, geolocation, etc.. http://sourceforge.net/projects/javainetlocator/ How about taking the variables from the script and passing them to a php file to process the reffer site. Most people have java turned on, you would only miss out on private servers. And why not set a cookie so when they return you can process them.
__________________
cleandeck - lawn mower undercoating and wilmargraphite - graphite lubricants |
![]() |
| Thread Tools | |
| Display Modes | |
|
|