Jump to content

php ajax scoping.


remenissions

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...

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.