各位大家帮忙看一下哪里出了有关问题
程序员文章站
2022-05-15 10:46:06
...
各位大家帮忙看一下哪里出了问题
这个为什么没办法输出
代码如下:
require('web.config.php');
return_lang();
$do = $_GET['do'];
$g = chr(92);
$do = str_replace($g , "", $_GET['do']);
$do = str_replace("/" , "", $do);
$do = str_replace("%00" , "\0", $do);
$do = str_replace("?" , "", $do);
$do = htmlspecialchars($do);
$do = strtolower($do);
if(!isset($_GET['do'])){ jump('extend.php?do=webreborn'); } else {
if($user_auth->haslogin(true)){
$rs = $db->Execute("Select * from userinfo where userid = ?", array($_SESSION['auth_user']));
$auth = $rs->GetArray();
$auth = $auth[0];
class char_do extends Member {
var $inputs = array('ChaList','id','cid','SchoolList');
var $stn_rb = false;
var $vip_rb = false;
function char_do(){
global $do,$db,$auth,$_config;
if (!is_file("modules/user.".$do.".php")) { jump('ErrorPage.php'); }
switch ($do) {
case 'webpd':
include('modules/user.webpd.php');
$titleImg = "title_37";
break;
//You can add more page here.....
}
}
function _char_select_empty(){
if($_POST[$this->inputs[0]]!="-1"){
return true;
}
return false;
}
function _school_select_empty(){
if($_POST[$this->inputs[3]]!="-1"){
return true;
}
return false;
}
function _update_rb_lvl_exp($db,$id){
global $_config;
$rb_res = $db->Execute('update rangame1.dbo.chainfo set '.$_config['ucp_rb_col'].'='.$_config['ucp_rb_col'].'+?, ChaLevel = ?, chaexp = ? where chanum = ?',array('1','1','0',$id));
if($rb_res){
return true;
}
return false;
}
function _charge_gold($db,$id,$cost){
$gold_res = $db->Execute('update rangame1.dbo.chainfo set ChaMoney = ChaMoney - ? where chanum = ?',array($cost,$id));
if($gold_res){
return true;
}
return false;
}
function resetRbStats($db,$id){
$char_res = $db->Execute('Update RanGame1.dbo.ChaInfo set ChaPower=?,ChaStrong=?,ChaStrength=?,ChaSpirit=?,ChaDex=?,ChaStRemain=? where chanum = ?',array(0,0,0,0,0,0,$id));
if($char_res){
return true;
}
return false;
}
function _update_rb_stats($db,$cid,$stats,$rev=false){
if($rev==true){
$stn_res = $db->Execute('update rangame1.dbo.chainfo set ChaStRemain = ChaStRemain + ? where chanum = ?',array($stats,$cid));
}else{
$stn_res = $db->Execute('update rangame1.dbo.chainfo set ChaStRemain = ? where chanum = ?',array($stats,$cid));
}
if($stn_res){
return true;
}
return false;
}
function _char_list(){
global $db,$auth;
$char_list = $db->Execute("SELECT UserNum,ChaNum,ChaName FROM RanGame1.dbo.ChaInfo Where ChaDeleted!=1 And UserNum = ?",array($auth['UserNum']));
if($char_list->EOF)
echo '';
foreach ($char_list as $char => $c) {
$temp_c = 'if(clean_variable($_POST[$this->inputs[0]])==$c["chanum"]){
$temp_c.= 'selected="selected" ';
}
$temp_c.= 'value="'.$c["chanum"].'">';
$temp_c.= $c["chaname"];
$temp_c.= '';
echo $temp_c;
}
}
}
$char_func = new char_do;
?>
在这里调用 为什么无法输出?
------解决方案--------------------
$titleImg,作用域
------解决方案--------------------
$titleImg 在 function char_do 中定义,并未声明为全局变量
只有 global $do,$db,$auth,$_config;
所以无法在外部访问
这个为什么没办法输出
代码如下:
require('web.config.php');
return_lang();
$do = $_GET['do'];
$g = chr(92);
$do = str_replace($g , "", $_GET['do']);
$do = str_replace("/" , "", $do);
$do = str_replace("%00" , "\0", $do);
$do = str_replace("?" , "", $do);
$do = htmlspecialchars($do);
$do = strtolower($do);
if(!isset($_GET['do'])){ jump('extend.php?do=webreborn'); } else {
if($user_auth->haslogin(true)){
$rs = $db->Execute("Select * from userinfo where userid = ?", array($_SESSION['auth_user']));
$auth = $rs->GetArray();
$auth = $auth[0];
class char_do extends Member {
var $inputs = array('ChaList','id','cid','SchoolList');
var $stn_rb = false;
var $vip_rb = false;
function char_do(){
global $do,$db,$auth,$_config;
if (!is_file("modules/user.".$do.".php")) { jump('ErrorPage.php'); }
switch ($do) {
case 'webpd':
include('modules/user.webpd.php');
$titleImg = "title_37";
break;
//You can add more page here.....
}
}
function _char_select_empty(){
if($_POST[$this->inputs[0]]!="-1"){
return true;
}
return false;
}
function _school_select_empty(){
if($_POST[$this->inputs[3]]!="-1"){
return true;
}
return false;
}
function _update_rb_lvl_exp($db,$id){
global $_config;
$rb_res = $db->Execute('update rangame1.dbo.chainfo set '.$_config['ucp_rb_col'].'='.$_config['ucp_rb_col'].'+?, ChaLevel = ?, chaexp = ? where chanum = ?',array('1','1','0',$id));
if($rb_res){
return true;
}
return false;
}
function _charge_gold($db,$id,$cost){
$gold_res = $db->Execute('update rangame1.dbo.chainfo set ChaMoney = ChaMoney - ? where chanum = ?',array($cost,$id));
if($gold_res){
return true;
}
return false;
}
function resetRbStats($db,$id){
$char_res = $db->Execute('Update RanGame1.dbo.ChaInfo set ChaPower=?,ChaStrong=?,ChaStrength=?,ChaSpirit=?,ChaDex=?,ChaStRemain=? where chanum = ?',array(0,0,0,0,0,0,$id));
if($char_res){
return true;
}
return false;
}
function _update_rb_stats($db,$cid,$stats,$rev=false){
if($rev==true){
$stn_res = $db->Execute('update rangame1.dbo.chainfo set ChaStRemain = ChaStRemain + ? where chanum = ?',array($stats,$cid));
}else{
$stn_res = $db->Execute('update rangame1.dbo.chainfo set ChaStRemain = ? where chanum = ?',array($stats,$cid));
}
if($stn_res){
return true;
}
return false;
}
function _char_list(){
global $db,$auth;
$char_list = $db->Execute("SELECT UserNum,ChaNum,ChaName FROM RanGame1.dbo.ChaInfo Where ChaDeleted!=1 And UserNum = ?",array($auth['UserNum']));
if($char_list->EOF)
echo '';
foreach ($char_list as $char => $c) {
$temp_c = 'if(clean_variable($_POST[$this->inputs[0]])==$c["chanum"]){
$temp_c.= 'selected="selected" ';
}
$temp_c.= 'value="'.$c["chanum"].'">';
$temp_c.= $c["chaname"];
$temp_c.= '';
echo $temp_c;
}
}
}
$char_func = new char_do;
?>
在这里调用 为什么无法输出?
------解决方案--------------------
$titleImg,作用域
------解决方案--------------------
$titleImg 在 function char_do 中定义,并未声明为全局变量
只有 global $do,$db,$auth,$_config;
所以无法在外部访问
相关文章
相关视频
推荐阅读
-
大家帮忙看一下这段简单的代码哪里有问题
-
我的xampp到底哪里出了问题啊。请各位大神帮帮忙啊
-
很简单的一个insert有关问题,但是就是有有关问题,请大家帮忙看看到底哪里有有关问题
-
最近遇到个比较诡异的有关问题,麻烦大家帮忙看下,有哪里遇到过,多谢
-
php文件上传有关问题--各位大侠帮忙看一下
-
最近遇到个比较诡异的有关问题,麻烦大家帮忙看下,有哪里遇到过,多谢
-
php文件上传有关问题--各位大侠帮忙看一下
-
小弟我的xampp到底哪里出了有关问题啊请各位大神帮帮忙
-
很简单的一个insert有关问题,但是就是有有关问题,请大家帮忙看看到底哪里有有关问题
-
中文乱码有关问题:帮忙看一下是哪里出错了,多谢了