Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old June 1st, 2000, 07:29 PM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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?


Reply With Quote
  #2  
Old June 2nd, 2000, 05:33 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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..."

Reply With Quote
  #3  
Old June 2nd, 2000, 06:35 AM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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"

Reply With Quote
  #4  
Old June 2nd, 2000, 06:42 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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).]

Reply With Quote
  #5  
Old June 2nd, 2000, 07:49 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan


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..."

Reply With Quote
  #6  
Old June 2nd, 2000, 08:24 AM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Thanks, that's it !

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Passing variable with SSI


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway