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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:19:28+00:00 2026-05-27T21:19:28+00:00

I work for a small company (read: three employees) that develops web applications, and

  • 0

I work for a small company (read: three employees) that develops web applications, and we’ve been consistently using this structure for each page of our apps:

  • PHP page ‘placeholder’ that sets up the environment.
  • HTML seperated into a Smarty .tpl file.
  • JavaScript separated into a different .js file.
  • And a ‘ajax_functions.php’ file to be posted to by the JavaScript.

I feel pretty good about the file structure, although it is a bit messy (and if I’m wrong, please let me know!). My question is specifically about that ‘ajax_functions.php’ page. Right now the JavaScript will make a $.post request to something along the lines of ‘ajax_functions.php?action=subscribe’, and the page itself looks like this:

    switch($_GET['action']){
      case('subscribe'):
        //Do stuff...
      break;
      default:
        die('Invalid request');
    }

I just feel this way is too insecure: if someone wants to link directly to the page and repeatedly spam it with info, there’s little way to stop them. Is there perhaps a better to structure the requests?

  • 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-27T21:19:29+00:00Added an answer on May 27, 2026 at 9:19 pm

    This seems pretty good.

    For contrast heres what I do (pretty similar)

    My structure

    -A JS file for the AJAX etc

    -A PHP classe / functions that process the _POST and _GET data

    Thats it really.

    The class / functions check for the correct _POST or _GET data and do any other validation checks I need.

    From the functions I return a array, which can then be json_encoded and sent back to the JS

    This works well for me because the functions can be used for forms that send the same data.

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

Sidebar

Related Questions

I work for a small web development company (only 2 to 3 developers) that
We're a small software company that has been using CVS and SVN for version
I work for a small company with a .NET product that was acquired by
Just to preface: I work in a small company that does ASP.NET development and
The company that I work for develops a C++ application to manage service businesses
Context: I work at a small software company that has traditionally done research-type work,
I work for a small marketing company that has asked me to develop a
I work at a small company and our production system uses a hand-rolled RESTful
I work in a small company and we - as many others = use
I work for a small website company (couple of programmers, couple of designers). Currently

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.