Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passwortabfrage in HTML
#16
So ich habe nochmal was gebastelt.
Mit Sessions und eigener zugriff.inc.php.

Aufbau:
- abfrage.php
- Ordner "edit"
- zugriff.inc.php
- .htaccess

abfrage.php:
PHP Code:
<?php
include("edit/zugriff.inc.php"); // Zugriffsdatei einbinden

$eingelogt FALSE;
session_start();

//Auslogen
if($_GET["form"] == 2)
{
  unset(
$_SESSION['user']);
  
session_destroy();
}

//Einlogen
if ((!empty($_POST["usr"]) && !empty($_POST["pwd"])) || !empty($_COOKIE["wlog"]) || isset($_SESSION["user"])) {
  if ((
$_POST["usr"] == $user && $_POST["pwd"] == $pass) || ($_COOKIE["wlog"] == "we37jXp") || isset($_SESSION["user"])) {
    
//Nutzer hat sich eingeloggt?
    //setcookie("wlog", "we37jXp");
    
$_SESSION['user'] = $_POST["usr"];
    
$eingelogt TRUE;
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link type="text/css" href="-.css" rel="stylesheet" media="screen" />
<title>Passwortabfrage</title>
<body>
  <div>
    
  <?php 
    
if($eingelogt)
    {
      echo 
"
      <p>Seiteninhalt</p>"
;
    }
    else
    {
      echo 
'<p>Seiteninhalt</p>';
    }
  
?>
    
  </div>
</body>
</html> 

edit/zugriff.inc.php:
PHP Code:
<?php
$user 
"hallo";
$pass "1234";
?>

.htaccess:
Code:
order deny,allow
deny from all

Was sagt ihr dazu?
Geht das so?
Naja htaccess ist leichter.^^
Reply


Messages In This Thread
Passwortabfrage in HTML - by emoser - 13.11.2009, 16:40
RE: Passwortabfrage in HTML - by Milu2K - 13.11.2009, 17:09
RE: Passwortabfrage in HTML - by agent47 - 13.11.2009, 17:22
RE: Passwortabfrage in HTML - by Sinovo - 13.11.2009, 17:23
RE: Passwortabfrage in HTML - by emoser - 13.11.2009, 17:27
RE: Passwortabfrage in HTML - by hauhau - 13.11.2009, 17:30
RE: Passwortabfrage in HTML - by emoser - 13.11.2009, 17:37
RE: Passwortabfrage in HTML - by hauhau - 13.11.2009, 17:38
RE: Passwortabfrage in HTML - by emoser - 13.11.2009, 17:44
RE: Passwortabfrage in HTML - by hauhau - 13.11.2009, 17:45
RE: Passwortabfrage in HTML - by benji889 - 13.11.2009, 19:03
RE: Passwortabfrage in HTML - by hauhau - 13.11.2009, 19:05
RE: Passwortabfrage in HTML - by benji889 - 13.11.2009, 19:06
RE: Passwortabfrage in HTML - by Jonsn - 13.11.2009, 19:16
RE: Passwortabfrage in HTML - by Yannici - 13.11.2009, 19:16
RE: Passwortabfrage in HTML - by hauhau - 13.11.2009, 19:37
RE: Passwortabfrage in HTML - by benji889 - 13.11.2009, 19:39
RE: Passwortabfrage in HTML - by hauhau - 13.11.2009, 19:42
RE: Passwortabfrage in HTML - by emoser - 23.11.2009, 17:46
RE: Passwortabfrage in HTML - by 3lite-Basher - 23.11.2009, 18:49



Users browsing this thread: 1 Guest(s)