< >

counter-admin.php


Quell Code


<?php
if(!isset($_SESSION)){
//session_start(); 
$log=true;
}else{
$log=false;
}
error_reporting(E_ALL); 
ini_set('display_errors', true);
$passwort='admin';
$admin='admin';
$file='besucherzaehler.txt';
if(!file_exists($file)){
$current = file_get_contents($file);
               $inhalt= "0";
               file_put_contents($file, $inhalt);
}else{
               $inhalt = file_get_contents($file);
}


if(!empty($_SESSION['counteradmin'])){
 if($_SESSION['counteradmin']==$admin){
    echo "Du bist eingeloggt als $_SESSION[counteradmin]<br>";
    $log=true;
 }
}else{
    $log=false;
}
 
if(isset($_POST['send'])){
      if($_POST['admin']==$admin && $_POST['pass']==$passwort || $log=='$true'){
          $_SESSION['counteradmin']=$_POST['admin'];
          $log=true;
      }else{
           echo "Name oder Passwort falsch";
      }
}     
         
if(isset($_POST['send1'])){       
          if(!file_exists($file)){
               $current = file_get_contents($file);
               $inhalt= "0";
               file_put_contents($file, $inhalt);
          }else{
               $current = file_get_contents($file);
               $inhalt= $current + 1;
               file_put_contents($file, $inhalt);
          }
}
?>


<!DOCTYPE html>
<html lang="de">
<head>      									
	<title>Counter mit admin log</title>
	
	<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>itel</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-122955144-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-122955144-1');
</script>
<style>
*{
margin:0;
padding:0;
}
#basti1012{
position:absolute;
bottom:10px;
left:calc(50% - 50px);
text-align:center;
font-size:12px;
color:blue;
width:100px;
}
body {
  color: #2c3e50;
  background: #ecf0f1;
  text-align:center;
}
#counter{
  margin:40px;
  font-size:80px;
}

</style>
</head>
<body>
<?php
if($log==false){
?>
<form method="POST">
<span>Logge dich ein um den Counter zu erhöhen</span><br>
<input type="text" placeholder="Adminname..." name="admin"> ( admin )<br>
<input type="text" placeholder="Passwort..." name="pass">( admin )<br>
<input  type="submit" name="send" value="einloggen">
</form>
<?php
}else{
?>
<form method="POST">
<span> Jeder klick erhöht den Counter um ein</span><br>
<input id="hoch" type="submit" name="send1" value="Erhöhe um 1+"><br>
</form>
<?php
}
?>
<span id="counter"><?php echo $inhalt; ?></span>
<script>

 
$('*').click(function(){

//alert(this);
  
})

</script>

 
</body>
</head>



Add Comment

* Required information
1000
Powered by Commentics

Comments (1)

Gravatar
Admin
Sascha65says...

Die Canvas Balken Uhr ist ja mal Fett