logo image

Gorilla3D Primative Teachings

Search

  Client Login



Get Firefox

Php Screencast 06:
User Login


Code used in screencast

  1. <?php
  2. error_reporting(E_ALL | E_STRICT);
  3. ini_set('display_errors', True);
  4.  
  5. $username = htmlentities($_POST['username']);
  6. $password = htmlentities($_POST['password']);
  7.  
  8. if ($username == 'bob' and $password == '123')
  9. {
  10.         echo 'Login Successful<br/>';
  11.         echo  'Welcome, ' . $username;
  12. }
  13. else
  14. {
  15.         echo '<span style="color: red">Login Failed</span>';
  16.         echo  $username . ', does not exsit';
  17. }
  18. ?>
  19.  
  20. <html>
  21. <head>
  22.         <title>My login</title>
  23. </head>
  24. <body>
  25.         <div></div>
  26.        
  27.         <form action="" method="post">
  28.                 username: <input name="username" type="text" />
  29.                 password: <input name="password" type="password" />
  30.                 <input type="submit" />
  31.         </form>
  32. </body>
  33. </html>
  34.  

About Privacy Policy FAQ