我尝试在下面应用代码,在php中没有显示任何错误,但结果却没有更改/更新。请帮我解决这个问题。谢谢你的帮助。
$ saldo = $ by-> saldo - $ server-> Price;
在控制器中:
public function renew_account($id=FALSE) {
$this->load->library('sshcepat');
if (empty($this->user_model->id_ssh($id)->hostname)) { Show_404(); }
$create_by = $this->user_model->id_ssh($id)->created_by;
$server = $this->user_model->get_hostname($id);
$by = $this->user_model->get_user($_SESSION['user_id']);
$data = array (
'hostname' => $this->user_model->id_ssh($id)->hostname,
'rootpass' => $this->user_model->get_hostname($this->user_model->id_ssh($id)->serverid)->RootPasswd,
'username' => $this->user_model->id_ssh($id)->username,
'expired' => $this->user_model->id_ssh($id)->expired_at
);
if ( isset($_SESSION['username']) && $_SESSION['logged_in'] === true ) {
if($_SESSION['username'] === $create_by ) {
if ($this->user_model->renew_user_ssh($id)) {
$saldo = $by->saldo - $server->Price;
if ($this->user_model->update_saldo($by->username, $saldo)) {
if ($this->sshcepat->renewAccount($data)) {
redirect(base_url('panel/reseller/cek_account/'.$_SESSION['username']));
}
else {echo 'Root passwd wrong!';}
}
}
} else { show_404(); }
}
else { redirect(base_url('login/login')); }
}
在User_Model中:
public function id_ssh($id) {
$this->db->from('sshuser');
$this->db->where('id', $id);
return $this->db->get()->row('');
}
public function get_user($user_id) {
$this->db->from('users');
$this->db->where('id', $user_id);
return $this->db->get()->row();
}
public function renew_user_ssh($post, $id) {
$this->db->where('Id', $id);
return $this->db->update('sshuser', $post);
}
public function update_saldo($user, $saldo) {
$this->db->where('username', $user);
return $this->db->update('users', array('username' => $user, 'saldo'=>$saldo));
}