-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredirect.php
More file actions
26 lines (26 loc) · 865 Bytes
/
redirect.php
File metadata and controls
26 lines (26 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?
$QUERY_STRING=$_SERVER['QUERY_STRING'];
if(isset($QUERY_STRING)){
$url=$QUERY_STRING;
$file=fopen("statistika.txt","r+");
$text = fread ($file, filesize("statistika.txt"));
if (strpos($text, $url) !== false){
preg_match ("#".quotemeta($url)." просмотров ([0-9]+) \\n#i", $text, $matches);
$matches[1] = $matches[1]+1;
$text = preg_replace("#(".quotemeta($url)." просмотров) ([0-9]+) (\\n)#i", "$1 $matches[1] $3", $text);
ftruncate($file, 0);
rewind($file);
fputs ($file, $text);
} else {
fputs ($file, $url." просмотров 1 \n");
}
fclose($file);
}else{
exit("<div align='center' style='font-family:verdana;font-size:12pt;color:red;'>Здесь нет ничего интересного!</div><br>");
}
?>
<html>
<head>
<META http-equiv="Refresh" content="0; url=<?print $url;?>">
</head>
</html>