www.pudn.com > openwebspiderv0.1a.zip > openwebspidercgi-0.1.c
/* OpenWebSpiderCgiV0.1a (Little example) * * Coded by Shen139 * shen139 [at] eviltime (dot) com * * Compile with * - Linux: gcc -g -Wall -o openwebspider.cgi openwebspidercgi-0.1.c -L /usr/local/mysql/lib/ -lmysqlclient -lnsl -lm * * Tested under linux with Apache 1.3.29 and under windows with Apache 2.0.50 * */ #define CGI #include#include #include "../options.h" #include "../sqlfnct.h" #include "../misc.h" #include "../ndzlist.h" #define AUTHOR Shen139 #define VERSION "0.1a" //You must change this values #define MYSQLHOST "localhost" #define MYSQLUSER "user" #define MYSQLPASSWORD "password" #define MYSQLDB "spiderdb" int main(void) { char data[MAXINPUTSIZE]; char input[MAXINPUTSIZE]; long len; char *inputlen; MYSQL mysql; MYSQL_RES result; printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10); printf("\n\n OpenWebSpiderCgi \n\n\r\n"); printf("OpenWebSpiderCgi (TesT)
"); inputlen = getenv("CONTENT_LENGTH"); if(inputlen == NULL || sscanf(inputlen,"%ld",&len)!=1 || len > MAXINPUTSIZE) { if(sqlConnect(MYSQLHOST, MYSQLUSER, MYSQLPASSWORD, MYSQLDB , &mysql)==0) { printf("Failed to connect to database: %s\r\n",mysql_error(&mysql)); return 0; } printf("
",MAXINPUTSIZE); sqlSendSqlQuery(&mysql, "SELECT urlid FROM urllist", &result); printf("Indicized urls: %i", (int)mysql_num_rows(&result)); sqlSendSqlQuery(&mysql, "SELECT wordid FROM wordlist", &result); printf(" Indicized words: %i\r\n", (int)mysql_num_rows(&result)); printf("
last public release: http://sourceforge.net/projects/openwebspider/"); printf("
shen139(at)eviltime(dot)com\r\n