SHARE
TWEET

Untitled

a guest Apr 25th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. session_start();
  4.  
  5. $server = 'localhost';
  6. $username = 'root';
  7. $password = '';
  8. $database = 'filmdatabase';
  9.  
  10. $link = new mysqli($server, $username, $password, $database);
  11. $link->set_charset("utf8");
  12.  
  13. ?>
  14. <!DOCTYPE html>
  15.  
  16. <html>
  17.     <head>
  18.         <title>MovieXplain</title>
  19.         <meta charset="UTF-8">
  20.         <link rel="stylesheet" href="stil.css">
  21.     </head>
  22.  
  23.     <body>
  24.         <ul>
  25.             <li><a href="login.php">Logg inn</a></li>
  26.             <li><a href="register.php">Registrer deg</a></li>
  27.             <?php
  28.             if (isset($_SESSION['brukernavn']) && !empty($_SESSION['brukernavn'])) {
  29.             ?>
  30.             <li><a href="submit.php">Registrer Film</a></li>
  31.             <?php
  32.             }
  33.             ?>
  34.         </ul>
  35.  
  36.         <?php
  37.  
  38.         if (isset($_SESSION['brukernavn']) && !empty($_SESSION['brukernavn'])) {
  39.  
  40.         ?>
  41.         <form method="post">
  42.             <label>Tittel</label> <input type="text" name="tittel">
  43.             <label>Sjanger</label> <input type="text" name="sjanger">
  44.             <label>Regissør</label> <input type="text" name="regissør">
  45.             <label>link</label> <input type="text" name="link">
  46.             <label>plakat</label> <input type="text" name="plakat">
  47.             <label>Oscar</label> <input type="text" name="oscar">
  48.             <input type="submit" name="create" value="Create">
  49.         </form>
  50.         <?php
  51.  
  52.         if (isset($_POST['create'])){
  53.             $tittel = $_POST['tittel'];
  54.             $sjanger = $_POST['sjanger'];
  55.             $regissør = $_POST['regissør'];
  56.             $thelink = $_POST['link'];
  57.             $plakat = $_POST['plakat'];
  58.             $oscar = $_POST['oscar'];
  59.  
  60.  
  61.             $sql = "INSERT INTO `filmer` (tittel, Sjanger, Regissør, link, plakat, oscar, `sum av stemmer`, `antall stemmer`) VALUES ('$tittel', '$sjanger', '$regissør', '$thelink', '$plakat', '$oscar', 0, 0)";
  62.            
  63.             $link->query($sql);
  64.         }
  65.  
  66.         } else {
  67.  
  68.         ?>
  69.  
  70.         <h1>You do not have permission to see this page</h1>
  71.         <?php
  72.         }
  73.         ?>
  74.     </body>
  75. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top