public function Block() { $id = ""; $this->sql = "select flag from user where id='" . $this->data["keyvalue"] . "'"; $data = parent::custom(); if ($data[0]["flag"] == 1) { $flag = array("flag" => 0); } else { $flag = array("flag" => 1); } parent::RawUpdate("user", $flag, $this->data["keyvalue"], "id"); if (LEVEL > 1) { $user = $this->GetUser($this->data["keyvalue"]); foreach ($user as $val) { $this->sql = "select `flag`,`id` from sipuser where `iduser`='" . $this->data["keyvalue"] . "'"; $data = parent::custom(); foreach ($data as $val) { $id .= $val["id"] . ","; } $this->sql = "UPDATE `sipuser` SET `flag`=" . $flag . " WHERE `id` IN (" . substr($id, 0, -1) . ")"; parent::custom(); } } else { $this->sql = "select `flag`,`id` from sipuser where `iduser`='" . $this->data["keyvalue"] . "'"; $data = parent::custom(); foreach ($data as $val) { $id .= $val["id"] . ","; } $this->sql = "UPDATE `sipuser` SET `flag`=" . $flag . " WHERE `id` IN (" . substr($id, 0, -1) . ")"; parent::custom(); } $this->response(); }