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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:41:26+00:00 2026-05-27T22:41:26+00:00

I have a PHP script that does some validation, and if the validation is

  • 0

I have a PHP script that does some validation, and if the validation is off, it should return 404. But it doesn’t.

Here is the beginning of the script:

<?php
include '../connect.php';
include '../global.php';
include '../utils/api/problems.php';
include '../utils/api/suggested_solutions.php';
include '../utils/api/attempted_solutions.php';
include '../utils/api/categories.php';

$problem_id = mysql_real_escape_string($_GET["problem_id"]);

// Get member_id from session
$member_id = $_SESSION['user_id'];

// Validate the call
if ( empty ( $problem_id ) || !isset ( $problem_id ) || !is_numeric ( $problem_id ) )
{
    $referer = $_SERVER['HTTP_REFERER']; 

    // Send me an email with the error:
    $from = "from: problem_url_error@problemio.com";  
    $to_email_address = 'my_email';
    $error_subject = 'Error happened when getting problem_id from request';
    $contents = 'Error in problem.php - here is the referer: '.$referer;

    //mail($to_email_address, $error_subject, $contents, $from);    

    error_log ( ".......error validating problem id in problem.php");
    header('HTTP/1.1 404 Not Found');
}

But for some reason, this does not return a 404 – any idea why?

Thanks!!

  • 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-27T22:41:27+00:00Added an answer on May 27, 2026 at 10:41 pm

    The header is called status:

    header("Status: 404 Not Found");
    

    EDIT:
    Now I see your approach should work as well, study the header documentation if you meet the requirements to use header("HTTP/xxx ..."), there are some limitations.

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

Sidebar

Related Questions

I have a php script that does some processing (creates remittance advice PDFs, self-billing
I have a PHP script that does the following: Uses file_get_contents() to get content
I have a PHP script that does basic encryption of a string through the
I have an AJAX request (using JQuery) that calls a PHP script which does
I have a php script that triggers some magento actions, and I set it
The problem is that I have a PHP script (A) that does signup, authorize
I have a php script that needs to run for quite some time. What
I have a PHP script that doesn't seem to work when it contains a
I am making a PHP script that does some stuff for me, so I
I am trying to download some files. I have written a php script that

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.