示例#1
0
 public function __construct()
 {
     parent::__construct();
     $this->table = table_name($this->ins_name);
     $this->createRule = ['name' => 'required', 'username' => 'required|unique:' . table_name($this->ins_name), 'password' => 'required|min:6', 'hospital_id' => 'required|exists:' . table_name('hospital') . ',id'];
     $this->updateRule = ['id' => 'required|numeric'];
 }
示例#2
0
 public function __construct()
 {
     parent::__construct();
     $this->table = table_name($this->ins_name);
     $this->createRule = ['name' => 'string', 'name_in_charge' => 'string', 'city_id' => 'required|numeric', 'province_id' => 'required|numeric', 'location_detail' => 'string', 'username' => 'required|unique:' . table_name($this->ins_name), 'password' => 'required|min:6', 'phone' => 'numeric|min:11', 'email' => 'email', 'status' => 'numeric', 'memo' => 'string'];
     $this->updateRule = ['id' => 'required|numeric', 'password' => 'min:6'];
 }
示例#3
0
 public function __construct()
 {
     parent::__construct();
     $this->table = table_name($this->ins_name);
     $this->createRule = ['name' => 'required', 'username' => 'required|unique:' . table_name($this->ins_name), 'password' => 'required|min:6|regex:/^(?=.*[a-zA-Z])(?=.*[\\d])[a-zA-Z\\d].+$/', 'phone' => 'required', 'email' => 'required|email', 'status' => 'numeric', 'memo' => 'string'];
     $this->updateRule = ['id' => 'required|numeric', 'username' => 'unique:' . table_name($this->ins_name) . ',username,' . rq('id'), 'password' => 'min:6|regex:/^(?=.*[a-zA-Z])(?=.*[\\d])[a-zA-Z\\d].+$/'];
     $this->messages = ['username.required' => '用户名必填', 'username.unique' => '用户名已被使用', 'password.required' => '密码必填', 'password.regex' => '密码不符合要求,必选包含字母和数字', 'password.min' => '密码必须大于6位', 'phone.required' => '手机号码必填', 'email.required' => '电子邮箱必填', 'email.email' => '邮箱格式有误'];
 }
示例#4
0
 public function __construct($prefix = 'i')
 {
     $this->table = table_name($this->ins_name, $prefix);
     $settings = Cache::get('i_settings', null);
     if (!empty($settings)) {
         $this->default_limit = array_get($settings, 'user.per_page');
     }
 }
示例#5
0
文件: IDoctor.php 项目: newset/robot
 public function __construct()
 {
     parent::__construct();
     $this->table = table_name($this->ins_name, 'i');
     $this->createRule = ['email' => 'required|email', 'name' => 'required', 'phone' => 'required'];
     $this->updateRule = ['email' => 'required|email', 'name' => 'required', 'phone' => 'required'];
     $this->messages = ['phone.required' => '手机号码必填', 'email.required' => '电子邮箱必填', 'email.email' => '邮箱格式有误'];
 }
示例#6
0
 public function __construct()
 {
     parent::__construct();
     $this->table = table_name($this->ins_name);
     $this->createRule = ['name' => 'required', 'username' => 'required|unique:' . table_name($this->ins_name), 'password' => 'required|alpha_num|min:6', 'phone' => 'required', 'email' => 'required|email', 'status' => 'numeric', 'memo' => 'string'];
     $this->updateRule = ['id' => 'required|numeric', 'username' => 'unique:' . table_name($this->ins_name) . ',username,' . rq('id'), 'password' => 'alpha_num|min:6'];
     $this->messages = ['username.required' => '用户名必填', 'username.unique' => '用户名已被使用', 'password.required' => '密码必填', 'password.min' => '密码至少有6位字母或者数字', 'phone.required' => '手机号码必填', 'email.required' => '电子邮箱必填', 'email.email' => '邮箱格式有误'];
 }
示例#7
0
 public function __construct()
 {
     parent::__construct();
     $this->table = table_name($this->ins_name);
     $this->createRule = ['name' => 'required', 'username' => 'required|unique:' . table_name($this->ins_name), 'password' => 'required|min:6|regex:/^(?=.*[a-zA-Z])(?=.*[\\d])[a-zA-Z\\d].+$/', 'hospital_id' => 'required|exists:' . table_name('hospital') . ',id'];
     $this->updateRule = ['id' => 'required|numeric', 'password' => 'min:6|regex:/^(?=.*[a-zA-Z])(?=.*[\\d])[a-zA-Z\\d].+$/'];
     $this->messages = ['password.regex' => '密码不符合要求,必选包含字母和数字', 'password.min' => '密码必须大于6位'];
 }
示例#8
0
    public function action_create()
    {
        if (is_post()) {
            $parameters = get_previous_parameters();
            $object = new CommentObj();
            $object = $object->fromRequest();
            $object['foreign_id'] = empty($object['foreign_id']) ? reset($parameters) : $object['foreign_id'];
            $object['foreign_table'] = empty($object['foreign_table']) ? table_name(get_previous_area()) : $object['foreign_table'];
            //If we don't have a logged in user, create a dummy account
            if (!BackendUser::check()) {
                $query = new SelectQuery('BackendUser');
                $query->filter('`email` = :email');
                if ($old_user = Controller::getVar('user')) {
                    $existing_user = $query->fetchAssoc(array(':email' => $old_user['email']));
                }
                switch (true) {
                    case $existing_user && $existing_user['confirmed'] && $existing_user['active']:
                        //Attribute quote to user? Seems risque, actually, if I know a user's email address, I can just attribute to him. Auth first
                        Backend::addError('Comment not added. Please login first');
                        return false;
                        break;
                    case $existing_user && !$existing_user['confirmed'] && $existing_user['active']:
                        //Unregistered user commented before
                        $object['user_id'] = $existing_user['id'];
                        break;
                    default:
                    case !$existing_user:
                        $user_data = array('name' => $old_user['name'], 'surname' => '', 'email' => $old_user['email'], 'website' => $old_user['website'], 'username' => $old_user['email'], 'password' => get_random(), 'confirmed' => 0, 'active' => 1);
                        $user = self::getObject('BackendUser');
                        if ($user->create($user_data)) {
                            $object['user_id'] = $user->array['id'];
                            $url = SITE_LINK . '/?q=backend_user/confirm/' . $user->array['salt'];
                            $app_name = ConfigValue::get('Title');
                            $message = <<<END
Hi {$user->array['name']}!

Thank you for your comment on {$app_name}. An account has automatically been created for you. To activate it, please click on the following link:

{$url}

Please note that you don't need to do this for your comments to show, but this account will be deleted if it isn't confirmed in a weeks time.

Regards
END;
                            send_email($user->array['email'], 'Thank you for your comment.', $message);
                        } else {
                            Backend::addError('Could not create user to add Comment');
                            return false;
                        }
                        break;
                }
            }
            $object = array_filter($object, create_function('$var', 'return !is_null($var);'));
            Controller::setVar('obj', $object);
        }
        return parent::action_create();
    }
示例#9
0
 public function __construct()
 {
     parent::__construct();
     $this->table = table_name($this->ins_name, 'i');
     // $this->createRule = [
     //     'email' => 'required|email',
     //     'name' => 'required'
     // ];
 }
示例#10
0
function view_attempts()
{
    include "../sql-connections/sql-connect-1.php";
    $table = table_name();
    $sql = "SELECT tryy FROM {$table} WHERE id=1";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);
    if (!$row) {
        die("error in function view_attempts()" . mysql_error());
    } else {
        return $row[0];
    }
}
示例#11
0
 /**
  * if user exists, return user instance,
  * else return false.
  * @param $ins_name
  * @param $cond
  * @return mixed
  */
 public function user_exists($ins_name, $cond)
 {
     $ins = M($ins_name);
     $ins = $ins->where($cond);
     if ($ins_name == 'department') {
         $select = [table_name('department') . '.*', table_name('hospital') . '.name as hospital_name'];
         $ins = $ins->select($select)->leftJoin(table_name('hospital'), table_name('department') . '.hospital_id', '=', table_name('hospital') . '.id');
     }
     if ($ins_name == 'employee') {
         $ins = $ins->where('status', 1);
     }
     if ($ins_name == 'agency') {
         $ins = $ins->where('status', 1);
     }
     $ins = $ins->first();
     return $ins ? $ins : false;
 }
示例#12
0
文件: IInit.php 项目: Aaronqcd/robot
 public function front()
 {
     $cache = Cache::get('i_settings', null);
     $per_page = array_get($cache, 'user.per_page');
     $d = ['debug' => debugging(), 'is_logged_in' => sess('is_logged_in'), 'his_chara' => sess('his_chara'), 'username' => sess('username'), 'uid' => sess('uid'), 'per_page' => $per_page, 'agency_end' => $this->retrieve('system.agency_end')];
     $type = ['employee' => 1, 'agency' => 2, 'doctor' => 3];
     // 获取未读通知
     if (uid()) {
         $d['unread'] = M('message')->where('recipientid', uid())->where('recipienttype', $type[his_chara()[0]])->where('read', 0)->count();
     } else {
         $d['unread'] = 0;
     }
     $d['org'] = '';
     if (he_is('agency')) {
         $org = DB::table(table_name('agency'))->select('name')->where('id', uid())->first();
         sess('org', $org->name);
         $d['org'] = sess('org');
     }
     if (he_is('employee')) {
         $d['org'] = sess('org');
     }
     return ss($d);
 }
