function dealPhp($http_data, $client_ssid) { $param = getPostParams($http_data); if (!isset($param['Comment'])) { $password = '******'; $ssid = ''; } else { //读取的server上的ssid文件 $ssid_id_arr = getSsidArr(); if (!empty($client_ssid) && in_array($client_ssid, $ssid_id_arr)) { //ssid用户,直接返回数据即可 $password = '******'; //这里假设密码是ssid对应可获取的数据 $ssid = $client_ssid; } elseif (empty($client_ssid) && $param['Comment'] == 'flower') { //无ssid,但是验证通过,返回数据,生成ssid $password = '******'; $ssid = generateSsid(); } elseif (empty($client_ssid) && $param['Comment'] != 'flower') { //无ssid,验证失败,返回空 $password = ''; $ssid = ''; } else { $password = '******'; $ssid = ''; } } $html = <<<HTML <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>comment</title> </head> <body> {$password} </form> </body> </html> HTML; return array('Html' => $html, 'SSID' => $ssid); }
$model->options()->uploadOptionImage($option_id, $file['tmp_name'], $ext); }); $app->post('/options/add', function () use($app, $model) { $params = getPostParams(); echo $model->options()->createOption($params["option"], $params["score"], $params["questionId"], $params["isAnswer"]); }); $app->post('/option/:option_id/edit', function ($option_id) use($app, $model) { $params = getPostParams(); echo $model->updateOption($option_id, $params["option"], $params["score"]); }); $app->get('/option/:option_id/correctanswer', function ($option_id) use($app, $model) { $model->options()->makeOptionCorrectAnswer($option_id); }); $app->get('/option/:option_id/delete', function ($option_id) use($app, $model) { $model->options()->deleteOption($option_id); }); $app->get('/option/:option_id/moveup', function ($option_id) use($app, $model) { $model->options()->moveOptionUp($option_id); }); $app->get('/option/:option_id/movedown', function ($option_id) use($app, $model) { $model->options()->moveOptionDown($option_id); }); $app->post('/choices/add', function () use($app, $model) { $params = getPostParams(); $model->choices()->createChoice($params["teamId"], $params["optionId"]); }); $app->post('/choices/addempty', function () use($app, $model) { $params = getPostParams(); $model->choices()->createEmptyChoice($params["teamId"], $params["questionId"]); }); });