View Single Post
Old 08-16-2004, 05:01 AM   #9 (permalink)
Fallon
Junkie
 
Location: RI
Alright, this is a bit simplified and such but here goes
Hopefully you have PHP running on your server and such.
PHP Code:
<? 
  op_start();
  print '<head>
  <title>My spectacular page</title>
</head>
<body>
<h1>Login Form</h1>
  if ( isset ($_POST['submit'])) {
    //Handles the form
    if ( !empty ($_POST['username'])) && ($_POST['password'])) ) {
      if ( ($_POST['username'] == 'testing') && ($_POST['password'] == 'testpass') ) {
        //Everything is good
        header('Location: welcome.php');
        exit();
      } else { //Password was wrong
       print '<p>The submitted username and password do not match those on file<br>Go back and try again.</p>';
      }
    } else {  //Forgot something
      print '<p>Please make sure you enter both a username and a password!<br> Go back and try again.</p>';
    }
  } else { //If form wasn't submitted
    //Displaying the form
    print '<form action="login.php" method="post"><p>
    Username:<input type="text" name="username" size="20"><br>
    Password: <input type="password" name="password" size="20"><br>
    <input type="submit" name="submit" value="Log In"></p>
    </form>';
  }
  print '</body></html>';
  ob_end_flust();
?>
Hopefully this all works, might be a few typos somewhere, I'll look when I get out of work.
Fallon is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62