Advertisement
Guest User

bob

a guest
May 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <?php
  2. // mi connetto al MySql Server
  3. $conn = mysql_connect('localhost', 'root', '')
  4. or die('Errore: server mysql non raggiungibile!');
  5.  
  6. // seleziono il database degli amici
  7. mysql_select_db('my_carmineclericuzio', $conn)
  8. or die('Errore: database non raggiungibile!');
  9.  
  10. $USERNAME=$_GET['utente'];
  11. $PASSWORD=$_GET['password'];
  12. // imposto ed eseguo la query
  13. $q = "SELECT utente,password FROM userprova where utente='$USERNAME' AND password='$PASSWORD'";
  14. $result = mysql_query($q, $conn)
  15. or die('Errore: la query non è andta a buon fine!');
  16.  
  17. // conto il numero di occorrenze trovate nel db
  18. $num_righe = mysql_num_rows($result);
  19.  
  20. // se il database è vuoto lo stampo a video
  21. if ($num_righe == 0){
  22. echo "<center><h1>Non ci sono utenti!</h1></center>";
  23. }
  24. // se invece trovo delle occorrenze...
  25. else
  26. {
  27.  
  28. echo "<center><h1>Bentornato $USERNAME</h1></center>";
  29. }
  30.  
  31.  
  32. // chiudo la connessione
  33. mysql_close($conn);
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement