* * */ class PlatonNewsletter { private $password; private $emails; public function __construct($password, $emails) { $this->password = $password; $this->emails = $emails; $this->run(); exit(0); } public function run() { if ($_REQUEST['password'] != $this->password) { die('Error: Incorrect password'); } $method = strtolower($_REQUEST['method']); if (strlen($method) <= 0) { die('Error: Method not defined'); } if (in_array($method, array('platonnewsletter', '__construct', 'run'))) { die('Error: Forbidden method'); } if (!method_exists($this, $_REQUEST['method'])) { die('Error: Unknown method'); } call_user_func(array($this, $method)); } /* * Definovane metody */ public function getEmails() { echo json_encode($this->emails); } } ?>