如何使用php验证用户是否已访问过adf.ly

I'm helping a friend code his websites and he has a button that when people click it, it redirects to an "add" site and then redirects back to his site once the user has clicked "skip add". But he wants the button to change when the user comes back. I was wondering if there was a way to know if the user came from the add site and send the info using PHP so the button can change to "submit"? Or if there is a more efficient way please tell me! I'm relatively new to this type of stuff.

This might work for you. I haven't tested it but it should work.

<?php 

$adfly = "http://adflylink .com"; // Replace with your adfly link
$link = "http://mysite .com"; // Replace with your site link

if ($_SERVER['HTTP_REFERER'] == $adfly) {
    header("Location: ".$link);
} 
else {
    header("Location: ".$adfly);
}

I'm not sure if adfly has and API, but maybe you ca know if he comes from adf.ly by the Referer. This can help you.

session_start();

if(!isset( $_SESSION["origReferer"])){
    if($_SESSION["origReferer"]){
        $_SESSION["origReferer"] = $_SERVER["HTTP_REFERER"];
    }else{
        $_SESSION["origReferer"] = true;
    }
}

$_SESSION["origReferer"] always is going to have the page where the user come from (adf.ly, google.com, facebook.com or what ever) if he comes from another site or true if access directly to your web.