Jump to content

Recommended Posts

Hi, I was wondering what everyones thoughts would be to a command handler I wrote to handle my php. I'm not sure if this is a good idea or not. I have one file called commandHandler.php which looks something simular to this, just writing this simply to show what I'm doing.

 

commandHandler.php

<?php
switch($_POST['cmd']) {
case "login":
require("login file");
Login::html(true);
break;
}
?>

 

loginHandler.php

class Login {
public static function html($form) {
 /* -Grabs the fields in either ajax or form type- */
}
}

 

Basically I'm handling most php files this way, simply because I want to keep my php written in classes to keep it neat and organised. Any thoughts on whether this is a good or bad idea?

 

Also just to throw it out there, the $_POST['cmd'] goes through filtering and parsing before it enters the switch statement. Basically it is parsed like this:

$_POST['cmd'] == "command arg1 arg2 arg3 arg4"; //etc...

Edited by remenissions
Link to comment
https://forums.phpfreaks.com/topic/274949-php-ajax-scoping/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.