コード例 #1
0
     throw new exception('La pass debe tener al menos 8 caracteres');
 }
 if ((string) $pass !== (string) $pass2) {
     throw new exception('Las pass no coinciden');
 }
 // bueno esta todo ok asique revisamos si existe alguien con este nick
 if (usuarios::exists((string) $nick)) {
     throw new exception('ya existe un usuario con este nick');
 }
 $user = new usuarios();
 $user->nick_usuario = (string) $nick;
 $user->pass_usuario = (string) $pass->hash();
 $user->plan_usuario = 0;
 // por cuanto tiempo?
 $fecha = new _date();
 $user->fecha_pago_usuario = $fecha->count();
 // si hay código de promoción
 if (isset(_::$post['codigopromocional'])) {
     // comprobamos si existe el código
     // evaluamos qué da
     $user->plan_usuario = 1;
     // dentro de 99 años, 11 meses
     $user->fecha_pago_usuario = $fecha->years(99)->months(11)->count();
 }
 if (isset(_::$post['referido'])) {
     $idref = usuarios::exists((string) _::$post['referido']);
     if ($idref) {
         $user->referido = $idref;
     } else {
         throw new Exception('el usuario referido no existe');
     }
コード例 #2
0
ファイル: example.php プロジェクト: alexander171294/phpquery
     if (!isset(_::$cookie['example'])) {
         $object = new cookieVar('example');
         $lifetime = new _date();
         $object->set('the value', $lifetime->hours(10));
     }
     // to set lifetime you need use TIMESTAMP generated by _date class
     $example = new _date();
     // this represents now
     $example->hours(10);
     // now, $example represent now+10 hours
     $example->hours(10)->hours(10);
     // this add 20 hours to count
     // the functions:
     $example->seconds(15)->minutes(25)->hours(21)->days(15)->weeks(2)->months(1)->years(5);
     // if you need the timestamp (in cookie is not necessary call this function)
     var_dump($example->count());
     // if you need show in view format:
     $example->fDay('/')->fMonth('/')->fYear();
     // format year
     // this show DD/MM/YY
     var_dump($example->format());
     // others formats:
     $example->fSecond(':')->fHour(':')->fMinute();
     // ss:hh:ii
     // this show DD/MM/YYss:hh:ii
     var_dump($example->format());
     // if you need space inner YY and ss you add space in fYear()
     // if you need clear format use ->clear()
     // if you need use other timestamp and not current time, use:
     $otherExample = new _date('TIMESTAMP HERE');
 }