Guest User

Untitled

a guest
Jan 23rd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.04 KB | None | 0 0
  1. <?php
  2.  
  3.   if($_SESSION["signed"] == 1)
  4.   {
  5.     header("Location: /".$_SESSION["city"]."/");
  6.   }
  7.  
  8.   if(isset($_POST['login']))
  9.     {
  10.       $username = $_POST['user'];
  11.       $city = $_POST['city'];
  12.       $password = md5($_POST['pass']);
  13.    
  14.       $query = "SELECT * FROM ".$this_city->mysql_tbl." WHERE Name = '$username' LIMIT 1";
  15.      
  16.       $res = $this_city->mysql->query($query);
  17.       $row = mysql_fetch_object($res);
  18.      
  19.       if($username != "" && $password != "" && mysql_num_rows($res) == 1 && $row->Pass == $password && $row->Name == $username)
  20.           {
  21.           $_SESSION["user"] = $username;
  22.           $_SESSION["signed"] = 1;
  23.           $_SESSION["city"] = $city ;
  24.          
  25.           ?>
  26.           <div id="logfeld">
  27.           <!--Der Login war erfolgreich.<br><a href="site.php">>> City <<</a>-->
  28.           </div>
  29. <?php
  30.           }
  31.         else
  32.           {
  33.           ?>
  34.           <div id="logfeld">
  35.             Login not successful.
  36.           </div>
  37. <?php
  38.           }
  39.      
  40.     }
  41.   else
  42.     {
  43.     ?>
  44.       <div id="logfeld">
  45.         <p>Login</p>
  46.           <form action="" method="post">
  47.             <table>
  48.               <tr>
  49.                 <td>Accountname: </td>
  50.                 <td><input type="text" maxlength="30" name="user" id="user"></td>
  51.               </tr>
  52.               <tr>
  53.                 <td>Password: </td>
  54.                 <td><input type="password" maxlength="30" name="pass" id="pass"></td>
  55.               </tr>
  56.               <tr>
  57.                 <select name="city" size="3">
  58. <?php
  59.                   foreach($cities as $act_city) {
  60.                  
  61.                   ?>
  62.                   <option value="<?=$act_city->short?>"><?=$act_city->name?></option>
  63. <?php
  64.                  
  65.                   }
  66. ?>
  67.                 </select>
  68.               <tr>
  69.                 <td></td>
  70.                 <td style="text-align:center;"><input type="submit" value="Login" name="login" id="btn"></td>
  71.               </tr>
  72.              </table>
  73.           </form>
  74.       </div>
  75. <?php
  76.     }
  77.  
  78. ?>
Add Comment
Please, Sign In to add comment