欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

各位大家帮忙看一下哪里出了有关问题

程序员文章站 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;

所以无法在外部访问
各位大家帮忙看一下哪里出了有关问题

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频