Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <?php
  2. if($_SESSION['id']){
  3. echo "You are already logged in!";
  4. }else{
  5. if(!$_POST['login']){
  6. echo "<fieldset><legend><b>Login to OriginalMS</b></legend>";
  7. echo "<form method=\"POST\"><center><table border=\"0\" width=\"300\">";
  8. echo "<tr><td align=\"right\" width=\"50%\"><b>Username:</b></td><td><input type=\"text\" name=\"username\" maxlength=\"12\"></td></tr>";
  9. echo "<tr><td align=\"right\"><b>Password:</b></td><td><input type=\"password\" name=\"password\" maxlength=\"12\"></td></tr>";
  10. echo "<tr><td></td><td><input type=\"submit\" name=\"login\" value=\"Login\"></td></tr>";
  11. echo "</table></center></form>";
  12. echo "</fieldset>";
  13. }else{
  14. $u = mysql_real_escape_string($_POST['username']);
  15. $p = mysql_real_escape_string($_POST['password']);
  16. $s = mysql_query("SELECT * FROM `accounts` WHERE `name`='".$u."'") or die(mysql_error());
  17. $i = mysql_fetch_array($s);
  18.  
  19. if($i['password'] == hash('sha512',$p.$i['salt']) || sha1($p) == $i['password']){
  20. $user = mysql_query("SELECT * FROM `accounts` WHERE `name`='".$i['name']."' AND `password`='".$i['password']."'") or die(mysql_error());
  21. $auser = mysql_fetch_array($user);
  22. $_SESSION['id'] = $auser['id'];
  23. $_SESSION['name'] = $auser['name'];
  24. $_SESSION['mute'] = $auser['mute'];
  25. if($auser['webadmin'] == "1"){
  26. $_SESSION['admin'] = $auser['webadmin'];
  27. }
  28. if($auser['gm'] == "1"){
  29. $_SESSION['gm'] = $auser['gm'];
  30. }
  31. $name = mysql_query("SELECT * FROM `web_profile` WHERE `accountid`='".$auser['id']."'") or die(mysql_error());
  32. $pname = mysql_fetch_array($name);
  33. if($pname['name'] == NULL){
  34. $_SESSION['pname'] = NULL;
  35. }else{
  36. $_SESSION['pname'] = $pname['name'];
  37. }
  38. echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=community.php\">";
  39. }else{
  40. echo "The informations you supplied do not match/exist!";
  41. }
  42. }
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement