Mam takie pytanie jak polaczyc taki skrypt w jeden :
<?
require_once('./config.php'); // załaczamy plik config.php
function usun($data){
}
}
if (isset($_POST['submit'])){
if (empty($_POST['login'])){ $message .= '<font class="blad">Nie podałeś loginu</font><br />';
$l = FALSE;
}else{
$l = usun($_POST['login']);
}
if (empty($_POST['haslo'])){ $message .= '<font class="blad">Nie podałeś hasła</font><br />';
$h = FALSE;
}else{
$h = usun($_POST['haslo']);
}
if ( $l && $h ){
$query = "SELECT username, access FROM user WHERE username='$l' AND haslo=password('$h')";
if($row){
$_SESSION['username'] = $row['username'];
$_SESSION['access'] = $row['access'];
$_GET['cmd'] = 'ok';
header ("Location: admin.php?cmd={$_GET['cmd']}"); // przekierowuje nas na jaka strone chcemy }else{
$message .= '<font class="blad">Błędne hasło lub login</font><br />';
}
}else{
$message .= '<font class="blad">Spróbuj jeszcze raz</font>';
}
}
?>
i
<form method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">
<table align="center" border="0"> <td align="right" class="uni_01">Login:
</td> <td><input type="text" name="login" size="30"></td> <td align="right" class="uni_01">has
ło:
</td> <td><input type="text" name="haslo" size="30"></td> <td align="right" class="uni_01"> </td> <p align="center"><input style="font-weight: bold;" type="submit" name="submit" value="loguj">
i
<? if(isset($message)){
echo $message;
}
?>
i
<?
if($_SESSION['access'] != 'root'){
@header ("Location: index.php"); }
?>
pozdrawiam
Ten post edytował micgok 22.10.2007, 21:53:09