帮忙看下一个php文件,没有效果,不知道哪里错了
通过http://127.0.0.1/index.php?id=2的形式访问,以下是index.php的代码
数据库都是正确架构了的.但是有访问以后无法添加到数据库里面,
这个文件是一个推广的php文件,就是通过上面的地址访问以后会增加uid为2的用户积分.请人帮忙看下哪里错误了,先谢谢了
php codegetone(select * from `#@__homepageset`);$row['templet'] = mftemplet($row['templet']);$pv = new partview();$pv->settemplet($cfg_basedir . $cfg_templets_dir . / . $row['templet']);$pv->display();}//检测是否使用u推广,括号2else{//检测是否使用u推广,括号3//检测ip开始//*************************************************if ($_server[http_x_forwarded_for]) {if ($_server[http_client_ip]) {$proxy = $_server[http_client_ip];} else {$proxy = $_server[remote_addr];}$ip = $_server[http_x_forwarded_for];} else {if ($_server[http_client_ip]) {$ip = $_server[http_client_ip];} else {$ip = $_server[remote_addr];}}//检测ip结束//*************************************************if (isset($proxy)) { //判断是否有代理ip,括号1showmsg(请不要使用代理ip!, 'index.php'); //检测到使用代理ip提示,结束} //检测到使用代理ip提示,括号2else//判断是否有代理ip 否则执行下面{ //判断是否有代理ip,括号3//写入数据开始$sql = select * from #@__tgreg where username='$u'; //读取tgreg数据表,条件userid=网址id?=***$nic_arcrow = $dsql->getone($sql); //成立的条件,一条数据$userid =$nic_arcrow['userid']; //输出tgreg数据表中的username值$username =$nic_arcrow['username']; //输出tgreg数据表中的username值$row = $dsql->getone(select * from `#@__tgip` where userid='$userid' or username='$username' and tgip like '$ip' );//读取数据,检测ip使用过了吗if(is_array($row)) //检测重复就执行下面 {//检测重复就执行下面 括号1 header('location:index.php');//检测重复ip就执行跳转index.php exit(); }//检测重复就执行下面 括号2 结束if(empty($username)) //检测用户空,就跳转index.php{ //检测用户空 括号1 header('location:index.php');//就跳转index.phpexit;} //检测用户空 括号2 结束$tgip = $ip;//定义获取的ip地址$time =time();//获取当前时间$lailu =$_server['http_referer'];//获取来路$query = insert into `#@__tgip`(userid, username, time, tgip, lailu) values ('$userid', '$username', '$time', '$ip', '$lailu'); ;//写入数据//写入数据结束if($dsql->executenonequery($query)) //检测有写入就 {//检测有写入就 括号1//预留 这里要写一句获取后台设定的数字,给jifena使用 以后就不用手工了$jifena =100; //手工 设置jifena推荐一个增加多少积分//预留 $jifenb =100;//设置jifenb推荐一个增加多少积分//$dsql->executenonequery(update `#@__member` set `scores`= scores + $jifena where mid='.$userid.' );//sql执行写入用户加积分//上面这句例子直接更新用户资料 加100积分,更新用户表 member//die($dsql);$dsql->executenonequery(update `#@__tgreg` set `jifena`=jifena + $jifena ,`cishu`=cishu+1 where userid='.$userid.' and username='.$username.' );//sql执行写入用户加积分// 上面这句更新推广人的积分制度jifena类。注意区分a类和b类 用户表tgreg//$dsql->executenonequery(update `#@__tgreg` set `jifenb`= jifenb + $jifenb where userid='.$userid.' and username='.$username.' );//sql执行写入用户加积分//预留 上面这句更新推广人的积分制度jifenb类。注意区分a类和b类 用户表tgreg header('location:index.php');//写入后也要跳转了 }//检测有写入就 括号2 exit();//检测重复ip 的退出}//判断是否有代理ip结束,括号4}//检测是否使用u推广结束,括号4 //----------------------}//检测是否使用id推广,括号2else{//检测是否使用id推广,括号3//----------------------//下面都是id推广部分//检测ip开始//*************************************************if ($_server[http_x_forwarded_for]) {if ($_server[http_client_ip]) {$proxy = $_server[http_client_ip];} else {$proxy = $_server[remote_addr];}$ip = $_server[http_x_forwarded_for];} else {if ($_server[http_client_ip]) {$ip = $_server[http_client_ip];} else {$ip = $_server[remote_addr];}}//检测ip结束//*************************************************if (isset($proxy)) { //判断是否有代理ip,括号1showmsg(请不要使用代理ip!, 'index.php'); //检测到使用代理ip提示,结束} //检测到使用代理ip提示,括号2else//判断是否有代理ip 否则执行下面{ //判断是否有代理ip,括号3//写入数据开始$sql = select * from #@__tgreg where userid='$id'; //读取tgreg数据表,条件userid=网址id?=***$nic_arcrow = $dsql->getone($sql); //成立的条件,一条数据$userid =$nic_arcrow['userid']; //输出tgreg数据表中的username值$username =$nic_arcrow['username']; //输出tgreg数据表中的username值$row = $dsql->getone(select * from `#@__tgip` where userid='$userid' or username='$username' and tgip like '$ip' );//读取数据,检测ip使用过了吗if(is_array($row)) //检测重复就执行下面 {//检测重复就执行下面 括号1 showmsg(重复ip!, 'index.php?id=3'); header('location:index.php');//检测重复ip就执行跳转index.php exit(); }//检测重复就执行下面 括号2 结束if(empty($username)) //检测用户空,就跳转index.php{ //检测用户空 括号1 header('location:index.php');//就跳转index.phpexit;} //检测用户空 括号2 结束$tgip = $ip;//定义获取的ip地址$time =time();//获取当前时间$lailu =$_server['http_referer'];//获取来路$query = insert into `#@__tgip`(userid, username, time, tgip, lailu) values ('$userid', '$username', '$time', '$ip', '$lailu'); ;//写入数据//写入数据结束if($dsql->executenonequery($query)) //检测有写入就 {//检测有写入就 括号1//预留 这里要写一句获取后台设定的数字,给jifena使用 以后就不用手工了$jifena =100; //手工 设置jifena推荐一个增加多少积分//预留 $jifenb =100;//设置jifenb推荐一个增加多少积分//$dsql->executenonequery(update `#@__member` set `scores`= scores + $jifena where mid='.$userid.' );//sql执行写入用户加积分//上面这句例子直接更新用户资料 加100积分,更新用户表 member//die($dsql);$dsql->executenonequery(update `#@__tgreg` set `jifena`=jifena + $jifena ,`cishu`=cishu+1 where userid='.$userid.' and username='.$username.' );//sql执行写入用户加积分// 上面这句更新推广人的积分制度jifena类。注意区分a类和b类 用户表tgreg//$dsql->executenonequery(update `#@__tgreg` set `jifenb`= jifenb + $jifenb where userid='.$userid.' and username='.$username.' );//sql执行写入用户加积分//预留 上面这句更新推广人的积分制度jifenb类。注意区分a类和b类 用户表tgreg header('location:index.php');//写入后也要跳转了 }//检测有写入就 括号2 exit();//检测重复ip 的退出}//判断是否有代理ip结束,括号4}//检测是否使用id推广结束,括号4?>