Sie sind hier : basti1012.de/ Kurze-Scripte-und-Codeschnipsel / index.php

Zurück


Der Quellcode dazu


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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
error_reporting
(E_ALL); 
ini_set('display_errors'true);
?>
<!DOCTYPE html>
<html lang="de">
<head>
    <title>Ip sperren für pages</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<style>
*{
margin:0;
padding:0;
}

body{
  color: #2c3e50;
  background: #ecf0f1;
  text-align:center;
  font-size:30px;
}
input{
font-size:30px;
padding:5px;
}
h1 {
  text-align: center;
}
#code{
margin-top:100vh;
text-align:left;
font-size:10px;
}
dialog{
width:500px;
height:300px;
position:fixed;
z-index:600;
top:200px;
left:calc(50% - 250px);
}
#backdrop{
display:none;
z-index:502;
height:100vh;
width:100vw;
position:fixed;
top:0;
left:0;
background:rgba(0,0,0,0.6);
}
</style>
</head>
<body>
<div id="backdrop"></div>
<?php 
if(isset($_GET['seite'])){
     die(
"<style>body{font-size:100px;text-align:center;}</style>Dank für den Besuch auf Seite ".$_GET['seite']."<br><a href='ipsperre2.php'>Zurück</a>");
}
$timestamp=date('U');
$sperre=22;
$datum_zeit date("d.m.Y H:i:s");
$ip $_SERVER["REMOTE_ADDR"];
$speicherort "beispiel.txt"
if(isset(
$_POST['letsgo'])){
      
$pages=['1','2','3','4','5','6','7','8','9','10'];
      
$pa=$pages[rand(1,10)];
      
$inhalt "$ip;$pa;$timestamp;$datum_zeit\r\n";
      
file_put_contents("beispiel.txt"$inhaltFILE_APPEND);
      
?>
      <dialog id="favDialog">
         <form method="dialog">
            <section>
                  <div id="timer"></div>
                  <span> Auf Seite :<?php echo $pa?></span>
            </section>
            <menu>
                 <button id="cancel" type="reset">Cancel</button>
            </menu>
         </form>
      </dialog> 
<script>
(function() {
     var favDialog = document.getElementById("favDialog");
     document.getElementById("backdrop").style.display='block';
     favDialog.showModal();
     g=10;
     timer=setInterval(function(){
         g--;
         document.getElementById("timer").innerHTML="Sie werden weitergeleitet in<br>"+g+" Sekunden <br>";
         if(g<=0){
            clearInterval(timer);
            location.href="ipsperre2.php?seite=<?php echo $pa?>";
         } 
     },1000);
     var cancelButton = document.getElementById('cancel');
     cancelButton.addEventListener('click', function() {
         favDialog.close();
              document.getElementById("backdrop").style.display='none';
         location.href='ipsperre2.php';
     });
})();
</script>
<?php
}else{
$daten = array(); 
if (
file_exists($speicherort)){      
    
$daten file($speicherortFILE_IGNORE_NEW_LINES);
    foreach (
$daten as $value){
        
$datensave explode(";"$value);
        
$iptxt=$datensave[0];
        
$timestamptxt=$datensave[2];
        if(
$iptxt==$ip){
            
$timmerest=$timestamptxt+$sperre;
            
$rest=$timmerest-$timestamp;
            if(
$rest>=1){
                die(
"Wilkommen zurück .Sie haben in <span id='back'>$rest</span> Sekunden wieder zugang
                <script>
                runter(
$rest);
                function runter(s){
                    if(s<=0){
                         location.reload();
                    }else{
                         setTimeout(function(){
                             s--;
                             runter(s);
                             document.getElementById('back').innerHTML=s;
                         },1000);
                    }
                }
                </script> "
);
             }
        }
     }
}else{
     
file_put_contents("beispiel.txt""");
}
}
?>
<form action="ipsperre2.php" name="formsend" method="POST">
<input type="hidden" name="site" value="leer">
<input type="submit" id="updateDetails" name="letsgo" value="Open Random Page">
</form>
<h2>Code dieses Scriptes</h2>
<div id="code">
<?php echo highlight_file('ipsperre2.php'); ?>
</div>
</body>
</html>