This is a multi-part message in MIME format.
--------------5E7A00402463F03613E08A7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I've got a CGI program I wrote in "C". It's not very good,
but it works for our purposes. Anyway, when we run it
as a stand-alone compiled application it runs just fine and
produces the desired results (mail gets transported over to
where it's supposed to go, with the correct info in it).
However, when we slap this program into the Action field of
a webpage (see http://paradigm.uor.edu/socal-raves/crank.html )
and run it that way, no mail ever gets sent, yet the program
runs normally (kicking up the desired response page).
The source code is attached, though I don't know if that's
where the problem is...
If anyone can help, it would be greatly appreciated!
- Chris
--
----------------------------------------------------------------
"Master Linus... Is the dark side stronger?"
"No! no... quicker, easier... more seductive."
--------------5E7A00402463F03613E08A7
Content-Type: text/plain; charset=us-ascii; name="mail.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="mail.c"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
void main()
{
FILE *mailfile;
char input[800]; // The data input from the form.
char pid[10], filename[20]="tmpMailCGI.";
double my_pid;
gets(input); // Read from STDIN (the POST method)
my_pid = getpid(); // find out what process # we are (used later)
for(int i=0; i<=strlen(input);i++) // Convert simple forms
{ // into slighntly more
switch(input[i]) // readable text
{
case '&':
input[i] = '\n';
break;
case '+':
input[i] = ' ';
break;
default:
;
}
}
sprintf(pid, "%.2f", my_pid); // Convert number (my_pid_ to string
strcat(filename, pid); // And add the PID to the filename
// (assures unique filenames in
// multiuser environment)
mailfile=fopen(filename, "w"); // Store the input into a file
fprintf(mailfile, "%s", input);
fprintf(mailfile, "\n\nBy sending this email message I agree to the following statement:\n\n");
fprintf(mailfile, "I am not a member of a law enforcement agency, nor am I working with any members of any law enforcment agency. None of the information I obtain at the socal-raves website hosted on paradigm.uor.edu will be passed along to any law enforcement agency.");
fclose(mailfile);
strcat(system_call, filename); // Setup the system call to mail it
system(system_call); // Mail the file to the maintainer
remove(filename); // delete the file (no longer needed)
printf("Content-type: text/html\n\n");
printf("<html>\n<head><title>Thanks!</title></head>\n");
printf("<body bgcolor=#ffffff text=#000000><b>");
printf("Thanks! Your information has been sent to the proper ");
printf("persons; you should see confirmation in your mailbox in ");
printf("next day or so...");
printf("<p><a href=/socal-raves>Return to the Socal Raves page</a>");
--------------5E7A00402463F03613E08A7--Quote:}