
Anyway, copy this code into a page, and save it with a .php extension:
Code: Select all
<?
$r = $_GET["r"];
if($r != "") { header("Location: http://www.yoursite.com/sites/$r.php"); }
if(isset($_POST['tinyurl']))
{
function gen_chars_no_dup($long=7)
{
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
mt_srand((double)microtime()*1000000);
$i = 0;
while ($i != $long) { $rand = mt_rand() % strlen($chars); $tmp = $chars[$rand]; $pass = $pass.$tmp; $chars = str_replace($tmp, "", $chars); $i++; }
return strrev($pass);
}
$name = gen_chars_no_dup(6);
$filename = "sites/$name.php";
$text = "<? header('Location: $url'); ?>";
$file = fopen($filename, "w");
$chmod = chmod($filename, 0755);
$write = fwrite($file, $text);
fclose($file);
echo "Tiny URL:
[url=http://www.yoursite.com/?r=$name]http://www.yoursite.com/?r=$name[/url]
";
}
?>
<form method="POST" action="<? echo $_SERVER['REQUEST_URI']; ?>">
URL:
<input type="text" value="http://" name="url" size="25">
<input type="submit" value="Tiny URL" name="tinyurl">
</form>

If you have any questions or anything then just let me know
