Guest User

Untitled

a guest
Dec 11th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.80 KB | None | 0 0
  1. <?php
  2.         require_once("functions.php");
  3.  
  4.         if($_POST['credentials']) {
  5.                 $username = $_POST['username'];
  6.                 $password = $_POST['password'];
  7.  
  8.                 if(!empty($password) && !empty($username)) {
  9.                         if(checkPassWd($password, $username) == FALSE) {
  10.                                 echo "<div class=\"login\"><p style=\"color: red\">Väärä salasana</p></div>";
  11.                         }
  12.                         else {
  13.                                 session_start();
  14.                                 $_SESSION['username'] = $username;
  15.                         }
  16.                 }
  17.                 else {
  18.                         echo "<div class=\"login\"><p style=\"color: red\">Anna käyttäjätunnuksesi ja salasanasi.</p></div>";
  19.                 }
  20.         }
  21.         if(isset($_SESSION['username'])){
  22. ?>
  23.  
  24.                 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  25.                 <html>
  26.                 <head>
  27.                         <title>Fongaus</title>
  28.                         <link rel="stylesheet" type="text/css" href="styles.css" />
  29.                 </head>
  30.                 <body>
  31.                         <a href="index.php?setPage=1">Etusivu</a>
  32.                         <a href="index.php?setPage=2">Linkki2</a>
  33. <?php
  34.  
  35.                         if($_GET['setPage']) {
  36.                                 LoadPage($setPage);
  37.                                 print_r($_SESSION);
  38.                         }
  39.                         else {
  40.                                 require_once("templates/etusivu.php");
  41.                         }
  42. ?>
  43.  
  44.                 </body>
  45.                 </html>
  46. <?php
  47.         }
  48.         else {
  49.                 require_once("templates/login.php");
  50.         }
  51. mysql_close($link);
  52. ?>
Add Comment
Please, Sign In to add comment