About the code of the Ucenter communication process! CSDN great Gods! Admiring! Please give me more advice

Source: Internet
Author: User
Tags keyword list testlink
For help with the code of the Ucenter communication process! CSDN great Gods! Admiring! Please give me more advice!
Debugging Ucenter in the/control/admin/app.php encountered such a piece of code
if ($app [' Extra '] [' AppPath '] && @include $app [' Extra '] [' AppPath ']. /api/'. $app [' Apifilename '])
{
Code
}
Is this if the include file is the result of execution or the file itself, or simply return a ture or false?
The include comes in a. php file.
Split Line----------------------------------------------------------------------------------------------------------------
Run the Onping function in the following file



function onping () {
$ip = GETGPC (' IP ');
$url = GETGPC (' url ');
$appid = Intval (GETGPC (' AppID '));
$app = $_env[' app ']->get_app_by_appid ($appid);
$status = ";
if ($app [' Extra '] [' AppPath '] && @include $app [' Extra '] [' AppPath ']. /api/'. $app [' Apifilename ']) {
Echo ' in if= '. $app [' Extra '] [' AppPath ']. /api/'. $app [' Apifilename '];
$uc _note = new Uc_note ();
$status = $uc _note->test ($note [' GetData '], $note [' postdata ']);
} else {
Echo ' in Else ';
$this->load (' note ');
$url = $_env[' Note ']->get_url_code (' Test ', ' ', $appid);
$status = $_env[' app ']->test_api ($url, $IP);
}
if ($status = = ' 1 ') {
echo ' document.getElementById (\ ' Status_ '. $appid. ' \ '). InnerHTML = "'. $this->lang[' App_connent_ok '). '"; Testlink ();";
} else {
echo ' document.getElementById (\ ' Status_ '. $appid. ' \ '). InnerHTML = "'. $this->lang[' App_connent_false '). '"; Testlink ();";
}

}

?>



include $app [' Extra '] [' AppPath ']. /api/'. $app [' apifilename '] This file is the uc.php file in the other directory, the front code is as follows! This file is UTF8 version of the HDwiki5.1 comes with!



error_reporting (0);

Define (' uc_client_version ', ' 1.5.1 ');
Define (' Uc_client_release ', ' 20100501 ');

Define (' Api_deleteuser ', 1);//user Delete API
Define (' Api_renameuser ', 1); User renaming API
Define (' Api_gettag ', 1); Get tag API
Define (' Api_synlogin ', 1); Synchronous Login API
Define (' Api_synlogout ', 1); Sync Log Out API
Define (' API_UPDATEPW ', 1); change user Password
Define (' Api_updatebadwords ', 1); Update keyword list
Define (' Api_updatehosts ', 1); Update Domain name resolution cache
Define (' Api_updateapps ', 1); Update App List
Define (' Api_updateclient ', 1); Update Client Cache
Define (' Api_updatecredit ', 1); Update User points
Define (' Api_getcreditsettings ', 1); Provide integration settings to Ucenter
Define (' Api_getcredit ', 1); Get a user's points
Define (' Api_updatecreditsettings ', 1); Integration settings

Define (' Api_return_succeed ', ' 1 ');
Define (' api_return_failed ', '-1 ');
Define (' Api_return_forbidden ', '-2 ');

Define (' Hdwiki_root ', substr (DirName (__file__), 0,-4));
Define (' Uc_client_root ', hdwiki_root. /api/uc_client/');
Define (' MAGIC_QUOTES_GPC ', GET_MAGIC_QUOTES_GPC ());

Require_once Hdwiki_root. ' /api/ucconfig.inc.php ';

$get = $post = Array ();
$code = @$_get[' code ');
Parse_str (Authcode ($code, ' DECODE ', Uc_key), $get);
if (MAGIC_QUOTES_GPC) {
$get = _stripslashes ($get);
}
$timestamp = time ();
if (empty ($get)) {
Exit (' Invalid Request ');
}elseif ($timestamp-$get [' time '] > 3600) {
Exit (' authracation has expiried ');
}




So why did you output a ' Invalid Request? Is this the result of the output?
------Solution--------------------
For @include $app [' Extra '] [' AppPath ']. /api/'. $app [' Apifilename ']
When the file $app [' Extra '] [' AppPath ']. /api/'. $app [' apifilename '] when not present, against false
Returns 1 when present
This writing is absolutely no problem!

If there is a problem with your program, please find the reason in other places
------Solution--------------------
There must be content in the include, and you can see a lot of definitions from the clips you post?
You can certainly determine the existence of a file before you include
But isn't it simple to write? At least compile the device to analyze a statement less?
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.