Advertisement
droidus

Untitled

Jun 4th, 2011
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.92 KB | None | 0 0
  1. <?
  2. if (!isset($_SESSION))
  3.     {
  4.         session_start();
  5.     }
  6. ?>
  7. <?php require_once('../Connections/uploader.php'); ?>
  8. <?
  9. function accountActivationCheck($activation)
  10.     {
  11.         if ($activation==0){
  12.             $acntactivation = false;
  13.         }
  14.         if ($activation==1) {
  15.             $acntactivation = true;
  16.         }
  17.         if ($acntactivation == false) {
  18.             $acntactivation_error = true;
  19.         }
  20.         return $acntactivation_error;
  21.     }
  22.    
  23. function loginFormErrorsCheck ($loginUsername, $loginPassword)
  24.     {
  25.         if (empty($loginUsername)) {$errors = 1;}
  26.         if (empty($loginPassword)) {$errors = 1;}
  27.         return $errors;
  28.     }
  29. ?>
  30. <? 
  31. if (isset($_POST['submit'])) {
  32.    
  33.     $loginUsername = $_POST['uname'];  
  34.     $loginPassword = $_POST['pword'];  
  35.    
  36.     $errors = loginFormErrorsCheck ($loginUsername, $loginPassword);
  37.        
  38.     mysql_select_db($database_uploader, $uploader);
  39.     $query = "SELECT * FROM members WHERE uname='".$loginUsername."' AND pword='".$loginPassword."'";  
  40.     $result = mysql_query($query) or die(mysql_error());
  41.     $row = mysql_fetch_array($result) or die(mysql_error());
  42.     $activation = $row['activated'];
  43.        
  44.     $accountStatus = accountActivationCheck($activation);
  45.    
  46.     if ($accountStatus == true)
  47.     {
  48.         echo "<span class='error'>Your account has not yet been activated.  It will take about two weeks to be fully activated. We  will e-mail you when it is.</span>";
  49.     }
  50.    
  51.     if ($errors==1)
  52.     {
  53.         echo "There were errors! Please make sure you filled in all of the fields.";
  54.     }
  55.     if (!isset($errors))
  56.     {
  57.         header ('Location: $uname/index.php"');
  58.     }
  59.    
  60.     mysql_close($con);
  61. }
  62. ?>
  63. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  64. <html xmlns="http://www.w3.org/1999/xhtml">
  65. <head>
  66. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  67. <title>Untitled Document</title>
  68. </head>
  69.  
  70. <body>
  71. <h1 align="center"><img src="../Images/user_logout.gif" width="40" height="40" /> Member's Area</h1>
  72. <p align="center">Please login if you are an existing member, or register on your right.</p>
  73. <table width="715px" border="3" align="center">
  74.   <tr>
  75.     <td width="300px" valign="middle"><form action="" method="POST" id="form2" name="form2" >
  76.     <table width="300" border="1" cellpadding="5" cellspacing="0">
  77.   <tr>
  78.     <td colspan="3" valign="top" style="padding:15px;">
  79.     <h3>Login</h3>
  80.     Please enter a username to continue being uploading your files:</td>
  81.   </tr>
  82.   <tr>
  83.     <td valign="top">Username: </td>
  84.     <td valign="top"><input type="text" name="uname" id="text" value="<? if (isset($errors)) {echo $_POST['uname'];} ?>">&nbsp;</td>
  85.   </tr>
  86. <tr>
  87.     <td valign="top">Password: </td>
  88.     <td valign="top"><input name='pword' type='password' value="<? if (isset($errors)) {echo $_POST['pword'];} ?>" /></span>
  89.   &nbsp;</td>
  90.   </tr>
  91.   <tr>
  92.     <td colspan="3" align="center"><input type="submit" name="submit" id="submit" value="Submit"></form></td>
  93.   </tr>
  94. </table>
  95. </body>
  96. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement