<form id="form1" name="form1" method="post" action="index.php?p=login">
<p align="center" class="tdglobal"><span class="b01">Login</span></p>
<table width="200" border="0" align="center" class="liteoption">
<tr>
<td width="97" class="right"><div align="left">Username:</div></td>
<td width="93" class="right"><input name="user" type="text" class="liteoption" id="user" size="15" maxlength="15" /></td>
</tr>
<tr>
<td class="right"><div align="left">Password:</div></td>
<td class="right"><input name="pass" type="text" class="liteoption" id="pass" size="15" maxlength="15" /></td>
</tr>
</table>
<p align="center" class="tdglobal"><span class="right">
<input name="submit" type="submit" class="liteoption" id="submit" value="Log In" size="15" maxlength="15" />
</span></p>
</form>
<p align="center" class="tdglobal">
<?php
include ("cfg/config.php");
if (!isset($_SESSION["User"])){
if(isset($_POST['submit'])) {
$U=mysql_escape_string ($_POST['user']);
$P=mysql_escape_string (md5($_POST['pass']));
$conn = mysql_connect($dbh, $dbu, $dbp); //Verbindung zur Db
$db = mysql_select_db($db); // Dbname auswählen
$sql = sprintf("SELECT * FROM `accounts` WHERE name='%s' and password='%s'",($U),($P));
$query = mysql_query($sql, $conn);
$count = mysql_num_rows($query);
mysql_close($conn);
if($count == 1){
$_SESSION["User"]=$U; // Session Variable erstellen
$_SESSION["Pass"]=$P;
echo('Logged in.... Klick <a href=?op=user><strong>hier</strong></a><br><br>');
}
else {echo "<strong>Account ist gebannt.</strong>";}
}
else
echo ("echo <a href="index.php?p=logout">auslogen</a>")
?>