dynamic_login_php

    1| <?php
    2|     session_start();
    3| ?>
    4| <?php
    5| 
    6|     $user_input = true;
    7|     $user_message = "";
    8|     define(PASSWORD,"rng");
    9| 
  10|     //bring in reusable routines
  11|     require("dynamic_routines.php");
  12| 
  13|     $pw = $_POST['pw'];
  14|     $fileid = $_POST['rbnFile'];
  15| 
  16|     //password entered?
  17|     if(empty($pw))
  18|     {
  19|         $user_input = false;
  20|         $user_message .= "You must enter a password.<br/>";
  21|     }
  22| 
  23|     //file selected
  24|     if(empty($fileid))
  25|     {
  26|         $user_input = false;
  27|         $user_message .= "You must select a file.<br/>";
  28|     }
  29| 
  30|     //empty input?
  31|     if(!$user_input)
  32|     {
  33|         error_page("Input Errors", $user_message);
  34|         exit();
  35|     }
  36| 
  37|     //Validate password
  38|     if(strcasecmp($pw, PASSWORD) != 0)
  39|     {
  40|         $user_message = "Invalid password Click your back arrow and try again.";
  41|         error_page("Invalid Password", $user_message);
  42|         exit();
  43|     }
  44| 
  45|     //set session variables
  46|     $_SESSION['logged_in'] = true;
  47|     $_SESSION['fileid'] = $fileid;
  48| 
  49| ?>
  50| <html>
  51| <head>
  52| <title>Dynamic File Maintenance</title>
  53| </head>
  54| <body>
  55| <h1>Dynamic File Maintenance</h1>
  56| <h3>Please select one of the following:</h3>
  57| 
  58| <a href="dynamic_add_form.html">Add Records</a><br/><br/>
  59| 
  60| <a href="dynamic_delete_form.html">Delete Records</a><br/><br/>
  61| 
  62| <a href="dynamic.html">Home</a>
  63| 
  64| </body>
  65| </html>