Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <?php
  2. include("src/databaseFunctions.php");
  3. include("src/loginFunctions.php");
  4.  
  5. if (checkSession()) {
  6. header("Location: adminArtist.php");
  7. exit();
  8. }
  9.  
  10. if (isset($_POST["login"])) {
  11. try {
  12. $db = myDBConnect();
  13.  
  14. $username = strip_tags($_POST["txtUserName"]);
  15. $password = strip_tags($_POST["txtPassWord"]);
  16.  
  17. if (validateUser($db, $username, $password) === 1) {
  18. startSession();
  19. header("Location: adminArtist.php");
  20. exit();
  21. } else {
  22.  
  23. $error = ('Felaktigt användarnamn och/eller lösenord!');
  24. throw new Exception($error);
  25. }
  26. } catch(Exception $e) {
  27. $error = $e->getMessage();
  28. }
  29. }
  30. ?>
  31.  
  32. <!DOCTYPE html>
  33. <html>
  34. <head>
  35. <meta charset="utf-8"/>
  36. <title> Musik </title>
  37. <link href="style/stilmall.css" rel="stylesheet" type="text/css"/>
  38. </head>
  39.  
  40. <body>
  41. <?php
  42. if (isset($error)) {
  43. echo($error);
  44. }
  45. ?>
  46. <div id="wrapper">
  47.  
  48. <header id="textheader">
  49. <h1> MusicSite</h1>
  50. </header>
  51.  
  52. <div id="maincontent">
  53. <h2> Musiksida</h2>
  54.  
  55. <!-- Knapparna vid sidan-->
  56. <nav id="nav">
  57. <ul style="list-style-type: none">
  58. <li>
  59.  
  60. <form action="searchArtistSong.php" ><button id="button">Search</button></form>
  61. <form action="Index.php"> <button id="button2">Main Site</button></form>
  62.  
  63. </li>
  64. </ul>
  65. </nav>
  66. <section id="content">
  67.  
  68. <fieldset>
  69. <legend> Inloggningsuppgifter</legend>
  70. <?php echo('<span style="color:red"> '.$error.'</span>'); ?>
  71. <br/>
  72. <form action="login.php" method="POST">
  73. <label >Användarnamn:</label> <br/>
  74. <input type="text" name="txtUserName" id="txtUserName" required="required">
  75. <br/>
  76. <label >Lösenord:</label><br/>
  77. <input type="password" name="txtPassWord" id="txtPassWord" required="required">
  78. <br/>
  79. <input type="submit" value="Login" id="login" name="login">
  80. <input type="reset" value="Reset" id="reset" name="reset"> <br/>
  81. <br/>
  82.  
  83. </form>
  84.  
  85.  
  86. </fieldset>
  87. </section>
  88.  
  89. </div>
  90.  
  91. <footer>Skapad av Kevin</footer>
  92. </div>
  93.  
  94. </body>
  95.  
  96. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement