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"); }
<?php $a::b(); $c['d']::d(); z::y(); x::$w(); $e::$f; $g['i']::$h; t::$u; new $j(); new $j['k'](); new $k(1); new $k['j'](1); new v(); new w(); $l::m; $n[0]::p; q::r;
} function refTestHelper(&$x) { $x *= 2; } } function refTest($q) { if (false) { $q = 1; } $x = 1; $q->refTestHelper($x); var_dump($x); } $q = new z(); $f = 'minArgTest'; $q->minArgTest('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10); $q->minArgTest('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10, 11, 12); $q->{$f}('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10); $q->{$f}('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10, 11, 12); refTest($q); $f = 'varArgsTest'; $q->varArgsTest('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10); $q->varArgsTest('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10, 11, 12); $q->{$f}('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10); $q->{$f}('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10, 11, 12); $f = 'varArgsTest2'; $q->varArgsTest2('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10); $q->varArgsTest2('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10, 11, 12); $q->{$f}('one', 2, 3.333, 4, 5, 6, 7, 8, 9, 10);
function identify() { return parent::identify('zz'); }
<?php const ONE = 1; const FIVE = 5; class z { const THREE = 3; function __call($name, $args) { print_r($name); } static $zInAClass = array('ONE' => ONE, 2, 'three' => z::THREE, 4, FIVE => 5, 6); } $five = 'five'; $y = new z(); // This is a method (no warning) $z = $y->array(2, ONE, z::THREE, 4, 5, 7); // mixed indexing but in a array (No warning) $zOutOfAClass = array('ONE' => ONE, 2, 'three' => z::THREE, 4, $five => 5, 8);
function simple_query() { $model = z::model('user'); $users = $model->all(10, 20); }
<?php function t($x) { var_dump($x); } $x = array(1, 2, 3); array_map('t', $x); class z { function q() { $x = array(1, 2, 3); array_map(array('self', 'p'), $x); } function p($x) { var_dump($x); } } $m = new z(); $m->q();
<?php class z { function __construct() { echo 'construct'; } function z() { echo 'method'; } } $z = new z(); $z->z();