示例#1
0
文件: index.php 项目: laiello/murl
        $id = mysql_escape_string($_GET['id']);
    } elseif (REWRITE) {
        $explodo = explode('/', $_SERVER['REQUEST_URI']);
        $id = mysql_escape_string($explodo[count($explodo) - 1]);
    } else {
        $id = '';
    }
    //Si le "id" est uniquement alphanumérique, c'est bien un id
    if (preg_match('/^([A-Za-z0-9]*)$/', $id, $rs)) {
        if (strstr($_SERVER['REQUEST_URI'], "/stats")) {
            $id = preg_replace("#/([a-zA-Z0-9]+)/stats(.?)#i", "\$1", $_SERVER['REQUEST_URI']);
            include 'url_stats.php';
            //next to implement
        } elseif ($id != '' && $id != basename($_SERVER['PHP_SELF'])) {
            if ($location != -1) {
                $lilurl->redirect_to($id);
            } else {
                //ajout du 404
                header('HTTP/1.0 404 Not Found');
                header('Status: 404 Not Found');
                $msg = '<p class="error">Désolé, mais ce code ne correspond pas à une adresse.</p>';
            }
        }
    } else {
        switch ($id) {
            case "robots.txt":
                ?>
				User-agent: *
				Allow: /
				<?php 
                exit;