Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 创建whmcs 6提要以检查客户端是否已登录_Php_Mysql_Web_Whmcs - Fatal编程技术网

Php 创建whmcs 6提要以检查客户端是否已登录

Php 创建whmcs 6提要以检查客户端是否已登录,php,mysql,web,whmcs,Php,Mysql,Web,Whmcs,我正在尝试检查用户是否已登录,并显示whmcs文件夹外部的名字。我正在使用feed。我在feeds文件夹中创建了checkifloggedin.php <?php require("../init.php"); if (isset($_SESSION['uid'])) { /*i can get the the id of the user but i cannot display the first name of the logged in user. t

我正在尝试检查用户是否已登录,并显示whmcs文件夹外部的名字。我正在使用feed。我在feeds文件夹中创建了checkifloggedin.php

<?php
require("../init.php");    
if (isset($_SESSION['uid'])) {

    /*i can get the the id of the user but i cannot display the first
      name of the logged in user. tried several methods but i cannot
      make it work.*/

    widgetoutput();
    }
else {
    widgetoutput('logged out');
}

function widgetoutput($value) {
    echo "document.write('".addslashes($value)."');";
    exit;
}

?>

我认为您希望使用WHMCS平台的内部API:

在小部件代码中,您可能希望使用如下内容:

// Set Vars
$command = 'getclientsdetails';
$values = array( 'clientid' => $_SESSION['uid'], 'responsetype' => 'json', );
$adminuser = 'DemoAdmin';

// Call API
$results = localAPI($command, $values, $adminuser);
if ($results['result']!="success") {
    echo "An Error Occurred: ".$results['result'];
    exit;
}

$results = json_decode( $results );

那么$results应该包含您正在查找的用户信息。

我最近也在寻找同样的方法,发现自从以前对这个问题和类似问题的答复以来,许多文件名/路径都发生了更改。在我的配置中有一句话-我在公共场合设置了WHMCS\u html/WHMCS,用于所有实际用途。我的索引页面和其他一些页面(关于、术语等)都是公开的html(docroot)

我做的第一件事是在public_html中创建一个名为loggedin.php的文件,其中包含以下代码: