The form is installed, but the redirection doesn’t work (or redirects to another webpage)
Amongst reasons causing a problem during the redirection, domain changes can be one of them: the authentication on the site is made on a particular domain (http://site.com) whereas the redirection is made on another domain where the authentication is lost (http://www.site.com). The problem can be solved either in defining explicitly the cookies on a group of domains, or in making redirections to be sure that the authentication and the redirection are still matching.
There are several possible solutions to this common problem :
- You make sure that the authentification occurs on the same domain as the redirection page (protected).
- It is possible to change the session cookies domain so that they consider all the sub-domains either in configuring the php.ini (session.cookie_domain), or in calling session_set_cookie_param
(http://www.php.net/manual/en/function.session-set-cookie-params.php).
// To call before session_start so that the right parameters are considered session_set_cookie_param(0,'/','.domain.dns'); session_start();
Another reason which can cause a problem during the redirection: the allow_url_fopen directive turned to ‘Off’. If your host doesn’t want to modify it, a solution exists: the use of the cURL() method instead of file() in the protection script.
$url = 'http://payment.rentabiliweb.com/checkcode.php?'; $url .= 'docId='.$docId; $url .= '&siteId='.$siteId; $url .= '&code='.$_GET['code']; $url .= "&REMOTE_ADDR=".$_SERVER['REMOTE_ADDR']; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_REFERER']); curl_setopt($ch, CURLOPT_TIMEOUT, 10); // time out 10 seconds curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPGET, 1); $result = curl_exec($ch); $result = trim($result); $pos = strpos($result,'OK'); if ($pos === false) { // error } else{ // ok }

