Tell me, please, a script that would show from which site the user came to us. If he just entered the address in the address bar, then move it to the main page.
|
1 answer
$_SERVER['HTTP_REFERER']
- Spasibki =) - oOKomarOo
- Redirects can be done like this: header ("Location: example.com/" ); - Torteg
- There can be problems with redirection, if up to the header, ie to the header ("Location: example.com/" ); there will be some kind of output command (for example: echo "test text";). This is for you. - Gene Ant
- I did this: <? php $ block = $ _SERVER ['HTTP_REFERER']; if (strln ($ block)> 0) {// Page Code} else {echo "<script> location.href = '/ index.php'; </ script>"; } - oOKomarOo
- oneIf javascript is disabled for me, then your code will not work. Everything is better through the header. - Gene Ant
|