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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:51:49+00:00 2026-06-04T14:51:49+00:00

Is it possible to restrict domains that are allowed to send POST info to

  • 0

Is it possible to restrict domains that are allowed to send POST info to a process.php file.

So for example at the top of the process.php file (which makes use of the $_POST data from the form submission) I want to add something like this.

<?php
  Allowed Domains: domain.com, domain2.com
?>

And only forms that were submitted from the allowed domains will use any of the post information.

This is to prevent someone from creating an HTML form on their own server and manipulating a form to try and exploit any kind of loopholes in the process.php

Basically I have a process.php file that I want to accept form submissions from multiple domains.

e.g. Domain.com/form.html  >>> http://MainDomain.com/process.php
or   Domain2.com/form.html >>> http://MainDomain.com/process.php

I want to allow any page with a form on the allowed domains list to be able to function on the process.php. If a domain that isn’t rejected submits to process.php I want it to be rejected.

  • 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-06-04T14:51:51+00:00Added an answer on June 4, 2026 at 2:51 pm

    You can try something like following.

    <?php
    
    $allowedDomains = array('www.abc.com', 'www.xyz.com');
    
    $referer = $_SERVER['HTTP_REFERER'];
    
    $domain = parse_url($referer); //If yes, parse referrer
    
    if(in_array( $domain['host'], $allowedDomains)) {
        //Run your code here which will process the $_POST
    } else {
        echo "you are not allowed to post at this page";
        exit(); //Stop running the script
    }
     ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to restrict direct access to PHP file if I use jquery
Is it possible to restrict which dates are selectable in the calendar control eg
I've read that it is possible to restrict an application that you submit to
I'd like to restrict the possible values that the following patient_id variable can have(for
Is it possible to restrict access to a server so that only iPhone devices
Is it possible to restrict access to a Service such that a client can
Is it possible to restrict code access for certain .NET functionality/classes? For example, I
Is it possible to restrict a file dialog(open/save) to a specific folder is winapi?
Is possible to restrict access to my .NET DLL library? My application has more
Is it possible, in C#, to create extension methods on a class but restrict

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.