New DirectAdmin Plugins and iFrames

youds

Verified User
Joined
Jul 11, 2008
Messages
490
Location
Lancashire, UK
Hi

I can see that DirectAdmin allows full screen display when accessing *.raw however I'm getting nothing back from Safari and Firefox is telling me using this URL is unsafe (even out of iframe), even though the rest of the sites work just fine.

So what is the protocol here? For instance:

- admin/index.html

This is fine. It is executable sweet to handle PHP

However with
- admin/output/folder/index.html

I can't access, under the same constraints. Why is this? Are sub folders in admin/* allowed? Put more simply, what is the expected filesystem layout of admin folder with internal links?

Kind regards
 
Ah, not so much luck this time. I have investigated (twice) and found that the following (with a PHP shebang) is not working:

Code:
#!/usr/local/bin/php
<?php header("HTTP/1.1 200 OK"); header("Content-Type: text/html"); ?>

That's the first 2 lines of my index.raw file. Please note; for anyone following this from Google, the problem with folders etc is quickly isolated when you notice admin as being the root folder. Hence all URL's must begin starting from folder admin.

Many thanks.
 
So I found this neat trick to make the text appear at the very least:

Code:
 -nc/usr/local/directadmin/plugins/custombuild/php.ini

Meaning the PHP shebang and header is as follows:

Code:
#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/custombuild/php.ini
<?php header("HTTP/1.1 200 OK"); header("Content-Type: text/html"); ?>...

Which gets you started. But other than that I can't make it display formed HTML; I only see the output of the script.

Any advice appreciated.
 
So stupid me, using header instead of echo. I thought it was a PHP issue (as it supports the header function) and used that by accident.

So, from my findings:

Code:
#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/custombuild/php.ini
<?php echo "HTTP/1.1 200 OK"; echo "Content-Type: text/html"; ?><!doctype...

Works perfectly. Thanks.
 
Sorry to raise another issue (as the thread name is quite generic) but I've a WTF with one of DirectAdmin features.

I'm accessing a script via ajax and am told (when viewed in separate tab) that DA requires referrer information and furthermore always returns a status code of 0 (not 200) when its state changes to 4, the final state. Hence; this script can not be run via AJAX methods.

Is there some way of calling scripts in DirectAdmin I should be aware of?

Kind regards
 
Hmm, strange. Message has disappeared but I can't seem to see why. Unfortunately though, the script still returns nothing from its contents. Even with a simple "Hello, World." example.

Very odd.
 
And again, if I run it from images folder it gives plain text back. Will continue to look into this.
 
So I've conformed to all the threads, features and help guides on this one and can't get the thing executing PHP code. Typically, I've wrote the plugin in php.

If anyone can help that would be great. Here's my setup:

admin/ajax/update-config.raw (+x perms ran as diradmin:diradmin) containing:
Code:
#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/custombuild/php.ini
<?php echo "HTTP/1.1 200 OK"; echo "Content-Type: text/html"; ?><?php 
echo "Hello, World"; ?>

All I see is the PHP code.Nothing is outputted from what the script should execute. Tried running the update-config.php script in images/ it displayed code again.

Any help greatly appreciated.

Kind regards
 
According to a HTTP specification

1. headers should be split from the main body with a help of an empty lines.
2. headers should be separated from each by a line break \n

The example from the suggested page https://www.directadmin.com/features.php?id=610 has it:

Code:
echo "HTTP/1.1 200 OK";
echo "Content-Type: text/html";
echo "";
echo "hello world<br>";

Another important difference with echo in bash and PHP:

in BASH:

echo "Hello";

will automatically print Hello\n

in PHP:

echo "Hello";

will print simply Hello

So you need to transform the code into:

PHP:
#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/custombuild/php.ini
<?
echo "HTTP/1.1 200 OK\n"; 
echo "Content-Type: text/html\n"; 
echo "\n"; 
echo "hello world<br>\n";

IMPORTANT: double-quotes, not single-quotes are used.
 
Back
Top