Looking for a Simple PHP redirection Script

Discussion in 'Programming' started by ottoisaac, Feb 12, 2008.

  1. #1
    Basically I'm looking for a script that will inform my users when they're leaving my site, like:

    You are now leaving This site!

    By clicking here you will be redirected.



    Anyone know of a script like this?
     
    ottoisaac, Feb 12, 2008 IP
  2. picobello

    picobello Well-Known Member

    Messages:
    572
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    110
    #2
    It is not possible to detect someone leaving a website by doing server-side scripting
     
    picobello, Feb 12, 2008 IP
  3. federal

    federal Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can use javascript.
     
    federal, Feb 12, 2008 IP
  4. Ryandarin

    Ryandarin Peon

    Messages:
    66
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You could always use something like http://anonym.to/ which shows users a page before redirecting them (you may be able to customize the text, I'm not sure.) http://anonym.to/?http://anonym.to/en.html

    Some of the anonym.to code, which may or may not help -
    script link
    
    <script src="http://js.anonym.to/anonym/anonymize.js" type="text/javascript"></script>
    
    <script type="text/javascript"><!--
    protected_links = "";
    
    auto_anonymize();
    //--></script>
    
    Code (markup):
    anonymize.js
    
    var protected_links = "";
    var a_to_va = 0;
    var a_to_vb = 0;
    var a_to_vc = "";
    function auto_anonymize()
    {
    	auto_anonyminize();
    }
    function auto_anonyminize()
    {
    	var a_to_vd = window.location.hostname;
    	if(protected_links != "" && !protected_links.match(a_to_vd))
    	{
    		protected_links += ", " + a_to_vd;
    	}
    	else if(protected_links == "")
    	{
    		protected_links = a_to_vd;
    	}
    	var a_to_ve = "";
    	var a_to_vf = new Array();
    	var a_to_vg = 0;
    	a_to_ve = document.getElementsByTagName("a");
    	a_to_va = a_to_ve.length;
    	a_to_vf = a_to_fa();
    	a_to_vg = a_to_vf.length;
    	var a_to_vh = false;
    	var j = 0;
    	var a_to_vi = "";
    	for(var i = 0; i < a_to_va; i++)
    	{
    		a_to_vh = false;
    		j = 0;
    		while(a_to_vh == false && j < a_to_vg)
    		{
    			a_to_vi = a_to_ve[i].href;
    			if(a_to_vi.match(a_to_vf[j]) || !a_to_vi || !a_to_vi.match("http://"))
    			{
    				a_to_vh = true;
    			}
    			j++;
    		}
    		
    		if(a_to_vh == false)
    		{
    			a_to_ve[i].href = "http://anonym.to?" + a_to_vi;		
    			a_to_vb++;
    			a_to_vc += i + ":::" + a_to_ve[i].href + "\n" ;	
    		}
    	}
    	var a_to_vj = document.getElementById("anonyminized");
    	var a_to_vk = document.getElementById("found_links");
    	if(a_to_vj)
    	{
    		a_to_vj.innerHTML += a_to_vb;
    	}
    	if(a_to_vk)
    	{
    		a_to_vk.innerHTML += a_to_va;
    	}	
    }
    function a_to_fa()
    {
    	var a_to_vf = new Array();
    	protected_links = protected_links.replace(" ", "");
    	a_to_vf = protected_links.split(",");
    	return a_to_vf;
    }
    Code (markup):
    I'm not good with javascript by any stretch of the imagination, but it seems that you would want to change
    	a_to_ve[i].href = "http://anonym.to?" + a_to_vi;		
    Code (markup):
    in anonymize.js to be a script on your site which would take the site after ? and show a page telling the user what ever you like. I could always help if you wanted help creating something specific.

    /R
     
    Ryandarin, Feb 12, 2008 IP
  5. ottoisaac

    ottoisaac Well-Known Member

    Messages:
    245
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #5
    What I want is a script that I can run the URLS through, like http://mysite.com/link.php?url=http://google.com

    The page would have a notice like this "Your are now leaving our site, click continue to go to link"

    Anyone else have any ideas?
     
    ottoisaac, Feb 12, 2008 IP
  6. Ryandarin

    Ryandarin Peon

    Messages:
    66
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Use the js I posed above to find all links on the site, and direct it to a page, say redir.php?url=http://url.com

    redir.php
    
    <?php 
    echo "You are now being redirected to " . $_GET["url"] . "<br />Click <a href='" . $_GET["url"] . "'> here </a> to continue with the link";
    ?>
    
    Code (markup):
     
    Ryandarin, Feb 12, 2008 IP
  7. stealthstatus

    stealthstatus Banned

    Messages:
    107
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    maybe a simple script will help you :cool:

    <script>
    var browser_type=navigator.appName
    var browser_version=parseInt(navigator.appVersion)
    
    //if NS 6
    if (browser_type=="Netscape"&&browser_version>=5)
    window.location.replace("http://www.yoursite.com")
    //if IE 4+
    else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
    window.location.replace("http://www.yoursite.com")
    //if NS4+
    else if (browser_type=="Netscape"&&browser_version>=4)
    window.location.replace("http://www.yoursite.com")
    //Default goto page (NOT NS 4+ and NOT IE 4+)
    else
    window.location="http://www.yoursite.com"
    </script>
    Code (markup):
     
    stealthstatus, Feb 12, 2008 IP
  8. momomesh

    momomesh Active Member

    Messages:
    500
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #8
    i'm also looking for this script anyone can help??

    Thanks
     
    momomesh, Apr 5, 2009 IP
  9. momomesh

    momomesh Active Member

    Messages:
    500
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #9
    i found some info, and i think it has ALOT to do with AJAX Link Tracker,
    but the coding is quite hard and confusing,

    i'll look into this matter~
    it'll save me alot of work if i get it going,

    ovguide is using this javascript/ajax,
    but i don't think they'll teach you how to use it
     
    momomesh, Apr 5, 2009 IP
  10. manly_ninja

    manly_ninja Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Very easy, this is example:
    
    <?php
    header('Location: http://webs-heaven.blogspot.com');
    ?>
    
    PHP:
     
    manly_ninja, Apr 6, 2009 IP
  11. momomesh

    momomesh Active Member

    Messages:
    500
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #11
    the simplest way i've found

    is the use "http://www.example.com/Adpage.php?url=http://www.rapidshare.com/xxx"

    Your Need 2 PHP pages: One to Trigger the Above Link, The Other Is "Adpage.php"

    On Adpage.php just put the follow:
    "<?php
    echo "You are now being redirected to " . $_GET["url"] . "<br />Click <a href='" . $_GET["url"] . "'> here </a> to continue with the link";
    ?>"

    And whatever you put after /Adpage.php?url="......" will be sent to the $_GET["url"]

    but the biggest problem is of course people will be able to look at your url variables, and just copy from it,
    so there should be another solution to this,

    i'm still looking into it
     
    momomesh, Apr 10, 2009 IP
  12. Mr.Bin

    Mr.Bin Peon

    Messages:
    4
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Let try....
    have fun...:D
     
    Mr.Bin, Apr 12, 2009 IP
  13. .3rok3n

    .3rok3n Well-Known Member

    Messages:
    383
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    135
    Digital Goods:
    1
    #13
    i made the script working exactly like Ovguide.com feel free to contact me
     
    .3rok3n, Sep 11, 2009 IP