Login form



PHP. Conditions and $_GET, $_POST, PART 3
Safe case:
<?

include "funkcijos.php";
$vartotojas=$_GET["vartotojas"];
$slaptazodis=$_GET["slaptazodis"];

if ( ! $vartotojas or ! $slaptazodis){

?>
<form action="<?= $_SERVER['PHP_SELF']; ?>" method="get">
<input type="text" name="vartotojas" value=""><br>
<input type="password" name="slaptazodis" value=""><br>
patvirtinti<br>
<input type="submit" ><br>
atsaukti<br>
<input type="reset" >
</form>
<?

} elseif ($vartotojas=="jonas" and $slaptazodis=="1972"){

a();

} elseif ($vartotojas=="petras" and $slaptazodis=="1973"){

b();

}else{

echo "blogai <br>";?>
<a href= "<?= $_SERVER['PHP_SELF']; ?>">atgal</a><?

}
?>

funkcijos.php
<?

function a() {
?> <h1>A pasirinkimas</h1><?
}

function b() {
?> <h2>b pasirinkimas</h2><?
}

?>

 
[ BBC news ][ Yahoo news ][ Linux guru ][ Webmaster ACE ]