Пример #1
0
 public function validate(&$data, $single = false)
 {
     $p = DBC::queryOneAssoc("\n\t\t\tSELECT p_id\n\t\t\tFROM wog_player\n\t\t\tWHERE p_id={$data['p_id']}\n\t\t");
     if (!$p) {
         alert('玩家不存在');
     }
 }
Пример #2
0
 public function load()
 {
     if (!$this->hasPrimaryKey()) {
         return false;
     }
     $p = DBC::queryOneAssoc('SELECT * FROM ' . $this->tablename . ' WHERE ' . $this->pkFilterSQL());
     if (!$p) {
         return;
     }
     extendObject($this, $p);
 }
Пример #3
0
    public function validate(&$data, $single = false)
    {
        $p = DBC::queryOneAssoc('
			SELECT p_id, p_name
			FROM wog_player
			WHERE p_name="' . $data['p_name'] . '"
		');
        if ($p && (!is_numeric($this->pk['p_id']) || $p['p_id'] != $this->pk['p_id'])) {
            alert('玩家名稱重複');
        }
        if (!$single) {
            return;
        }
    }
Пример #4
0
 public function validate(&$data, $single = false)
 {
     $p = DBC::queryOneAssoc("\n\t\t\tSELECT p_id\n\t\t\tFROM wog_player\n\t\t\tWHERE p_id={$data['p_id']}\n\t\t");
     if (!$p) {
         alert('玩家不存在');
     }
     $ex = DBC::queryOneAssoc("\n\t\t\tSELECT ex_id\n\t\t\tFROM wog_exchange_main\n\t\t\tWHERE ex_id={$data['ex_id']}\n\t\t");
     if (!$p) {
         alert('資源不存在');
     }
     $el = DBC::queryOneAssoc("\n\t\t\tSELECT el_id\n\t\t\tFROM wog_exchange_list\n\t\t\tWHERE ex_id={$data['ex_id']} AND p_id={$data['p_id']}\n\t\t");
     //新增已存在的p_id:ex_id pair或修改成已存在的p_id:ex_id pair時顯示錯誤
     if ($el && (in_array(null, $this->pk, true) || $el['el_id'] != $this->pk['el_id'])) {
         alert('已有此資源');
     }
 }
Пример #5
0
 public function validate(&$data, $single = false)
 {
     if ($data['p_id'] == $data['f_id']) {
         alert('不能將自己加為好友');
     }
     $p = DBC::queryOneAssoc("\n\t\t\tSELECT p_id\n\t\t\tFROM wog_player\n\t\t\tWHERE p_id={$data['p_id']}\n\t\t");
     if (!$p) {
         alert('玩家不存在');
     }
     $p = DBC::queryOneAssoc("\n\t\t\tSELECT p_id\n\t\t\tFROM wog_player\n\t\t\tWHERE p_id={$data['f_id']}\n\t\t");
     if (!$p) {
         alert('好友不存在');
     }
     $p = DBC::queryOneAssoc("\n\t\t\tSELECT p_id\n\t\t\tFROM wog_friend_list\n\t\t\tWHERE p_id={$data['p_id']} AND f_id={$data['f_id']}\n\t\t");
     if ($p && (in_array(null, $this->pk, true) || $this->pk['p_id'] != $data['p_id'] || $this->pk['f_id'] != $data['f_id'])) {
         alert('已存在相同資料');
     }
 }