#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    71
    Rep Power
    15
    Im trying to pass variable to my script using SSI.
    If I write: <!--#exec cgi="cgi-bin/news.cgi"--> I get the results, that scrip do by default back in my html.
    But If I write: <!--#exec cgi="cgi-bin/news.cgi?action=new&id=22"--> Im getting error on html in place where results should be.
    If I write same command in my browser like: www.mysite.com/cgi-bin/news.cgi?action=new&id=22 I would get results with no error.
    How can I pass these variables to script using SSI?

  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    I don't know whether ssi will process the directive with some arguments or not.

    I think we can't pass variable values with ssi.

    any way try with exec cmd directive also.

    <!--#exec cmd="cgi-bin/news.cgi?action=new&id=22"-->

    i tried the URL which you given...But it was showing the following message..(No cgi-bin access)


    Forbidden
    You don't have permission to access /cgi-bin/news.cgi on this server.





    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    71
    Rep Power
    15
    I gave that URL just as an example, to shorten writing.
    I tried to use what you proposed, but nothing appears on page
    The real URL and SSI line that I used is: http://www.upitnik.com/cgi-bin/dm.pl...warez/test.zip

    <!--#exec cmd="../cgi-bin/dm.pl?action=samojedan&file=http://upitnik.com/warez/test.zip"-->

    It should return number "0"
  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Try <!--#include virtual="cgi-bin/news.cgi?action=new&id=22"-->

    >>any way try with exec cmd directive also.
    When using with cmd, the full server path needs to be specify.

    <!--#exec cmd="/full/path/to/cgi-bin/news.cgi?action=new&id=22"-->

    #############################################
    Here is a quick example:

    1)url.txt (newline n is the delimiter)

    http://www.php.net/ http://www.apache.org/ http://www.perl.org/ http://www.devshed.com/

    2) url.html
    <html>
    <body>
    <!--#include virtual="news.cgi?action=new&id=2"-->
    </body>
    </html>

    3) news.cgi
    #!/usr/local/bin/perl

    if ($ENV{'QUERY_STRING'}) {
    @pairs = split(/&/, $ENV{'QUERY_STRING'});
    foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/<!--(.|n)*-->//g;
    $value =~ s/<([^>]|n)*>//g;
    $FORM{$name} = $value;
    }
    }
    else {
    print "Content-type: text/htmlnn";
    print "Unknown Request!n";
    exit;
    }
    if (($FORM{'action'} eq "new") && ($FORM{'id'} =~ /[0-9]/)) {
    open(FILE, "url.txt");
    @lines = <FILE>;
    close(FILE);
    chomp @lines;
    print "Content-type: text/htmlnn";
    print "<a href="$lines[$FORM{'id'}]">$lines[$FORM{'id'}]</a>n";
    exit;
    }
    else {
    print "Content-type: text/htmlnn";
    print "Invalid String!n";
    exit;
    }

    [This message has been edited by freebsd (edited June 02, 2000).]

    [This message has been edited by freebsd (edited June 02, 2000).]

    [This message has been edited by freebsd (edited June 02, 2000).]
  8. #5
  9. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15


    Try <!--#include virtual="cgi-bin/news.cgi?action=new&id=22"-->


    This will work fine!!!!

    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    71
    Rep Power
    15
    Thanks, that's it !

IMN logo majestic logo threadwatch logo seochat tools logo