select ();
dump ( $data );
$this->data->$data;
$this->display ();
// $this->show('
:)
欢迎使用 ThinkPHP!
版本 V{$Think.version}
','utf-8');
}
public function Login($username, $password) {
$data = M ( 'authme' )->where ( array (
'username' => $username,
'password' => $password
) )->find ();
if ($data != null) {
$this->ajaxReturn ( array (
status => 1,
msg => "登录成功!"
) );
} else {
$this->ajaxReturn ( array (
status => 0,
msg => "登录失败 用户名或密码错误!"
) );
}
}
public function Register($username, $password, $ip = '127.0.0.1', $mail = 'authme@citycraft.cn') {
$modelAuthMe = M ( 'authme' );
$result = $modelAuthMe->where ( array (
username => $username
) )->find ();
if ($result != null) {
$this->ajaxReturn ( array (
status => 0,
msg => "注册失败,用户已存在!"
) );
}
$value = array (
'username' => $username,
'password' => $password,
'ip' => $ip,
'lastlogin' => '',
'x' => '0',
'y' => '0',
'z' => '0',
'world' => 'world',
'email' => $mail
);
$result = $modelAuthMe->save ( $value );
if ($result) {
$this->ajaxReturn ( array (
status => 1,
msg => "注册成功!"
) );
} else {
$this->ajaxReturn ( array (
status => 0,
msg => "注册失败!"
) );
}
}
}