用户名: 密码: 忘记密码? 注册
收藏此问题 发表新评论

急,求帮忙修改个PHP文件

求帮忙修改个PHP文件

这个文件好像是靠cookie来记录推广者的,现在的情况是:比如别人要推广phpchina.com,那只有它的推广链接是****.phpchina.com这种形式的,才会被记录;

请帮忙修改成phpchina.com?u=**** 这种形式的;

文件在360盘:http://yunpan.cn/QeXXSVhVEEPmS​

先谢谢了


昵称: love22  时间: 2013-06-20 11:52:43
都 打 不开,直接发代码不就可以了
昵称: 大水车  时间: 2013-06-20 13:31:43
代码
<?php
error_reporting(E_ALL ^ E_NOTICE);
date_default_timezone_set('PRC');
header('Content-Type: text/html; charset=utf-8');

//改写不安全的register_global和防sql注入处理
if (@ini_get('register_globals')) {
        foreach($_REQUEST as $name => $value){unset($$name);}
}

//url路由配置
$module = $mod = $act = 'index';

$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);
$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);

if ($_SERVER['PATH_INFO']) {
        $module = 'index';
        $_pathinfo = explode('/', str_ireplace('.html', '', trim($_SERVER['PATH_INFO'], '/')));

        $mod = $_pathinfo[0] ? $_pathinfo[0] : $mod;
        $act = $_pathinfo[1] ? $_pathinfo[1] : $act;

        if ($_pathinfo[1]) {
                $querystr = explode('-', $_pathinfo[1]);
                $querystr[0] && $act = $querystr[0];
                //预设3个参数值
                $querystr[1] && $_g_urlarg[1] = $querystr[1];
                $querystr[2] && $_g_urlarg[2] = $querystr[2];
                $querystr[3] && $_g_urlarg[3] = $querystr[3];
        }
}
else {
        $module = basename($_SERVER['SCRIPT_NAME'], '.php');
}



include(dirname(__FILE__).'/config.php');

//#################=====定义全局路径=====#################//
$pe['host_root'] = 'http://'.str_ireplace(rtrim(str_replace('\\','/',$_SERVER['DOCUMENT_ROOT']), '/'), $_SERVER['HTTP_HOST'], str_replace('\\', '/', dirname(__FILE__))).'/';
$pe['path_root'] = str_replace('\\','/',dirname(__FILE__)).'/';
//#################=====包含常用类-函数文件=====#################//

$cache_setting = cache::get('setting');
//#################=====整合相关设置=====#################//
define('WP_SITE','http://'.$pe['wp_site'].'/');
define('CPS_SITE','http://'.$pe['cps_site'].'/');
define('PAY_SITE',$pe['host_root']);
define('TIME',time());

$pe['host_tpl'] = "{$pe['host_root']}template/{$cache_setting['web_tpl']['setting_value']}/{$module}/";
$pe['path_tpl'] = "{$pe['path_root']}template/{$cache_setting['web_tpl']['setting_value']}/{$module}/";
if (get_magic_quotes_gpc()) {
        !empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
        !empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
}
else {
        !empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');
        !empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');
}

session_start();
!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');
!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');

//连接数据库开始吧
$db = new db($pe['db_host'], $pe['db_user'], $pe['db_pw'], $pe['db_name'], $pe['db_coding']);


//二级域名记录cookie并跳转
$cache_package = cache::get('package');
if (stripos($pe['host_root'], $pe['domain_mark']) === false) {//解析绑定其他域名
        foreach ($cache_package as $k => $v) {
                if (stripos($pe['host_root'], $v['package_domainmark']) !== false) {
                        $domain_mark = $v['package_domainmark'];
                        break;
                }
        }
}
else {
        $domain_mark = $pe['domain_mark'];
}
$domain_pos = stripos($pe['host_root'], $domain_mark);
$domain_sub = substr($pe['host_root'], 7, $domain_pos-8);

if ($domain_sub != 'www' && !empty($domain_sub) && $domain_pos != 7) {
        setcookie('domain_sub', $domain_sub, 0, '/');
        //$url_now = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
        //pe_goto(str_ireplace("{$domain_sub}.{$pe['domain_mark']}", "{$pe['domain_mark']}", $url_now));
}


/*
//推广用户名放url参数里记录cookie并跳转
if(isset($_GET['u']) && !empty($_GET['u']))
{
        $domain_sub = pe_dbhold($_g_u);
        setcookie('domain_sub', $domain_sub, 0, '/');//记录推荐人用户名
}
*/

if (in_array($module, array('index', 'admin'))) {
//邮件群发计划任务
pe_lead('hook/qunfa.hook.php');
qunfa_emailtpl();
//套餐计划任务
$db->pe_update('packagelog', " and `packagelog_etime` <= '".time()."' and `packagelog_state`=1", "`packagelog_state`=0");
}
?>
昵称: love22  时间: 2013-06-20 13:47:22
发表评论
昵称:
内容:
验证: