Results 1 to 12 of 12

Thread: New DirectAdmin Plugins and iFrames

  1. #1
    Join Date
    Jul 2008
    Posts
    245

    New DirectAdmin Plugins and iFrames

    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
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  2. #2
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    7,795
    I think you're missing HTTP headers. Please check https://www.directadmin.com/features.php?id=610 for more information.
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  3. #3
    Join Date
    Jul 2008
    Posts
    245
    Quote Originally Posted by smtalk View Post
    I think you're missing HTTP headers. Please check https://www.directadmin.com/features.php?id=610 for more information.
    Awesome. Im glad you replied. Does Evolution theme give access to upload panels and the like using fancy tokens or such? Was wondering how extensible it is.

    Will update shortly, Id done for the day.
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  4. #4
    Join Date
    Jul 2008
    Posts
    245
    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.
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  5. #5
    Join Date
    Jul 2008
    Posts
    245
    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.
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  6. #6
    Join Date
    Jul 2008
    Posts
    245
    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.
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  7. #7
    Join Date
    Jul 2008
    Posts
    245
    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
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  8. #8
    Join Date
    Jul 2008
    Posts
    245
    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.
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  9. #9
    Join Date
    Jul 2008
    Posts
    245
    And again, if I run it from images folder it gives plain text back. Will continue to look into this.
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  10. #10
    Join Date
    Jul 2008
    Posts
    245
    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
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

  11. #11
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,354
    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 Code:
    #!/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.
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  12. #12
    Join Date
    Jul 2008
    Posts
    245
    Wow, such a basic principle - can't believe I missed it. Many thanks.
    Courtesy of Youds Media Ltd.

    DirectAdmin Plugin: Styled Default Pages for new customers; see this forum thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •