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 6988179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:02:30+00:00 2026-05-27T19:02:30+00:00

On my login system, I have it pop up in a fancyBox lightbox requested

  • 0

On my login system, I have it pop up in a fancyBox lightbox requested via AJAX. But there’s one problem. If the user goes to login.php itself in their browser, they see an unstyled page that doesn’t work because the JavaScript that helps it is on the page that has the login pop up. I want to redirect them to the homepage if they are on login.php.

I tried doing this:

<?php
if($_SERVER['REQUEST_URI'] == '/login.php') {
header("Location: /");
}
?>

As well as:

<?php
if($_SERVER['PHP_SELF'] == '/login.php') {
header("Location: /");
}
?>

Which both do not work because when you open up the fancyBox it messes up the page and makes it blank.

Is there a way to make it redirect if the user is at the login page itself that doesn’t affect the fancyBox?

  • 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-27T19:02:31+00:00Added an answer on May 27, 2026 at 7:02 pm

    Put this in your login.php script to detect non ajax requests and redirect in that case:

    //Redirect the user if page not requested via ajax
    if(!$_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') { header('Location: /'); }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have a jQuery ajax request for a login system. At first, it
I have detailed stats on user access to my system detailing login and logout
I have a web-based system built with user login data based on session variables.
On my website I have a user login system, when they login they are
I have 2 websites with a member login system. Members are registered at one
I have created a login system for my webpage, but when I enter in
I have a little problem with my simple login system. this is the code
I have been comissioned to make a website complete with a user login system
i have a user login system which works off of sessions such that when
I have created a registration/login system for my members area. Once the user has

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.