Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. //AT THE TOP OF THE PAGE//
  2. <?
  3. session_start();
  4. include_once"config.php";
  5. if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
  6. header("Location: login.php");
  7. }else{
  8. if(isset($_POST['login'])){
  9. $username= strip_tags(mysql_escape_string( trim($_POST['username']) ) );
  10. $password= strip_tags(mysql_escape_string( trim($_POST['password']) ) );
  11. if($username == NULL OR $password == NULL){
  12. $final_report.="Please complete both fields";
  13. }else{
  14. $check_user_data = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
  15. if(mysql_num_rows($check_user_data) == 0){
  16. $final_report.="This username does not exist";
  17. }else{
  18. $get_user_data = mysql_fetch_array($check_user_data);
  19. if($get_user_data['password'] == $password){
  20. $start_idsess = $_SESSION['username'] = "".$get_user_data['username']."";
  21. $start_passsess = $_SESSION['password'] = "".$get_user_data['password']."";
  22. $final_report.="<meta http-equiv='Refresh' content='0; URL=members.php'/>";
  23. }}}}}
  24. ?>
  25.  
  26.  
  27. //THE HTML FORM//
  28. <form action="" method="post">
  29. <p>
  30. <input type="text" title="username" name="username" class="username" value="Username" onclick="if ( value == 'Username' ) { value = ''; }"/>
  31. <input name="password" type="password" class="password" title="password" value="Password" onclick="if ( value == 'Password' ) { value = ''; }"/>
  32. <input type="Submit" name="login" class="submit" value="login" tabindex="3" />
  33. </p>
  34. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement