cgi

How can I check the MIME type of an uploaded file using Perl CGI?

I'm trying to get the MIME type of an <input type="file" /> element using Perl, but without actually examining the contents of the file itself, In other words, just using the HTTP headers. I have only been able to get the "multipart/form-type" Content-Type value, but my understanding is that each element will get its own MIME Type? How...

Can I redirect to a PHP page from a Perl CGI script?

I am working with a site that uses an outside source to work with payment transactions, one of the prerequisites is that on success a CGI script is called. What I am wanting to know is it possible to do a redirect to a PHP page with the CGI script and have the PHP detect that it has been loaded via a Perl redirect, I currently have this...

How can I send XML data from Perl CGI script?

I have no experience with CGI scripts or any web development. I'm developing a client app and just want to have a small CGI script to send and retrieve XML data to test out my client. Right now I'm doing a HTTP GET to get the XML files I need. Now I'm changing my client to do POST with request containing XML data and expecting XML back....

Why do I get a "Bad Gateway" error with my Perl CGI program on IIS?

I'm trying to run sample Perl script on Windows 7 and I configured IIS 7 to allow ActivePerl to run but I'm getting this error: HTTP Error 502.2 - Bad Gateway The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "Hello World. ". Module CgiModule Notification Execut...

I changed index.html to index.php and now the page doesn't load!

It gives me the following message: The requested URL /cgi-sys/php-cgiwrap/gcadmin/php5.cgi/projects/globalcolleage/index.php was not found on this server. Any suggestions? (I'm using WAMP) I think it has something to do with this hthaccess file: IndexIgnore * DirectoryIndex index.html index.HTML index.shtml index.cgi index.p...

Debug CGI by simulation

I basically want to debug a cgi programm with gdb by emulating the environment variables and stdin stream. How do I set the variables and stdin? I am using lampp and gdb. Thanks! ...

What are the differences between mod_php and cgi php script?

What are the differences between mod_php and cgi php script? I mean, why it's better (is it?) to use mod_php instead simple php scripts, running them as CGIs? Thanks ...

PHP script to replace cgi script

Hey, I have a CGI script that uses an old database driver that is no longer supported. Instead of struggling with this old cgi script, I thought it would be easier to rewrite it in php. It works now as a php script, but I need it to be served from the same web address. When a user accesses http://somesite.com/myscript.cgi, I want it to ...

How can I track down "Template process failed: undef error" in Perl's Template Toolkit?

I've moved a Perl CGI app from one web host to another. Everything's running fine except for Template Tookit which is giving the following error: "Template process failed: undef error - This shouldn't happen at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 314." The templates are working fine on the other web host. I've set the DEBUG_ALL flag ...

How to Implement Grep into CGI script Please?

Hi all! I am having difficulty figuring out how to implement grep into my CGI script. Basically I will receive a value of eg. 1500 from a HTML page. The CGI script then runs and compares 1500 to a text file. When it finds 1500 it prints the entire line and displays it on the webpage. I would like some tips and pointers on how to do ...

cgi.FieldStorage always empty - never returns POSTed form Data

This problem is probably embarrassingly simple. I'm trying to give python a spin. I thought a good way to start doing that would be to create a simple cgi script to process some form data and do some magic. My python script is executed properly by apache using mod_python, and will print out whatever I want it to print out. My only pro...

What C headers for directory traversal are process safe in Linux ?

I'm currently using dirent.h and ftw.h for directory traversal at my CGI website 100% programmed in C. I am not sure if they are process safe; would various users interfere with each other while on my site ? Which functions would you recommend for this purpose ? ...

Is there any documentation of functions in Mercurial cgi interface?

I am trying to get some information about the different pages served by the Mercurial cgi webpage. However I cannot find anything usefull. By accident I stumbled upon the raw-rev page. Anyone got some valid links to documentation? ...

Python handing of Web Forms

Hi, I am having some trouble generating a web form using fields specified in an ascii file. What I want to do is the following: 1) Read in the ascii file. This is of the form (can have N elements): Object1 value1 Object2 value2 Object3 value3 Object4 value4 ... 2) Generate a web form from the ascii file contents. Each line in the a...

Web form / CGI scripting: User enters "word", IFrame displays "word".html

Okay, I'll admit being a designer, I don't know much about how data is handled from the servers in forms... (basically the whole programming part). Basically I have a text field that the user types something like "apple", this gets sent to the server and then displays the apple.html page that I have in a directory in an IFrame. If anyone...

Running commands though PHP/Perl scripts as a priviledged user on Linux.

Background: I am writing a script for a company that will allow users to create FTP accounts through a web interface. In the background, the script must run a bunch of commands: Add the user to the system (useradd) Open and edit various files mail the user via sendmail and a few other things... I'm basically looking for the most sec...

How do I get CGI.pm to output HTML5 instead of XHTML 1.0?

I'm having some trouble getting CGI.pm to output to HTML5 instead of XHTML 1.0 or HTML 4.01. When I try "HTML5" or "HTML 5" as the -dtd argument in start_html() I get a document in HTML 4. I've also tried importing :HTML5, but that doesn't seem to work either. Any advice? ...

Permission to access network drives when running Python CGI?

I have a Python script running on the default OSX webserver, stored in /Library/WebServer/CGI-Executables. That script spits out a list of files on a network drive using os.listdir. If I just execute this from the terminal, it works as expected, but when I try to access it through a browser (computer.local/cgi-bin/test.py), I get a perm...

Parent Thread exiting before Child Threads [python]

I'm using Python in a webapp (CGI for testing, FastCGI for production) that needs to send an occasional email (when a user registers or something else important happens). Since communicating with an SMTP server takes a long time, I'd like to spawn a thread for the mail function so that the rest of the app can finish up the request witho...

PHP: testing two double-variables gives different result without changing the variables

Dear All, in my code i have two double values. Lets call them $a and $b. now I want to test which one of them is larger, so I wrote the following: print ($a > $b ? "larger\n" : "smaller\n"); print ($a > $b ? "larger\n" : "smaller\n"); strangely the result is larger smaller does anybody encountered a similar problem before? This pr...