Jump to content

Admin_Output help


harry1

Recommended Posts

Hi all

Hoping for some guidance as to what I am doing wrong.

In my _output I've got:

echo file_get_contents(__DIR__ . '/data.php');

 

Then in that data.php, HTML + JS works perfectly however if I try do PHP from within the data.php it doesn't appear.

 

<?php

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}

$clientImport = "test";

print "test";


?>
<html>
    <head>
    </head>
    
    Domain: <input type="text" id="domain"><br><br>
    <?echo $clientImport; print "test";?>
    
    <body>

 

The HTML input box for domain is working, however none of the PHP print outs are working.

 

Interestingly, though, the first if statement works as it doesn't allow me to browse that data.php file directly. It results in the die error, so working as intended.

 

Hoping someone can clarify what I'm doing wrong? 

Thanks.

Link to comment
Share on other sites

I think my question is confusing - I'll try make a clearer explanation.

I'm making an Addon Module and the core use of it is in the admin output function.

function addontest_output()
{
	echo file_get_contents(__DIR__ . '/data.php');
}

I then have data.php. I'm trying to use PHP from within this data.php with no success. However, the first line works as if I browse the file directly, I get the "This file cannot be accessed directly" error. No PHP used in the data.php works, except for the first if statement.

<?php

$test = "Test";

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}

?>

<html>
    <head>
    </head>
    <body>
        <p>Testing</p>
        <?php print "Test"; echo $test; ?>
	</body>
</html>

 

Hopefully this is more clear?

 

Cheers

Edited by harry1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated