+ Reply to Thread
Results 1 to 6 of 6

Thread: Using whois.php as an include file

  1. Using whois.php as an include file

    Hi all, I am trying to integrate EP-Dev Whois into CMS Made Simple. My goal is to have a domain search form, results list with selection and then integrate into a website order form.

    To avoid complications, I am using a Smarty Tag to add an unmodified whois.php as an include into a CMS page. The form displays fine in the page, and the template has been modified (via admin) to point back to the same CMS page, but no results show up after the search. And no error messages. It just displays the search form again.

    The script is working fine stand-alone.

    I think what's happening is that the reload of the page after form post is not recognising that there is data to be displayed.

    Is there a switch or something I can use to get the included page to display the results? Using wrapper header and footer is not practical in my case because I want everything to stay inside the CMS.

    Any help appreciated.

    Tony

  2. Join Date
    Aug 2004
    Posts
    781

    Re: Using whois.php as an include file

    How are you including the page with smarty tags? Remember that the whois.php script MUST have access to the POST & GET variables, etc, for the page. That means that whois.php script needs to be parsed for PHP in the same context as your CMS. In other words, you cannot simply include the html of whois.php page, which is what occurs when you include the script with http://www.example.com/whois/whois.php .

    Instead, you must ensure that the whois script is being parsed as a PHP script during the parsing of the CMS script (that way POST & GET variables get to the whois script).

    I am not sure what needs to be done with your CMS to easily include this page. You may want to ask on their forums. I am sure the CMS has some ability to have custom modules, etc, and it would seem that you probably need similar functionality here.

  3. Re: Using whois.php as an include file

    Thanks for the reply. CMSMS allows inclusion of PHP as user-defined tags, usually by removing the <?php and ?> tags from the code. By doing this I was able to create a tag "whois" and include it into a CMS page as {whois} (smarty tag format). However, all it does is display the form and not the results, even though the POST is pointing at the same page.

    In any case, I have a reasonably satisfactory solution at this stage. I copied all of the CMS wrapper into the template header and footer and created a menu link to whois.php which seems to work reasonably well.

    But I would still like to know why the data did not get displayed. I am not strong on PHP, but when I was programming with ASP I usually included a variable in the post info that told the page it was processing the results and not the original form. Does the whois script have something like this in it?

    Tony

  4. Join Date
    Aug 2004
    Posts
    781

    Re: Using whois.php as an include file

    Quote Originally Posted by websupportguy

    But I would still like to know why the data did not get displayed. I am not strong on PHP, but when I was programming with ASP I usually included a variable in the post info that told the page it was processing the results and not the original form. Does the whois script have something like this in it?

    Tony
    I tried to explain this in my original post. It is likely one of two things is happening:
    a) The CMS is sanitizing all the form variables.
    - or -
    b) The smarty tag is including the page content. For example, the page is literally fetching itself. It would be as if you were to include google.com into your page. The server would be accessing itself through the webserver (i.e. opening a connection on port 80 to itself) and therefore the the POST, GET, etc would be on a different level.

    In terms of PHP code, (b) can be illustrated with:
    PHP Code:
    <?
    include("[url]http://www.example.com/somepage.php"[/url]); // wrong!

    include("/absolute/path/to/somepage.php"); // correct (linux)

    // or if you are on windows
    include("C:/absolute/path/to/somepage.php"); // correct (windows)

    ?>

    It is likely that the smarty template system is accessing the page via the first, incorrect, example. Try including this page with the system:
    PHP Code:
    <?
    echo "IP ADDRESS: " $_SERVER['REMOTE_ADDR'];
    ?>
    If the above file (when included through smarty templates) produces your own IP address on the page, then it is likely that (b) is NOT the problem. If, however, it produces either a local IP (127.0.0.1) or the server's IP address then you know that (b) is definitely your problem.

  5. Re: Using whois.php as an include file

    That script produces the server IP address (which is not actually the IP address of my domain, but the IP address of the shared hosting server).

  6. Join Date
    Aug 2004
    Posts
    781

    Re: Using whois.php as an include file

    Quote Originally Posted by websupportguy
    That script produces the server IP address (which is not actually the IP address of my domain, but the IP address of the shared hosting server).
    As I suspected, this is definitely your problem then... it is problem (b) from above. You need to inquire about this at the CMS's forums on how to include a page into the CMS that requires user-interaction (in particular forms) and php parsing. My guess is that you have to do it with some module type.

+ Reply to 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