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

  • Home
  • SEARCH
  • 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 6761301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:10:15+00:00 2026-05-26T14:10:15+00:00

I have two PHP scripts which both have an include_once(‘authentication.inc’); script near the top.

  • 0

I have two PHP scripts which both have an “include_once(‘authentication.inc’);” script near the top. Both scripts reference the same authentication file. That authentication file currently performs a header redirect (like “header(‘Location: index.php’);”) if the user is not signed in.

In one file (A.php) the immediate next line of code after the include of the authentication file is:

if(isset($_GET['delete']))
   mysql_query("DELETE FROM table WHERE index=".$_GET['delete']);

In the other file (B.php) there are several other includes which occur before the same “delete code” listed above.

So the authenticate.inc file looks like:

if(!valid_credentials($username,$password))
    header('Location: index.php');

And file A.php looks like:

include_once('authenticate.inc');

if(isset($_GET['delete']))
   mysql_query("DELETE FROM table WHERE index=".$_GET['delete']);

And file B.php looks like:

include_once('authenticate.inc');

include_once('other.php');
include_once('file2.php');
include_once('onemore.php');

if(isset($_GET['delete']))
   mysql_query("DELETE FROM table WHERE index=".$_GET['delete']);

Yet when I call A.php?delete=5, that record is deleted from the database while when I call B.php?delete=8 that record is not.

I have checked the 3 intermediary includes and do not see any die() statements, nor any other header redirects.

So while it’s clear that A.php is continuing to execute after the header is sent, why isn’t B.php doing the same thing? Is the header being sent before the next set of imports?

**

Also: I know to add the die() or exit command after the headers are sent. I’m working on someone else’s code and trying to explain behavior, not writing this myself.

**

  • 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-26T14:10:16+00:00Added an answer on May 26, 2026 at 2:10 pm

    No way to tell. If the starts are aligned properly, the header coud be sent to the client browser immediately and the bowser will start closing the current connection and request the new URL immediately. This’ll cause the current PHP script to start shutting down.

    On the other hand, if the caches are slow and the network glitchy, the client browser may not get the redirect header for seconds/minutes/hours, and the script could continue executing indefinitely.

    In general you should assume that the moment you’ve issued a header redirect that the script is basically “walking dead” and should not do any further work.

    The sole exception to this rule is that you CAN use ignore_user_abort(TRUE), which tells PHP to NOT shut down when the remote user disconnects. That’d allow you to continue on working even though the browser has shut down the connection and moved on to the new page.

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

Sidebar

Related Questions

I have two PHP scripts, both using the same session by calling session_name('MySessID') .
I have a script in PHP which retrieves two very similar files and performs
I have a PHP script which includes one or two other libraries it depends
I have two PHP functions to calculate the relation between two texts. They both
I have a php script that handles a form input. For design reasons both
I have a large amount of data to move using two PHP scripts: one
I have a PHP scraper script which I use to scrape a page on
I have two autocomplete scripts, one of them makes use of (A) php/mysql/html/jquery and
I have two php scripts that need to be run as continuous back ground
I have two PHP scripts. One acts as a backend, and contains a class

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.