Location: PHPKode > scripts > URLmnch > forward.php
<?php

/*    Copyright (C) 2009  Mnch Technologies
 *
 *    This file is part of URLmnch.
 *
 *    URLmnch is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

include 'shuffle.php';
$i = $_SERVER['QUERY_STRING'];
 
if (preg_match("/^[0-9a-z]{6}$/", $i)) {
    dbconnect();
 
    $result = mysql_query("SELECT short, url FROM `url` WHERE `short` = '$i'") or die(mysql_error());
 
    if (mysql_num_rows($result) < 1) {
        header("Location: http://u.mnch.us");
        exit;
    }else
	{
            $row = mysql_fetch_row($result);
	    header("Location: ".$row[1]);
	}
 
}
else
{
   header("Location: http://u.mnch.us");
}
?>
Return current item: URLmnch