cgi

How can I use the value of a JQuery/Javascript variable in a Perl script?

与世无争的帅哥 提交于 2019-12-24 13:52:56
问题 I am a complete newbie to Perl & Javascript/Jquery/Ajax. As an example, I'd like to send the string var exampleString to test.pl, and the script will then write the string to file. function sendToScript{ var exampleString = 'this is a string'; $.ajax({ url: './test.pl', data: exampleString, success: function(data, textStatus, jqXHR) { alert('string saved to file'); } } test.pl #!/usr/bin/perl -w use strict; #How do I grab exampleString and set it to $string? open (FILE, ">", "./text.txt") ||

Schedule a python script to run on webserver

巧了我就是萌 提交于 2019-12-24 12:42:07
问题 I am in the process of writing a Python script, that I will want to run automatically, say every evening. I intend to run it from server, partly because I have one so I may as well as it's always on, but also to learn how to do it, and this may at some point end up as a more full 'web app' - for now though it's just reading some data, and sending an email. Solutions I've come across have ranged from cgi, wsgi, to 'microframeworks'. I'm also loosely aware of Django (is that a 'microframework'?

Iterate through a list in a CGI file and print out values in html

倾然丶 夕夏残阳落幕 提交于 2019-12-24 11:04:24
问题 I have two list in a cgi file: Numbers = [0, 1, 2, 3] Letters = [A, B, C, D] How do I iterate through these list and print the values out in html I ideally my table would look like this: 0 A 1 B 2 C 3 D and etc. That means the tables and rows will have to be dictated by how long my list is and how many list I have. Thus I also would need to know how to iterate through the list and create the table in html script as I iterate through the list. I have done this so far: print''' <html> <head> <

How to enable/disable multiple submit buttons on a form depending on selection of a radio button

守給你的承諾、 提交于 2019-12-24 11:02:46
问题 I have a form that lists all the milestones in a project. The form has two submit buttons. One displays the tasks in the milestone. The other submit button is supposed to execute a script to generate a burndown chart for the selected button. Here is what I want to do When the page loads and no milestone is selected, both the submit buttons are disabled — This is achieved. When the user selects any milestone, both the submit buttons get activated - I need help with this. I know how to link

How to completely background a process in Perl CGI under IIS

爱⌒轻易说出口 提交于 2019-12-24 10:59:49
问题 Thanks to some other great posts here (like this and that), I have several reliable methods to background a process in a Perl script. However, in my environment (IIS6 on Windows Server 2003), it doesn't seem to completely background. Take this script: use CGI::Pretty qw(:standard); print header; print start_html; print "hi<br>"; system(1,qw(sleep 10)); print "bye"; print end_html; The browser will stay "connected" for 10 seconds while the sleep process runs. "hi" and "bye" will both be

Automatically connect to a CGI process and break in GDB before it exits?

倖福魔咒の 提交于 2019-12-24 10:49:01
问题 For a C application accessed via CGI-BIN, documentation online for accessing the process and breaking in GDB relies on manipulating the source code (i.e. adding an infinite loop), in order for the process to be available long enough for a developer to attach, exit the loop, and debug. Is it feasible that a tool could monitor the process list, and attach via GDB, immediately breaking in order for a developer to achieve this without requiring source code changes ? The rough structure of what I

PHP CGI replaces name of called file in command line exec calls, causing infinite loop

一曲冷凌霜 提交于 2019-12-24 10:45:09
问题 I'm transfering an application to a new server. The application uses command line calls, and the new server runs PHP as CGI/FastCGI. Problem: The script that gets executed on command line is not the file mentioned in the exec command, but the calling file itself. The application uses exec() to run scripts on the command line. Entire code of calling_script.php (scaled down from actual application to demonstrate the issue) is: <? echo __FILE__; $test = 1; shell_exec("/usr/bin/php /path/called

Running python script from Web browser, CGI not working

时间秒杀一切 提交于 2019-12-24 09:31:32
问题 I cannot figure out how to get my python script to run from a web browser. I believe it might be because I am not configuring my Apache2 server correctly for CGI, but I am not 100% sure. I have created a test.py python script and made it an executable with chmod though whenever I try to run the script from the web browser (myipaddres/path-to-python-script/test.py), only the text of the python script shows up. This is what the web page looks like when I execute "myIPaddress/path-to-script/test

Apache 2.2 CGI perl timeouts, still times out even with periodic prints

随声附和 提交于 2019-12-24 09:14:52
问题 I have a cgi code that is being called by AJAX from clientside javascript. However, the result of the call is discarded by the client. On the backend this code occurs: $|=1; my $i = 0; while (<$fh_echo>) { #To prevent apache timing out the cgi script. print "." if $i % 100 == 0; #Do stuff $i++; } Despite the periodic print out, this still times out: [warn] [client 10.23.12.87] Timeout waiting for output from CGI script [error] [client 10.23.12.87] (70007)The timeout specified has expired: ap

Why is this Perl CGI script failing to upload images correctly?

假如想象 提交于 2019-12-24 08:51:26
问题 I have this code: use CGI; use File::Basename; use Image::Magick; use Time::HiRes qw(gettimeofday); my $query = new CGI; my $upload_dir = "../images"; #location on our server my $filename=$query->param("img"); my $timestamp = int (gettimeofday * 1000); my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' ); $filename = $name ."_".$timestamp. $extension; #upload the image my $upload_filehandle =$query->param("img"); open ( UPLOADFILE, ">$upload_dir/$filename" ) or die "$!"; binmode