データを一度だけ入力する必要がある Facebook アプリを作成しました。
それはすべて機能しており、データベースにデータが入力されていますが、人々が戻ってきてデータを際限なく再入力しないようにする必要があります.
ユーザーが既にデータを送信したかどうかを確認する最善の方法は何ですか?
signed_request がまだ送信されていて、そのデータが入力されていない可能性があるため、両方が機能するかどうかを確認する必要があります。
理想的には、PHP は FB ID とその他のデータをチェックし、確認/お礼のページのみを表示します。
現在、データベースに送信する私のphpは次のとおりです。
class Users_Model extends CI_Model {
protected $_name = 'users';
function add($id,$key,$value) {
$data = array(
'id' => $id,
'name' => $key,
'value' => $value
);
return $this->db->insert($this->_name, $data);
}
function update($id,$key,$value) {
$data = array(
'value' => $value
);
$this->db->where(array(
'id' => $id,
'name' => $key
));
return $this->db->update($this->_name, $data);
}
function exists($id,$key=null) {
if($key == null) {
$this->db->where(array(
'id' => $id
));
} else {
$this->db->where(array(
'id' => $id,
'name' => $key
));
}
$query = $this->db->get($this->_name);
if($query->num_rows() > 0) {
return true;
}
return false;
}
function remove($id) {
$data = array(
'id' => $id,
);
return $this->db->delete($this->_name, $data);
}
function all() {
$query = $this->db->get($this->_name);
$results = array();
if($query->num_rows() > 0) {
foreach($query->result() as $row) {
$results[]=$row;
}
}
return $results;
}
}
どんな助けでも大歓迎です...