Guest User

Untitled

a guest
Feb 2nd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. <?php
  2. if($user->data['is_registered'])
  3. {
  4. //user is logged in
  5. echo "<br>";
  6. echo 'Welcome back ';
  7. print $user->data['username'];
  8. echo "<br>";
  9. echo 'You have ' . $user->data['user_unread_privmsg'] . ' unread <a href="./forum/ucp.php?i=pm&folder=inbox">message(s)</a>';
  10. echo '<h4><a title="See You Later" href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '">Log out</a></h4>';
  11. }
  12. else{
  13. //user is not logged in
  14. echo '
  15. <form method="post" action="forum/ucp.php?mode=login" id="loginform">
  16. <label for="username">
  17. Username:
  18. </label>
  19. <input type="text" name="username" id="username" size="16" />
  20. <label for="password">
  21. Password:
  22. </label>
  23. <input type="password" name="password" id="password" size="16" /><br><br>
  24. <label for="autologin">
  25. Remember?
  26. </label>&emsp;
  27. <input type="checkbox" name="autologin" id="autologin" />&emsp;
  28. <input type="hidden" name="redirect" value="../" />
  29. <input type="submit" value="Log In" name="login" id="login" /><br>
  30. <a title="Register" href="forum/ucp.php?mode=register">
  31. <br>
  32. <font color="white">Register an account</font>
  33. </a>
  34. </form>
  35. ';
  36. }
  37. ?>
  38.  
  39. $(document).ready(function() {
  40. // handle the login form through ajax for phpbb
  41. $(document).on('submit', '#login', function(event) {
  42. event.preventDefault();
  43.  
  44. var url= $(this).attr('action');
  45. alert(url);
  46. $.ajax({
  47. url: url,
  48. type: 'POST',
  49. dataType: 'HTML',
  50. data: new FormData(this),
  51. processData: false,
  52. contentType: false,
  53. success: function (data, status) {
  54. alert(data);
  55. },
  56. error: function (xhr, desc, err) {
  57. console.log('error');
  58. }
  59. });
  60. });
  61. });
Add Comment
Please, Sign In to add comment