transferring variable / hiding php-file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mikko

    transferring variable / hiding php-file



    I would like to do this

    html/file1.php
    cgi-bin/file2.php


    it is called:
    file1.php$c1=so mething

    file1.php is:
    <?
    include "/cgi-bin/file2.php?c1=$c 1"
    ?>


    But it gives:
    Warning: main(/cgi-bin/file2.php?c1=12 34): failed to open stream: No such
    file or directory

    Seems its looking for file "/cgi-bin/file2.php?c1=12 34", instead of calling
    file /cgi-bin/file2.php with variable c1=1234

    What am I doing wrong?


    What I'm trying to do, at the moment there is just one .php file,
    html/file1.php which includes sql-password.

    So instead of file1.php (with sql-password) being in /html

    I would like file1 just call file2.php in cgi-bin, so if there is some
    problem with php, people would only see
    <?
    include "/cgi-bin/file2.php?c1=$c 1"
    ?>

    instead of sql-password. And file2.php including password would be in
    protected directory, not visible to net.

    Am I trying the right thing?


    Im not sure if file1.php should run include, exec, or something else?

    The real code (that im trying to move to file2.php) uses echo:s to make a
    html-page

    Does it work like that, or do i need to use some return, to return the page
    from file2 to file1, and only file1 to echo it?


Working...