Jump to content

Recommended Posts

First off, yes, I do realize this is a PHP forum, but the users around here seem to be very well rounded and I honestly dont have a clue when it comes to javascript, so if i went to a javascript forum they would all laugh at me and i would feel like and uber noob.

 

so with that said, please dont rip into me about posting this on a PHP forum.

 

I am trying to have it so that if someone comes from somthing like,

www.site.com/xxxx/yyyy

they end up at

www.mysite.com/folder/xxxx/yyyy.html

 

I found a piece of java that works for one set page to one set page, but since this site is going to be constantly changing, i really need to have the script set up with vairbles.

 


<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"> 
<!-- Hide script from old browsers<br>

if   (document.referrer = "http://www.referringPageName.html") 
      location.href = "yourPage.html"; 
//-- Stop hiding script --> 
</SCRIPT> 

 

If anybody knows enough about javascript that they could tell me how to do this, it would be greatly appreciated.

 

~D

Link to comment
https://forums.phpfreaks.com/topic/52019-a-javascript-question/
Share on other sites

boo javascript!

lol :D

 

okok... it has its uses... one of which, isnt automated redirects...

 

<?
function get_referrer(){
return (!$ref=@$HTTP_REFERER) ? $_SERVER['HTTP_REFERER'] : $ref;
}
switch(get_referrer()){
case "http://www.google.com":
  header('Location: google.php');
break;
}
exit;
?>

Link to comment
https://forums.phpfreaks.com/topic/52019-a-javascript-question/#findComment-256387
Share on other sites

The main problem with referrer is that it is un-reliable. But if I am understanding you right, maybe this will help:

 

<?php
function get_referrer(){
return (!$ref=@$HTTP_REFERER) ? $_SERVER['HTTP_REFERER'] : $ref;
}

$referrer = get_referrer();

header("Location: " . $referrer);
?>

Link to comment
https://forums.phpfreaks.com/topic/52019-a-javascript-question/#findComment-256397
Share on other sites

If you want proof, go and grab flashget or some similiar program, change the referrer to anything you want and request your page. Or you can also disallow that information to be kept via the browser.

 

Just a word of caution, it works for the most part, but not everyone has the referrer set, or they have set to one thing as to never give out where they have been.  Fun stuff the world of the internet.

 

EDIT

http://www.stardrifter.org/refcontrol/

 

Just found that extension for Firefox.

 

Broken sites - Some sites perform misguided referrer checks in the name of "security". These checks don't add any real security since the referrer is easily faked and can often cause problems when the browser's behavior changes. You can configure RefControl to send these sites whatever they are expecting and work around this kind of problem.

 

Fun - Send humorous things, secure in the knowledge that they are being written into the server's log file for the amusement of anyone who might later discover them there. Ok, maybe that's not much fun, but RefControl will let you do it anyway.

Link to comment
https://forums.phpfreaks.com/topic/52019-a-javascript-question/#findComment-256399
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.