Consider a domain "a.com" & "b.com" from "a.com" i place a link of "b.com" which opens in a new window, now when "b.com" opens there should be a php session start , and during that session when user refresh the page of "b.com" the page should be redirected to "b.com/sample" (i-e i don't want the direct access to "b.com" , i want the access to "b.com" only when it is referred from "a.com") Can anyone help ? I am very new to php , so please don't make fun of my Question
It's not the full code, but this can help in redirecting. <?php $url = "http://url.com"; $url = explode(".", $url); $fixed = $url[0]; $fixed = "YOURNEWURL"; echo "<a href=\"$fixed$url\">$fixed$url</a>"; ?> PHP:
<?php if ( $_SERVER['HTTP_REFERER'] == "http://www.a.com" ) header( 'Location: http://www.b.com/sample' ) ; else echo "Some Error Found"; echo '<br>You are reffered from '.$_SERVER['HTTP_REFERER'] ; ?> Try to print $_SERVER['HTTP_REFERER'] and check .. Because i didnt check this