Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7041195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:00:35+00:00 2026-05-28T02:00:35+00:00

I have a php site where a user has the ability to login. Once

  • 0

I have a php site where a user has the ability to login. Once they submit the POST data with their credentials they are taken to a page that initiates a session and checks the database. This process takes a long time before the user is ultimately redirected to the backend of the site. Durring this time the user stairs at a blank white page. I would like to show some kind of loading page, but when anything printable is on the page I get a header error due to the redirect.

How can I create a loading page? I understand that ajax is an option but is it my only option?

Update:
The PHP application is mainly taking a long time because each login is dependent on a foreign API that needs to be authorized as well as charging data that needs to be queried. I am not trying to mask something I can easily fix, I am trying to create a better user interface.

The login process takes ~10 seconds.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:00:35+00:00Added an answer on May 28, 2026 at 2:00 am

    Well, the easy way to handle this is as follows:

    Once a user pressed loging, using javascript, hide the login button, inject some ajaxloader gif, than send an AJAX request with the login credentials, salt it properly, log the user in, post the response as JSON, and intercept that response, and in case of success – do redirect, incase of failure – print appropriate message.

    some code:

    login-handler.php

    $user = new user();
    if ($user -> login($_POST['uid'], $_POST['password'], $_POST['whatever']){
      $response['type'] = 'success';
    }
    else{
      $response['type'] = 'failure';
    } 
    echo json_encode($response);
    

    js-login.js

    $("#login").click(function(){
      // verify that user put user name, password and whatever, hide button and show ajax loader
    
      $.get("login-handler.php", {user: user, password: password}, function(data){
        if (data.type == "success"){
          window.location = "http://example.com/new/location/whatever";
        }
        else{
          //print message
        }
      }, "JSON"); 
    });
    

    EDIT: but I’d like to join the other folks and consider using a faster/different API, as 10 secs loading time is utterly ridiculous, unless it is for yourself, in which case – knock yourself out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic php (Yii framework based) site. User has to login to
How would I allow a simple PHP site, which already has a user db,
I have a php site which has multiple php scripts. I need to provide
I have a website where users can enter their Twitter Login information. This site
I have a PHP email form and the user enters their email and it
If I have a website where users login and logout, and each user has
I have a PHP web site that has two directories: An application directory and
I have a PHP site that uses a fairly common authentication scheme. The entire
I have a PHP-driven site that includes an XML stock feed, which is remotely
In my live site I have php include() and require() that have full path

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.