[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: could we use c replace perl in cgi program?





David Z Maze wrote:
eric lin <fsshl@centurytel.net> writes:

Dear advanced webprogramers or linuxer:

  Could we using c replace perl in cgi programming?


Sure, nothing's intrinsically tied to Perl at all.  Look at
http://hoohoo.ncsa.uiuc.edu/cgi/overview.html for the CGI
specification, including a listing of the environment variables that
could be set.


I tried a simple c program(although it not compile write)
to parse the name and value it inherate from visitor hit the submit form

------------------------------------------------

#include <stdio.h>

int main()
{
         extern char name[][];
         extern char value[][];


         printf("Content-type: text/html\n\n");
         printf("<html><body>\n");
         printf("the price fo ", name[1], " equal ", value[1], "\n");
         printf("</body></html>");
}

--------------------------------------------------------------


Well, sure, where do you expect name and value to actually be defined?
(I don't think 'extern' is allowed to modify local variables in any
case.)  You also might look for C CGI libraries if this would make you
happy; there seems to be a libcgicg1-dev package in unstable, which
appears to provide the right functionality.

may be after I install what you recommand's libcgicg1-dev package
it have test-cgi in my /usr/lib/cgi-bin/ so I change my /var/www/index.html's form point to it

<form method="POST"   action="http://www.linuxspice.com//cgi-bin/test-cgi";>

after I use my browser to hit the submit bottom, it show Forbidden

 You don't have permission to access //cgi-bin/test-cgi on this server.


Apache/1.3.26 Server at default.itsyourdomain.com Port 80

even I chmod 777 test-cgi

need advancer's advice




--
Sincere Eric
www.linuxspice.com
linux pc for sale



Reply to: