Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <html>
  2. <link rel="stylesheet" href="index.css">
  3. <?php
  4. include("config.php");
  5. $q = $db->prepare("select * from Auto");
  6. $q->execute();
  7. $qq = $q->fetchAll(PDO::FETCH_ASSOC);
  8. foreach ($qq as $auto){
  9. ?>
  10.  
  11.  
  12. <?php
  13. }
  14. ?>
  15. </html>
  16. <h1>ONAT CARS</H1>
  17. <?php
  18. session_start();
  19. $v = $db->prepare("select * from Users where Username=? and Password=?");
  20. if(isset($_POST['Login']))
  21. {
  22. $naam = $_POST['naam'];
  23. $pass = $_POST['pass'];
  24.  
  25. $v->execute(array($naam,$pass));
  26. $x = $v->fetch(PDO::FETCH_ASSOC);
  27. $d = $v->rowCount();
  28. if($d == 1)
  29. {
  30. $_SESSION['Users'] = $naam;
  31. }
  32. else
  33. {
  34. echo "Je gegevens kloppen niet!";
  35. }
  36. }
  37. if(isset($_POST['Register']))
  38. {
  39. header('Location: registreren.php');
  40. }
  41.  
  42. if($_SESSION)
  43. {
  44. echo "Welkom " .$_SESSION["Users"].", waar wil je naartoe? <a href='uitloggen.php'>Uitloggen</a> <a href='toevoegen.php'>Voeg een auto toe</a>
  45. <a href='autoinfo.php'>Auto's bekijken</a>
  46. <a href='wijzigen.php?id=".$_SESSION["id"]."'>Profiel wijzigen</a>";
  47. }
  48. else
  49. {
  50. echo '<form method="post" action="">
  51. <table cellpading="5" cellspacing="5">
  52. <tr>
  53. <td>Gebruikersnaam:</td>
  54. <td><input type="text" name="naam"></td>
  55. </tr>
  56. <tr>
  57. <td>Wachtwoord:</td>
  58. <td><input type="password" name="pass"></td>
  59. </tr>
  60. <tr>
  61. <td></td>
  62. <td><input type="submit" name="Login" value="Login!"></td>
  63. <td><input type="submit" name="Register" value="Registreer!"></td>
  64. </tr>
  65. </table>
  66. </form>';
  67. }
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement