I need a script that will get the fill page URL like http://www.example.com/folder/page.html and save it as a session. +rep for a working script! Thanks.
session_start(); $_SESSION['URL'] = 'http://www.example.com/folder/page.html'; PHP: Or you want to detect current page and save it as session? session_start(); $_SESSION['URL'] = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; PHP:
$fullurl = 'http'; if ($_SERVER['HTTPS'] == 'on') $fullurl .= 's'; $fullurl .= '://'; if ($_SERVER['SERVER_PORT'] != '80') { $fullurl .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI']; } else { $fullurl .= $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; } $_SESSION['URL'] = $fullurl; // "URL" is the session name. you can change it as you like. PHP:
It can be any name you want. $_SESSION['LOL'] , $_SESSION['HEHE'] can be used too. $_SESSION['HEHE'] will carry the URL after you assign value(which is the URL) to it.