|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
I’m 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"--> I‘m 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
|
||||
|
||||
|
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..." |
|
#3
|
|||
|
|||
|
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.p.../warez/test.zip <!--#exec cmd="../cgi-bin/dm.pl?action=samojedan&file=http://upitnik.com/warez/test.zip"--> It should return number "0" |
|
#4
|
|||
|
|||
|
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).] |
|
#5
|
||||
|
||||
|
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..." |
|
#6
|
|||
|
|||
|
Thanks, that's it !
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Passing variable with SSI |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|