search
HomeBackend DevelopmentPHP Tutorial帮忙看下一个php文件,没有效果,不知道错哪了

帮忙看下一个php文件,没有效果,不知道哪里错了
通过http://127.0.0.1/index.php?id=2的形式访问,以下是index.php的代码
数据库都是正确架构了的.但是有访问以后无法添加到数据库里面,
这个文件是一个推广的php文件,就是通过上面的地址访问以后会增加uid为2的用户积分.请人帮忙看下哪里错误了,先谢谢了

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phprequire_once (dirname(__FILE__) . "/include/common.inc.php");require_once DEDEINC."/arc.partview.class.php";if(empty($id)) {//检测是否使用ID推广,括号1//检测不到有ID 就执行 检测Uif(empty($u)) {//检测是否使用U推广,括号1//检测不到ID和U推广,就执行官方原来的$GLOBALS['_arclistEnv'] = 'index';$row = $dsql->GetOne("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?><div class="clear">
                 
              
              
        
            </div>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Performance Tuning for High Traffic WebsitesPHP Performance Tuning for High Traffic WebsitesMay 14, 2025 am 12:13 AM

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

Dependency Injection in PHP: Code Examples for BeginnersDependency Injection in PHP: Code Examples for BeginnersMay 14, 2025 am 12:08 AM

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

PHP Performance: is it possible to optimize the application?PHP Performance: is it possible to optimize the application?May 14, 2025 am 12:04 AM

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

PHP Performance Optimization: The Ultimate GuidePHP Performance Optimization: The Ultimate GuideMay 14, 2025 am 12:02 AM

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),