function registerAction() { $model = Zed::model('user'); $name = z::post('name'); $login = z::post('login'); $pass = z::post('pass'); $pass2 = z::post('pass2'); $age = z::post('age'); $email = z::post('email'); $gender = z::post('gender'); $userKey = $model->hash_data(mt_rand(100000, 999999) . time()); $id = $model->checkMatch($login); if ($id) { print "this login already exist "; print "<a href='http://test4.com:81/course_work/auth/register'>back to registration</a>"; exit; } if ($pass2 == '') { p(header("location:http://test4.com:81/course_work/auth/register?error=empty_pass2")); exit; } if (preg_match("/^[a-z0-9_-]{3 , 16}\$/", $login) || strlen($pass) > 6 && $pass == $pass2) { $data = ['name' => $name, 'login' => $login, 'pass' => $pass, 'age' => $age, 'email' => $email, 'gender' => $gender, 'userKey' => $userKey]; //pr($data); $new_user_id = $model->create($data); $_SESSION['id'] = $new_user_id; setcookie('user_key', $userKey, time() + 3600 * 24 * 30); //p("user with name:{$name} and login {$login} created"); header("location:http://test4.com:81/course_work/article/selectArticle"); } else { p(header("location:http://test4.com:81/course_work/auth/register?error=novalid_login_or_pass")); exit; } }
function registerAction() { $model = Zed::model('user'); $name = z::post('name'); $login = z::post('login'); $pass = z::post('pass'); $pass2 = z::post('pass2'); $userKey = $model->hash_data(mt_rand(100000, 999999) . time()); $id = $model->checkMatch($login); if ($id) { print "this login already exist "; print "<a href='http://" . HOST . "/testWork/auth/register'>back to registration</a>"; exit; } if ($pass2 == '') { p(header("location:http://" . HOST . "/testWork/auth/register?error=empty_pass2")); exit; } if (preg_match("/^[a-z0-9_-]{3 , 16}\$/", $login) || strlen($pass) >= 6 && $pass == $pass2) { $data = ['name' => $name, 'login' => $login, 'pass' => $pass]; $new_user_id = $model->create($data); $user = $model->read($new_user_id); $_SESSION['user'] = $user; setcookie('user_key', $userKey, time() + 3600 * 24 * 30); header("location:http://" . HOST . "/testWork/buisnes/selectBuisnes"); } else { print header("location:http://" . HOST . "/testWork/auth/register?error=novalid_login_or_pass"); exit; } }
function actionUpdate() { $model = Zed::model('post'); $title = z::post('title'); $content = z::post('content'); $id = z::post('article_id'); $data = ['title' => $title, 'content' => $content]; $res = $model->update($data, $id); //p("result of update: " . $res); header("location:http://test4.com:81/course_work/article/selectArticle"); }
function actionUpdate() { $model = Zed::model('buisnes'); $isExecute = z::post('chkExecute'); $id = z::post('buisnes_id'); $varible = null; if ($isExecute == "on") { $varible = 1; } else { if ($isExecute == "off") { $varible = 0; } } $data = ['isExecute' => $varible]; $res = $model->update($data, $id); header("location:http://" . HOST . "/testWork/buisnes/selectBuisnes"); }
function registerAction() { $model = Zed::model('user'); $name = z::post('name'); $login = z::post('login'); $pass = z::post('pass'); $age = z::post('age'); $email = z::post('email'); $gender = z::post('gender'); $userKey = $model->hash_data(mt_rand(100000, 999999) . time()); $id = $model->checkMatch($login); if ($id) { print "this login already exist "; print "<a href='http://test4.com:81/mvc/auth/register'>back to registration</a>"; exit; } $data = ['name' => $name, 'login' => $login, 'pass' => $pass, 'age' => $age, 'email' => $email, 'gender' => $gender, 'userKey' => $userKey]; //pr($data); $model->create($data); p("user with name:{$name} and login {$login} created"); }