Are you a regular stikked user? Signup so you can keep track of your pastes!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" >
  4.  
  5. <head>
  6.         <title>zSignin Form (v0.9BETA)</title>
  7.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8.         <link href="base.css" rel="stylesheet" type="text/css" />
  9. </head>
  10. <body>
  11. <?php
  12.  
  13. $error = array();
  14.  
  15. function displaylogin(){
  16.         print '<form class="signin" method="POST" action' . $_SERVER['PHP_SELF'] . '>';
  17.         print '<h3>Sign in here</h3>';
  18.         print 'Username <input type="text" name="luser" size="8" value="' . $_REQUEST['luser'] . '" /><br />';
  19.         print 'Password <input type="password" name="lpass" size="8:" /><br />';
  20.         print '<input type="submit" value="Go!" />';
  21.         print '</form>';
  22. }
  23.  
  24. $filename = md5($_REQUEST['luser']);
  25.  
  26. if (!file_exists($filename)) { //checks if the username exists
  27.         $error[] = '<span class="error">We can`t find that user, are you sure you have an account?</span>';
  28. } else {
  29.         $fp = fopen($filename, "r"); //takes data from user file and stores in an array
  30.         while (!feof($fp)) {
  31.                 $userdetails[] = fgets($fp, 1024);
  32.         }      
  33.         /* order of details in array
  34.         username
  35.         Fname Sname
  36.         password
  37.         email
  38.         */
  39.         echo $_REQUEST['lpass'] . '<br />' . $userdetails[2] . '<br />'; //testing purposes only: display submitted password and the password on file
  40.         if (!($_REQUEST['lpass'] == $userdetails[2])) //compares the passwords. If not the same, should populate the error array
  41.                 $error[] = '<span class="error">Your password seems to be wrong. Have another go.</span>';
  42. }
  43.  
  44. if (!$_REQUEST['luser'] || !$_REQUEST['lpass']) { //checks both fields have been filled in
  45.         echo '<span class="error">You need to fill in both fields, otherwise we can`t tell who you are!</span>';
  46.         displaylogin();
  47. } else if (!$error[0] == "" ){  //if errors exist, print them and redisplay the form
  48.         foreach ($error as $errorout) {
  49.                 print $errorout . "<br />";
  50.         }
  51.         displaylogin();
  52. } else { //if no errors, print hello user
  53.         print "Hello, " . $userdetails[0];
  54. }
  55.  
  56. ?>
  57.  
  58. </body>
  59. </html>

Reply to "sign in script"

Here you can reply to the paste above

Create a snipurl

Make Private

Feeling clever? Set some advanced options.