Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if($user->data['is_registered'])
- {
- //user is logged in
- echo "<br>";
- echo 'Welcome back ';
- print $user->data['username'];
- echo "<br>";
- echo 'You have ' . $user->data['user_unread_privmsg'] . ' unread <a href="./forum/ucp.php?i=pm&folder=inbox">message(s)</a>';
- 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>';
- }
- else{
- //user is not logged in
- echo '
- <form method="post" action="forum/ucp.php?mode=login" id="loginform">
- <label for="username">
- Username:
- </label>
- <input type="text" name="username" id="username" size="16" />
- <label for="password">
- Password:
- </label>
- <input type="password" name="password" id="password" size="16" /><br><br>
- <label for="autologin">
- Remember?
- </label> 
- <input type="checkbox" name="autologin" id="autologin" /> 
- <input type="hidden" name="redirect" value="../" />
- <input type="submit" value="Log In" name="login" id="login" /><br>
- <a title="Register" href="forum/ucp.php?mode=register">
- <br>
- <font color="white">Register an account</font>
- </a>
- </form>
- ';
- }
- ?>
- $(document).ready(function() {
- // handle the login form through ajax for phpbb
- $(document).on('submit', '#login', function(event) {
- event.preventDefault();
- var url= $(this).attr('action');
- alert(url);
- $.ajax({
- url: url,
- type: 'POST',
- dataType: 'HTML',
- data: new FormData(this),
- processData: false,
- contentType: false,
- success: function (data, status) {
- alert(data);
- },
- error: function (xhr, desc, err) {
- console.log('error');
- }
- });
- });
- });
Add Comment
Please, Sign In to add comment