本帖最后由 a0z0 于 2009-7-28 13:33 编辑
我想加个参数。下面的代码
upgame.html.php
ajaxresponse('checkusername', 'op=checkusername&sortid='+categories+'&username=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(userName) : userName)); //这里调用的。
do_upgame.php
$username = trim($_GET['username']);
$sortid = $_GET['sortid'];
if(empty($username)) {
showmessage('user_name_is_not_legitimate');
}
@include_once (S_ROOT.'./uc_client/client.php');
$ucresult = uc_user_checkgamename($username,$sortid); 这里接收的值。
client.php
function uc_user_checkgamename($username,$sortid) {
return call_user_func(UC_API_FUNC, 'user', 'check_gamename', array('username'=>$username, 'sortid'=>$sortid));
contror/user.php
function _check_gamename($username,$sortid) {
$username = addslashes(trim(stripslashes($username)));
if(!$_ENV['user']->check_username($username)) {
return UC_USER_CHECK_USERNAME_FAILED;
} elseif(!$_ENV['user']->check_gamenamecensor($username)) {
return UC_USER_USERNAME_BADWORD;
} elseif($_ENV['user']->check_gamenameexists($username,$sortid)) {
return UC_USER_USERNAME_EXISTS;
}
return 1;
}
}
model/user.php
function check_gamenameexists($username,$sortid) {
$data = $this->db->result_first("SELECT Account FROM supe_game WHERE Account='$username' and categories=".$sortid);
return $data;
}
问题已经解决 |