-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
66 lines (53 loc) · 1.9 KB
/
index.php
File metadata and controls
66 lines (53 loc) · 1.9 KB
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
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
<?php
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
$url = "https";
else
$url = "http";
// Ajoutez // à l'URL.
$url .= "://";
// Ajoutez l'hôte (nom de domaine, ip) à l'URL.
$url .= $_SERVER['HTTP_HOST'];
// Ajouter l'emplacement de la ressource demandée à l'URL
$url .= $_SERVER['REQUEST_URI'];
// Ajouter le chemin du fichier
$url .= "list.txt";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Web-Reporter</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<center>
<h1>Report A Website</h1>
<form method="GET" action="sender.php">
<input type="text" name="site" required="required" value="www.exemple.com"><br><br>
<input class="button" type="submit" name="Send">
</form>
<br><br><br><br><br><br>
<?php
$file = new \SplFileObject('list.txt', 'r');
$file->seek(PHP_INT_MAX);
?>
<?php
$monfichier = fopen('compteur.txt', 'r+');
$pages_vues = fgets($monfichier); // On lit la première ligne (nombre de pages vues)
$pages_vues += 1; // On augmente de 1 ce nombre de pages vues
fseek($monfichier, 0); // On remet le curseur au début du fichier
fputs($monfichier, $pages_vues); // On écrit le nouveau nombre de pages vues
fclose($monfichier);
echo '<p>This page has been viewed ' . $pages_vues . ' times !</p>';
?>
<?php $blocked = $file->key() + 1 - 30; ?>
<br><br>
<h2>List of blocked domaines (There are <?php echo $blocked ?> domaines blocked in the Web-Reporter list)</h2>
<textarea id="textArea">
<?php echo "$url" ?>
</textarea>
<button class="button" onclick="copyToClipBoard()">Copy</button>
<script src="script.js"></script>
</center>
</body>
</html>