- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
<?php
if(isset($_GET['pid'])){
$pid = $_GET['pid'];
echo $pid;
$szi=iconv_strlen($pid);
if(file_exists("./$pid.txt")){
$fc=fopen("$pid.txt","r");
if($fc<0)exit(0);
fseek($fc,0,0);
$url = fread($fc,filesize("./$pid.txt"));
fclose($fc);
header('Location: '.$url);
} else {
echo "File not exist<br>";
};
};
$idx=0;
$fc=fopen("index.txt","r");
if($fc<0)exit(0);
$idx = fread($fc,filesize("index.txt"));
fclose($fc);
$fc=fopen("./$idx.txt","r");
if($fc<0)exit(0);
$url = fread($fc,filesize("./$idx.txt"));
fclose($fc);
echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$idx\">$url</a>";
if(isset($_POST['url'])){
$url=$_POST['url'];
if (parse_url($url)) {
echo "Your url is ok.";
for($i=0;$i<=$idx;$i+=2){
$fc=fopen("$i.txt","r");
if($fc<0)exit(0);
$urla = fread($fc,filesize("$i.txt"));
fclose($fc);
// echo "$urla<br>";
if(strcmp($url,$urla)==0){
echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$i\">http://netelis.hmsite.net/index.php?pid=$i</a>";
exit(0);
};
};
} else {
echo "Wrong url.$url";
exit(0);
}
$sz=iconv_strlen($idx);
$idx+=2;
$fn=$idx.".txt";
$fd=fopen($fn,"a+");
if($fd<0)exit(0);
fwrite($fd,$url);
fclose($fd);
unlink("./index.txt");
$fd2=fopen("index.txt","a+");
if($fd2<0)exit(0);
fwrite($fd2,$idx);
fclose($fd2);
echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$idx\">http://netelis.hmsite.net/index.php?pid=$idx</a>";
};
?>
<H1> Short URL generator</H1>
<form action="" method="POST" name="ifr">
Enter URL:
<input type=text name="url" value="http://">
<br>
<input type=submit name="sbm" value="OK">
</form>