Advertisement
Guest User

kek

a guest
Feb 27th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.71 KB | None | 0 0
  1. <?php
  2.     $dbHost="localhost";
  3.     $dbUsr="lettore";
  4.     $dbPass="";
  5.     $dbName="negozio";
  6.  
  7.     $conn=new mysqli($dbHost,$dbUsr,$dbPass,$dbName);
  8.     // la connessione è attiva?
  9.     if($conn->connect_error)
  10.         {
  11.           die("connessione fallita ".$connect_error);
  12.         }
  13.     else
  14.     {
  15.         $query = "select tipoAccount from account where username ='" .$_POST['username']."' and password ='".$_POST['password']."'";
  16.         echo $query;
  17.        
  18.         $risultato=$conn->query($query);
  19.        
  20.         $riga = $risultato->fetch_assoc();
  21.         $tipo = $riga['tipoAccount'];
  22.        
  23.         if ($tipo == "A")
  24.         {
  25.             header( 'Location: http://localhost:8080/negozio/registrazione.php');
  26.         }
  27.          if ($tipo == "E")
  28.          {
  29.             header( 'Location: http://localhost:8080/negozio/esperto.php');
  30.          }
  31.                
  32.     }
  33.        
  34. ?>
  35.  
  36.  
  37. ----------------------------------
  38.  
  39. <!DOCTYPE html>
  40. <html>
  41. <body>
  42.  
  43. <h1>Benvenuto ADMIN!</h1>
  44.  
  45.         <!-- AGGIUNGERE UTENTI --> 
  46.        
  47.         <form name="Inserisci" action="inseriscibyAdmin.php" method="post">                
  48.             Username: <input type="text" name = "username" value=""/> </br>
  49.             Password: <input type="password" name= "password" value=""/></br>
  50.             Tipo Utente:
  51.             <select name = "tipo">
  52.                 <option value="A">Admin</option>
  53.                 <option value="E">Esperto</option>
  54.             </select>      
  55.             </br> <input type="submit" value="Inserisci"/>
  56.         </form>
  57.        
  58.        
  59.        
  60.         <!-- FINE AGGIUNTA UTENTI -->
  61.        
  62.        
  63.  
  64. </body>
  65. </html>
  66. --------------------------------------------------
  67.  
  68.     <!-- FORM LOGIN -->
  69.         <form name="login" action="login.php" method="post">
  70.             username: <input type="text" name = "username" value=""/> <br />
  71.             password: <input type="text" name ="password" /> <br />
  72.        
  73.        
  74.             </br> <input type="submit" value="login"/>                 
  75.                    
  76.         </form>
  77.     <!-- FINE FORM LOGIN -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement