Return to Snippet

Revision: 18096
at September 22, 2009 21:01 by renatoelias


Initial Code
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
 
   char *data;
   long m,n;
    printf("%s%c%c\n",
                      "Content-Type:text/html;charset=iso-8859-1",13,10);
    printf("<TITLE>Multiplication results</TITLE>\n");
    printf("<H3>Multiplication results</H3>\n");
    data = getenv("QUERY_STRING");
    if(data == NULL)
      printf("<P>Error! Error in passing data from form to script.");
    else if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2)
      printf("<P>Error! Invalid data. Data must be numeric.");
    else
      printf("<P>The product of %ld and %ld is %ld.",m,n,m*n);

  return 0;
}

Initial URL
http://renatoelias.art.br/blog/2009/09/22/php-wrapper-cgi-usando-phpwine-para-rodar-cgi/

Initial Description
CGI

Initial Title
SIMPLE MULTIPLE CGI

Initial Tags
c

Initial Language
C