示例#1
0
        $msg = '<p class="error">Invalid protocol!</p>';
    } else {
        $msg = '<p class="error">ERROR ' . __LINE__ . ': Creation of your short URL failed for some reason.</p>';
    }
} else {
    if (isset($_GET['id'])) {
        $id = mysql_escape_string($_GET['id']);
    } elseif (REWRITE) {
        $explodo = explode('/', $_SERVER['REQUEST_URI']);
        $id = mysql_escape_string($explodo[count($explodo) - 1]);
    } else {
        $id = '';
    }
    // if the id isn't empty and it's not this file, redirect to it's url
    if ($id != '' && $id != basename($_SERVER['PHP_SELF'])) {
        $location = $lilurl->get_url($id);
        //
        // log the access
        $time = date("M j G:i:s Y");
        $ip = getenv('REMOTE_ADDR');
        $userAgent = getenv('HTTP_USER_AGENT');
        $referrer = getenv('HTTP_REFERER');
        $query = getenv('QUERY_STRING');
        //COMBINE VARS INTO OUR LOG ENTRY
        $msg = "LILURL " . $id . " IP: " . $ip . " TIME: " . $time . " REFERRER: " . $referrer . " SEARCHSTRING: " . $query . " USERAGENT: " . $userAgent;
        $today = date("Y_m_d");
        $logfile = $today . "_log.txt";
        $dir = 'logs';
        $saveLocation = $dir . '/' . $logfile;
        if (!($handle = @fopen($saveLocation, "a"))) {
            exit;