Will this File be Executed in it's Entirety?

Hi, my shared hosting account blew up figuratively speaking…

My question: will the MySQL queries and PHP lines that come after die() in the code below be parsed/executed?
Because that’s what the Hostgator security guy told me was happening…

See comments in code:


// In this scenario all if statements resolve to false
if (($_GET['cid'] == 9 OR $_GET['cid'] == 8) && !strstr($_SERVER['HTTP_REFERER'], '0101')) {
  header('location: https://domain.com');
  die();
}
if (($_GET['cid'] == 4) && !strstr($_SERVER['HTTP_REFERER'], '1010')) {
  header('https://domain.com');
  die();
}

//Track only part of the traffic
$bypass_tracking = 0;
$bypass_num = rand(1, 6);
$bypass_url = 'https://domain.com';

if ($bypass_tracking AND $bypass_num !== 1) {
  header('location: '.$bypass_url);
  die();
}

header('location: https://domain.com');
die();

// Will Code Below This Line Be Parsed/Executed?
// Below Here Are Lots Of Mysql Quesries In Real File
// Hostgator Security Told Me They Were Executed And Causing Server Overload

They won’t.

Anyone else can confirm?

I know JS get executed in the order that it’s written but with PHP I know that you can refer to code that’s further dow that page and it’ll work. That’s why I ask…

Statements that abort execution are exit() and die(), if you use them in such a way that you did - nothing will get executed from the line where die() was written.
As for how the things are executed, it’s the same a JavaScript to put it simply. There’s no random code execution here and there.

If die or [URL=“http://www.php.net/manual/en/function.exit.php”]exit are executed then your script terminates there and then and nothing below the die or exit will be executed.

The only way code below your IF block will be executed is if the test condition in the IF block evaluates to false causing the die within the IF to be bypassed.

ok, thanks for the feednack