SHARE
TWEET

Untitled

a guest May 27th, 2018 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. include('includes/mysql_connect.php');
  4.  
  5. session_start();
  6. if($_SESSION['loggedin'] == 'true'){
  7.     header("Location:portal.php");
  8. }
  9. if(isset($_POST['submit'])){
  10.     $username = str_replace(" ", "",$_POST['memberUsername']);
  11.     $password = trim($_POST['memberPassword']);
  12.     if($username != "" && $password != ""){
  13.         $salt='this_is_just_a_test_of_the_emergency_broadcast_system1235123';
  14.         $salted_md5 = md5($salt.md5($password));
  15.         $salted_md5 = md5(md5($password.$salt));
  16.         $query = mysql_query("SELECT * FROM members WHERE username = '$username' AND password = '$salted_md5' LIMIT 1") or die( mysql_error() );
  17.         $row = mysql_fetch_array($query);
  18.         if(mysql_num_rows($query) > 0){
  19.             session_start();
  20.             $_SESSION['loggedin'] = 'true';
  21.             $_SESSION['username'] = $row['username'];
  22.             $_SESSION['firstname'] = $row['name'];
  23.             $_SESSION['id'] = $row['members_id'];
  24.                 echo "<script>document.location='portal.php';</script>";
  25.         } else {
  26.             $myErrorMsg2 = "<div class=\"report\">Username/Password combination doesn't exist, try again.</div>";
  27.         }
  28.     }else{
  29.         echo "fill both";
  30.     }
  31. }
  32.  
  33. include('includes/header.php');
  34.  
  35. ?>
  36. <h2>Log In</h2><br/>
  37. <?
  38. if(isset($_POST['submit'])&&($myErrorMsg2 != "")) {
  39.     echo $myErrorMsg2;
  40. }
  41. ?>
  42. <form action="<?echo $_SERVER['PHP_SELF']; ?>" method="post" />
  43. <p><label for="memberUsername">Username: </label><input type="text" name='memberUsername' id='memberUsername' value='<?echo $username;?>'/></p>
  44. <p><label for="memberPassword">Password: </label><input type="password" name='memberPassword' id='memberPassword' value=''/></p>
  45. <input type='submit' name='submit' id='submit' value='Login' />
  46. </form>
  47. <p><a href="signup.php">Sign up</a> | <a href="recover.php">Forgot Password?</a></p>
  48. <?
  49. include('includes/footer.php');
  50. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top