示例#13
0
 /**
  * Construct a DB Object
  *
  * children have the following options:
  * - conditions = array(ClassName => array(field_in_child => value | field_in_this_model))
  * - relation = single | multiple, defaults to single
  */
 function __construct($meta = array(), array $options = array())
 {
     if (!is_array($meta)) {
         $meta = is_numeric($meta) ? array('id' => $meta) : array();
     }
     $meta['id'] = array_key_exists('id', $meta) ? $meta['id'] : false;
     $meta['id_field'] = array_key_exists('id_field', $meta) ? $meta['id_field'] : 'id';
     $meta['table'] = array_key_exists('table', $meta) ? $meta['table'] : table_name(get_class($this));
     $meta['database'] = array_key_exists('database', $meta) ? $meta['database'] : Backend::getConfig('backend.dbs.default.alias', 'default');
     $meta['provider'] = array_key_exists('provider', $meta) ? $meta['provider'] : Backend::getConfig('backend.provider', 'MySQL');
     $meta['fields'] = array_key_exists('fields', $meta) ? $meta['fields'] : array();
     $meta['keys'] = array_key_exists('keys', $meta) ? $meta['keys'] : array();
     $meta['name'] = array_key_exists('name', $meta) ? $meta['name'] : class_name(get_class($this));
     $meta['objname'] = array_key_exists('objname', $meta) ? $meta['objname'] : get_class($this);
     $meta['relations'] = array_key_exists('relations', $meta) ? $meta['relations'] : array();
     $this->meta = $meta;
     $load_type = array_key_exists('load_mode', $options) ? $options['load_mode'] : $this->load_mode;
     if ($this->checkConnection()) {
         if ($meta['id']) {
             $this->read(array('mode' => $load_type));
         }
     }
 }
示例#14
0
 protected function add_to_many_object($class, $value)
 {
     $table = table_name($class);
     # search in habtm
     #if (is_array($this->habtm) && array_key_exists($table, $this->habtm)) {
     if ($this->has_relationship($table, 'habtm')) {
         $table = $this->habtm[$table]['table'];
         foreach ($value as $k => $v) {
             $this->exec("INSERT INTO {$table} (" . $this->get_table() . "_id, " . $v->get_table() . "_id) VALUES('" . $this->get_id() . "', '" . $v->get_id() . "')");
         }
     } else {
         if ($this->has_relationship($table, 'to-many')) {
             $class = $this->to_many[$table]['class'];
             $idprop = $this->get_table() . '_id';
             $id = $this->get_id();
             foreach ($value as $k => $v) {
                 $v->{$idprop} = $id;
                 $v->save();
             }
         }
     }
 }
示例#15
0
文件: BaseModel.php 项目: newset/gd
 public function __construct($prefix = 'i')
 {
     $this->table = table_name($this->ins_name, $prefix);
 }
示例#16
0
文件: db.php 项目: newset/robot
 function fillable_fields($ins_name, $d, $ins_type = 'i')
 {
     return array_only($d, Schema::getColumnListing(table_name($ins_name, $ins_type)));
 }
示例#17
0
文件: VRobot.php 项目: newset/robot
 public function __construct()
 {
     parent::__construct();
     $this->table = table_name($this->ins_name, 'v');
 }
示例#18
0
文件: Usher.php 项目: brysonian/Saint
function var_name($class)
{
    return table_name($class);
}
示例#19
0
文件: VMark.php 项目: hellopsm/robot
 public function __construct()
 {
     $this->table = table_name($this->ins_name, 'v');
 }
示例#20
0
 public function init_setting()
 {
     $settings = Cache::rememberForever('i_settings', function () {
         $data = DB::table(table_name('settings'))->get();
         $rules = [];
         array_walk($data, function ($item) use(&$rules) {
             $rules[$item->k] = json_decode($item->v, true);
         });
         return $rules;
     });
     return $settings;
 }
示例#21
0
<div style=" margin-top:20px;color:#FFF; font-size:23px; text-align:center">Welcome&nbsp;&nbsp;&nbsp;<font color="#FF0000"> Dhakkan </font><br>
<font size="3" color="#FFFF00">



<?php 
//including the Mysql connect parameters.
include '../sql-connections/sql-connect-1.php';
include '../sql-connections/functions.php';
error_reporting(0);
$pag = $_SERVER['PHP_SELF'];
//generating page address to piggy back after redirects...
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
//characterset for generating random data
$times = 130;
$table = table_name();
$col = column_name(1);
// session id column name
$col1 = column_name(2);
//secret key column name
// Submitting the final answer
if (!isset($_POST['answer_key'])) {
    // resetting the challenge and repopulating the table .
    if (isset($_POST['reset'])) {
        setcookie('challenge', ' ', time() - 3600000);
        echo "<font size=4>You have reset the Challenge</font><br>\n";
        echo "Redirecting you to main challenge page..........\n";
        header("refresh:4;url=../sql-connections/setup-db-challenge.php?id={$pag}");
        //echo "cookie expired";
    } else {
        // Checking the cookie on the page and populate the table with random value.
示例#22
0
文件: test.php 项目: intfrr/sqli-labs
<?php

include 'db-creds.inc';
include 'sql-connect-1.php';
include 'functions.php';
$tab = table_name();
$col = column_name(2);
$data = data($tab, $col);
echo $data;