public function register() { extract($_POST); $exists = DB::query("select * from users where email = '" . $email . "'", 1); $json = "email_not_evailable"; $id = 0; if (!$exists) { $id = DB::write("insert into users set \n\t\t\t\ttitle = '" . $title . "',\n\t\t\t\temail = '" . $email . "',\n\t\t\t\tpass = '******',\n\t\t\t\tusername = '******',\n\t\t\t\tprivacy_id = 2,\n\t\t\t\tcreated_ts = " . time()); $data = DB::query('select * from users where id = ' . $id, 1); AuthController::add_session($data); // add ftp user $link2 = DB::connect(DBHOST, DBUSER, DBPASS, "ftp"); $path = '/var/www/social/public/upload/webcams/' . $username; DB::write("INSERT INTO ftpuser (id, userid, passwd, uid, gid, homedir, shell, count, accessed, modified) VALUES ('', '" . $username . "', ENCRYPT('" . $password . "'), 2001, 2001, '" . $path . "', '/sbin/nologin', 0, '', '')", $link2); if (!is_dir($path)) { mkdir($path, 777); } $json = "email_evailable"; } return array('result' => $json, 'id' => $id); }
if (count($_POST)) { debug('POST ' . json_encode(array($_POST))); } if (count($_GET)) { debug('GET ' . json_encode(array($_GET))); } } else { if (!is_file('views' . $request_uri . '.html')) { header('Content-Type: application/json', true); echo json_encode(array('view' => "missing")); } } } else { if (!is_file($request_uri)) { include $missing_page; } } } else { if (isset($segments[0]) && $segments[0] == 'api') { $link = DB::connect(); include 'app/controllers/ApiController.php'; header('Content-Type: application/json', true); $obj = "App\\Controllers\\ApiController"; $method = strstr($segments[1], '?', true); $c = new $obj(); echo call_method($c, $method, $segments); } else { include "../app/index.php"; } } http_response_code(200);