 
- Code: Alles auswählen
- <?php
 session_start();
 error_reporting(E_ALL);
 require('mysql.php');
 function _REQUEST($Key, $DefaultValue = false)
 {
 if(isset($_REQUEST[$Key]))
 {
 return $_REQUEST[$Key];
 }
 return $DefaultValue;
 }
 function _GET($Key, $DefaultValue = false)
 {
 if(isset($_GET[$Key]))
 {
 return $_GET[$Key];
 }
 return $DefaultValue;
 }
 function _POST($Key, $DefaultValue = false)
 {
 if(isset($_POST[$Key]))
 {
 return $_POST[$Key];
 }
 return $DefaultValue;
 }
 function _SESSION($Key, $DefaultValue = false)
 {
 if(isset($_SESSION[$Key]))
 {
 return $_SESSION[$Key];
 }
 return $DefaultValue;
 }
 $sql = "SELECT *
 FROM `" . $usertable . "`
 WHERE LCASE(`name`) = LCASE('" . _SESSION('name1') . "') AND `pw` = '" . md5(_SESSION('pw1')) . "'";
 $result = mysql_query($sql);
 if(mysql_num_rows($result) == 1)
 {
 $row = mysql_fetch_array($result);
 $name1 = $row['name'];
 $_SESSION['name1'] = _POST('name1');
 $_SESSION['pw1'] = _POST('pw1');
 $userid = $row['id'];
 $rang = $row['rang'];
 $email = $row['email'];
 $icq = $row['icq'];
 }
 else
 {
 if(_POST('login'))
 {
 echo 'login incorrect - please try again <br><br>
 <a href=\'index.php\'>back</a>';
 }
 else
 {
 echo ?>
 
 <form method='post' action='schutz.php'>
 <table width='200'>
 <tr>
 <td width='50'>
 username:
 </td>
 <td width='150'>
 <input type='text' name='name1' value='<?php echo _POST('name1', ''); ?>' size='20'>
 </td>
 </tr>
 <tr>
 <td width='50'>
 password:
 </td>
 <td width='150'>
 <input type='password' name='pw1' value='<?php echo _POST("pw1", ""); ?>' size='20'>
 </td>
 </tr>
 <tr>
 <td colspan='2'>
 <input type='submit' name="login" value='Login'>
 </td>
 </tr>
 </table>
 </form>
 <?php
 
 ;}
 }
 if(isset($_GET['logout']) && $_GET['logout'] == 1)
 {
 session_unset();
 session_destroy();
 echo 'logged out';
 ?>
 <a href='index.php'>back to main</a>
 <?php
 }
 ?>


