Advertisement
gentrexha

login.php

Apr 22nd, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.00 KB | None | 0 0
  1. <html>
  2.  <?php
  3.  
  4.  if(isset($_COOKIE['username'])and $_COOKIE['roli']=='1')
  5. {
  6.      header("Location:indexSH.php") ;
  7. }
  8.  else if(isset($_COOKIE['username'])and $_COOKIE['roli']=='2')
  9.  {
  10.       header("Location:indexA.php") ;
  11.  }
  12.  
  13.  
  14.  
  15. ?>
  16.     <head>
  17.     <title>Identifikimi</title>
  18.         <link rel="stylesheet" type="text/css" href="stili.css">
  19.         <link rel="shortcut icon" href="fotot/logo.ico" />
  20.         <style>
  21.  
  22.     input[type=button], input[type=submit], input[type=reset] {
  23.    
  24.     background-color: #4C8CAF;
  25.     color: white;
  26.     padding: 5px 8px;
  27.     text-align: center;
  28.     text-decoration: none;
  29.     display: inline-block;
  30.     font-size: 16px;
  31.     margin: 7px 2px;
  32.     cursor: pointer;
  33.     border-radius: 5px;
  34.     box-shadow: 2px 2px 2px  #5252c2;
  35.  
  36. }</style>
  37.    
  38.     </head>
  39. <body>
  40.        
  41.         <header id="header"></header>
  42. <div id="menuja">
  43.         <table>
  44.                 <tr>   
  45.                     <td>
  46.                         <a href="index.php">Ballina</a>
  47.                     </td>
  48.                     <td>
  49.                         <li><a href="qytetet.php">Qytetet</a>
  50.                         <ul>
  51.                         <li><a href="qytetet.php#prishtina">Prishtina</a></li>
  52.                         <li><a href="qytetet.php#ferizaji">Ferizaji</a></li>
  53.                         <li><a href="qytetet.php#gjilani">Gjilani</a></li>
  54.                         <li><a href="qytetet.php#prizreni">Prizreni</a></li>
  55.                         </ul>
  56.                         </li>
  57.                     </td>  
  58.                     <td><a href="ngjarjet.php">Ngjarjet</a></td>   
  59.                     <td><a href="transporti.php">Transporti</a></td>
  60.               <td><a href="identifikimi.php">Login</a></td>
  61.              
  62.                 </tr>
  63.         </table>
  64. </div>
  65. <div id="permbajtja">
  66.  
  67.  
  68.   <div style="padding: 20px 40px;">
  69.   <div class="login">
  70.  
  71. <?php
  72. session_start();
  73.  
  74.  
  75.  
  76. if(isset($_POST['logohu']))
  77. {
  78.   require 'konektimi.php';
  79.   $username=$_POST['username'];
  80.   $password=$_POST['password'];
  81.   $Roli = $_POST['roli'];
  82.  
  83.   if($Roli == "shfrytezues")
  84.   {
  85.   $query=mysqli_query($con,'select * from shfrytezuesit where username="'.$username.'" and password="'.$password.'"');
  86.    $res=mysqli_fetch_row($query);
  87.   if($res)
  88.   {
  89.         if(isset($_POST['remember']))
  90.         {
  91.           setcookie('username',$username,time()+40);
  92.           setcookie('password',$password,time()+40);
  93.           setcookie('roli',"1",0);
  94.         }
  95.  
  96.           $_SESSION['username']=$username;
  97.           setcookie('username',"$username",0);
  98.           setcookie('password',"$password",0);
  99.           setcookie('roli',"1",0);
  100.          header('Location:indexSH.php');
  101.  
  102.   }
  103.   else { echo '<h4 class="heading">Keni shtypur gabim userin ose passwordin</h4><br>';}
  104.  
  105.  if($username==''&&$password=='')
  106.   {
  107.     echo '<h3 class="heading">Shkruani te gjitha fushat </h3><br>';
  108.   }
  109. }
  110.  
  111.  
  112. else if ($Roli =="admin")
  113. {
  114.   $query=mysqli_query($con,'select * from adminat where username="'.$username.'" and password="'.$password.'"');
  115.    $res=mysqli_fetch_row($query);
  116.   if($res)
  117.   {
  118.         if(isset($_POST['remember']))
  119.         {
  120.           setcookie('username',$username,time()+40);
  121.           setcookie('password',$password,time()+40);
  122.           setcookie('roli',"2",0);
  123.  
  124.  
  125.         }
  126.  
  127.           $_SESSION['username']=$username;
  128.           setcookie('username',"$username",0);
  129.           setcookie('password',"$password",0);
  130.           setcookie('roli',"2",0);
  131.          header('Location:indexA.php');
  132.  
  133.   }
  134.   else { echo '<h4 class="heading">Keni shtypur gabim userin ose passwordin</h4><br>';}
  135.  
  136.  if($username==''&&$password=='')
  137.   {
  138.     echo '<h3 class="heading">Shkruani te gjitha fushat </h3><br>';
  139.   }
  140. }
  141. }
  142.  
  143.  
  144.  
  145.  
  146. ?>
  147.     <form name="formlogin"  method="POST" action="identifikimi.php" style="width: 350px; margin: 20px auto;">
  148.       <fieldset style="text-align: center; padding: 20px 15px;">
  149.         <legend>Ju lutem identifikohuni p&#235;r t&#235; vazhduar</legend>
  150.         Ky&#231;uni si : <input type="radio" name="roli" value="shfrytezues" checked> Shfrytezues<br>
  151.          <input type="radio" name="roli" value="admin" style="margin-left:45px;margin-bottom: 20px;"> Admin<br>
  152.         P&#235;rdoruesi: <input type="text" name="username"  style="margin-bottom: 10px;margin-left:15px" required="true" placeholder="Username" autofocus><br>
  153.         Fjal&#235;kalimi: <input type="password" name="password"  style="margin-bottom: 10px;margin-left:15px" required="true" placeholder="Password" ><br>
  154.         <input  type="checkbox" name="remember" style='margin-top: 10px;margin-bottom: 10px;margin-left: -127px;'>Remember me <br>
  155.         <div style="text-align: right;">
  156.          
  157.           <a style="margin-right: 36px" href="register.php">Regjistrohuni K&#235;tu</a>
  158.            <input style="margin-right:35px"type="submit" name="logohu" value="Log In">
  159.         </div>
  160.        
  161.       </fieldset>      
  162.     </form>
  163.   </div>
  164. </div>
  165. </div>
  166. <div id="footeri">
  167.   <table>
  168.     <tr>
  169.       <td>
  170.         <p style="color:white;"> Copyright : <abbr title="WIKIPEDIA">Wiki</abbr></p>
  171.       </td>
  172.       <td>
  173.         <address align="right"><a href="mailto: kontakti@kosovatourguide.com">kontakti@kosovatourguide.com</a></address>
  174.       </td>
  175.     </tr>
  176.   </table>
  177. </div>
  178. </body>
  179. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement