本文整理汇总了C++中cgiHeaderContentType函数的典型用法代码示例。如果您正苦于以下问题:C++ cgiHeaderContentType函数的具体用法?C++ cgiHeaderContentType怎么用?C++ cgiHeaderContentType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cgiHeaderContentType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cgiMain
int cgiMain() {
FILE *fd = fopen(DATAFILE,"w");
char poststr[MAX_STRING];
char cmd_str[200] = "gcc -o ./user_home/a.out ";
int ret;
char * cgiHostAddr;
cgiHeaderContentType("text/html");
fprintf(cgiOut, "<HTML><HEAD>\n");
fprintf(cgiOut, "<TITLE>Code Confirm Page</TITLE>\n");
fprintf(cgiOut, "<link rel=\"stylesheet\" href=\"../remote.css\" type=\"text/css\" /></HEAD>");
fprintf(cgiOut, "<BODY>");
fprintf(cgiOut, "<h1>Welcom to Code Confirm Page</h1>");
fprintf(cgiOut, "<P>The Code You Submit Is:</p>");
cgiFormString("data", poststr, MAX_STRING);
fprintf(cgiOut, "<pre>%s</pre>",poststr);
fprintf(fd,"%s",poststr);
cgiGetenv(&cgiHostAddr, "HOST_ADDR");
fprintf(cgiOut, "<p>Your Host IP = %s</p>",cgiRemoteAddr);
printf("<hr/>");
fprintf(cgiOut, "<form action=\"run_handler.cgi\" method=\"get\">");
fprintf(cgiOut,"<div>");
fprintf(cgiOut,"<input type=\"submit\" value=\"Compile and Run\">");
fprintf(cgiOut,"</div>");
fprintf(cgiOut,"</form>");
fprintf(cgiOut, "</BODY>\n");
fprintf(cgiOut, "</HTML>\n");
close(fd);
return 0;
}
开发者ID:shenerguang,项目名称:ZyboRobot,代码行数:30,代码来源:post_handler.c
示例2: control_process
int control_process() {
char* buffer = NULL;
// 检查用户是否按下了按钮
if (cgiFormSubmitClicked("led1") == cgiFormSuccess) {
// 调用 led 1 控制代码
control_led(0);
} else if (cgiFormSubmitClicked("led2") == cgiFormSuccess) {
// 调用 led 2 控制代码
control_led(1);
} else if (cgiFormSubmitClicked("logout") == cgiFormSuccess) {
// 退出登录
session_destroy();
cgiHeaderLocation(cgiScriptName);
return 0;
}
// 输出 ContentType header
// 作为 CGI 程序必须输出这个 header,否则会导致 500 错误
fprintf(cgiOut, "Pragma: no-cache\n");
cgiHeaderContentType("text/html");
buffer = read_template(g_control_template);
if (buffer == NULL) {
fprintf(cgiOut, "Warning: Can't read template file: %s.<br />\n",
g_control_template);
return -1;
}
fprintf(cgiOut, "%s", buffer);
free(buffer);
return 0;
}
开发者ID:macrofengye,项目名称:cweb,代码行数:34,代码来源:sessiontest.c
示例3: cgiMain
int cgiMain()
{
int res=0;
char rfid[IEEE_LEN+1]={0};
int operatortype;
int duration;
char send_string[RF_RESPOND_TO_API_MAX_LEN]={0};
char respond_string[RF_RESPOND_TO_API_MAX_LEN]={0};
cgiFormResultType cgi_re;
cgiHeaderContentType("application/json"); //MIME
//获取rfid,state
cgi_re = cgiFormString("rfid", rfid, IEEE_LEN + 1);
cgi_re = cgiFormInteger("operatortype", &operatortype, -1);
cgi_re = cgiFormInteger("param1", &duration, -1);
rfid[IEEE_LEN]= '\0';
//communication with RF_Daemon
snprintf(send_string, RF_RESPOND_TO_API_MAX_LEN, "{\n \"api\": \"RFWarningDevOperation\",\n \"rfid\": \"%s\",\n \"operatortype\": %d,\n \"param1\": %d\n}", rfid,operatortype,duration);
RF_DEBUG("%s\n", send_string);
res = communicateWithRF(send_string, strlen(send_string)+1, respond_string);
// if(res !=0) {
fprintf(cgiOut,"{\n \"status\": %d\n}\n", res);
// }
// fprintf(cgiOut, "%s\n", respond_string);
return 0;
}
开发者ID:yanlunyao,项目名称:gateway,代码行数:31,代码来源:RFWarningDevOperation.c
示例4: cgiMain
/*
* api: http://192.168.1.227/cgi-bin/rest/network/CallUploadDataProgram.cgi?datatype=1
* */
int cgiMain()
{
cgiFormResultType cgi_re;
int res=0;
int datatype;
char cmdstring[100] = {0};
cgiHeaderContentType("application/json"); //MIME
cgi_re = cgiFormInteger("datatype", &datatype, -1);
if(datatype ==-1)
snprintf(cmdstring, sizeof(cmdstring), "%s", "/gl/bin/BaseDataUpload");
else
snprintf(cmdstring, sizeof(cmdstring), "%s %d", "/gl/bin/BaseDataUpload", datatype);
fflush(stdout);
pid_t pid;
if ((pid = fork()) > 0) { //parent process
}
else
{ //child process
//重定向输入输出流
freopen("/dev/null", "r", stdin);
freopen("/dev/null", "w", stdout);
freopen("/dev/null", "w", stderr);
system(cmdstring);
exit(0);
}
res =0;
api_response(res, datatype, cmdstring);
return 0;
}
开发者ID:yanlunyao,项目名称:gateway,代码行数:35,代码来源:callUploadDataProgram.c
示例5: cgiMain
int cgiMain() {
#ifdef DEBUG
LoadEnvironment();
#endif /* DEBUG */
/* Load a previously saved CGI scenario if that button
has been pressed. */
if (cgiFormSubmitClicked("loadenvironment") == cgiFormSuccess) {
LoadEnvironment();
}
/* Set any new cookie requested. Must be done *before*
outputting the content type. */
CookieSet();
/* Send the content type, letting the browser know this is HTML */
cgiHeaderContentType("text/html");
/* Top of the page */
fprintf(cgiOut, "<HTML><HEAD>\n");
fprintf(cgiOut, "<TITLE>cgic test</TITLE></HEAD>\n");
fprintf(cgiOut, "<BODY><H1>cgic test</H1>\n");
/* If a submit button has already been clicked, act on the
submission of the form. */
if ((cgiFormSubmitClicked("testcgic") == cgiFormSuccess) ||
cgiFormSubmitClicked("saveenvironment") == cgiFormSuccess)
{
HandleSubmit();
fprintf(cgiOut, "<hr>\n");
}
/* Now show the form */
ShowForm();
/* Finish up the page */
fprintf(cgiOut, "</BODY></HTML>\n");
return 0;
}
开发者ID:kkcloudy,项目名称:daemongroup,代码行数:32,代码来源:cgictest.c
示例6: htmlHeader
void htmlHeader(char *title) {
cgiHeaderContentType("text/html");
fprintf(cgiOut,"<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'> \r\n");
fprintf(cgiOut,"<html><head>\r\n");
fprintf(cgiOut,"<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>\r\n\r\n");
fprintf(cgiOut,"<TITLE>%s</TITLE></HEAD>",title);
}
开发者ID:Lichanglu,项目名称:enc_2000,代码行数:7,代码来源:htmllib.c
示例7: cgiMain
int cgiMain() {
cgiHeaderContentType("text/html;charset=gbk");
int n, f;
char txt1[32], txt2[32];
TMPL_varlist *mainlist, *vl;
TMPL_loop *loop;
TMPL_loop *persons;
loop = 0;
f = 1;
for (n = 1; n < 11; n++) {
sprintf(txt1, "%d", n);
sprintf(txt2, "%d", f *= n);
vl = TMPL_add_var(0, "n", txt1, "nfact", txt2, 0);
loop = TMPL_add_varlist(loop, vl);
}
for (n = 10; n < 21; n++) {
sprintf(txt1, "%d", n);
sprintf(txt2, "%d", f *= n);
vl = TMPL_add_var(0, "n1", txt1, "nfact1", txt2, "aa", "mmmm", 0);
persons = TMPL_add_varlist(persons, vl);
}
mainlist = TMPL_add_var(0, "title", "10 factorials", 0);
mainlist = TMPL_add_loop(mainlist, "fact", loop);
mainlist = TMPL_add_loop(mainlist, "person", persons);
TMPL_write("../resource/template/p1.html", 0, 0, mainlist, stdout, stderr);
TMPL_free_varlist(mainlist);
return 0;
}
开发者ID:xinzou,项目名称:cweb,代码行数:30,代码来源:test.c
示例8: cgiMain
int cgiMain(void){
cgiFilePtr file;
int targetFile;
mode_t mode;
char name[128];
char fileNameOnServer[64];
char contentType[1024];
char buffer[BufferLen];
char *tmpStr=NULL;
int size;
int got,t;
cgiHeaderContentType("text/html");
//取得html页面中file元素的值,应该是文件在客户机上的路径名
if (cgiFormFileName("file", name, sizeof(name)) !=cgiFormSuccess) {
fprintf(stderr,"could not retrieve filename\n");
goto FAIL;
}
cgiFormFileSize("file", &size);
//取得文件类型,不过本例中并未使用
cgiFormFileContentType("file", contentType, sizeof(contentType));
//目前文件存在于系统临时文件夹中,通常为/tmp,通过该命令打开临时文件。临时文件的名字与用户文件的名字不同,所以不能通过路径/tmp/userfilename的方式获得文件
if (cgiFormFileOpen("file", &file) != cgiFormSuccess) {
fprintf(stderr,"could not open the file\n");
goto FAIL;
}
t=-1;
//从路径名解析出用户文件名
while(1){
tmpStr=strstr(name+t+1,"\\");
if(NULL==tmpStr)
tmpStr=strstr(name+t+1,"/");//if "\\" is not path separator, try "/"
if(NULL!=tmpStr)
t=(int)(tmpStr-name);
else
break;
}
strcpy(fileNameOnServer,"/app/update/");
strcat(fileNameOnServer,name+t+1);
mode=S_IRWXU|S_IRGRP|S_IROTH;
//在当前目录下建立新的文件,第一个参数实际上是路径名,此处的含义是在cgi程序所在的目录(当前目录))建立新文件
targetFile=open(fileNameOnServer,O_RDWR|O_CREAT|O_TRUNC|O_APPEND,mode);
if(targetFile<0){
fprintf(stderr,"could not create the new file,%s\n",fileNameOnServer);
goto FAIL;
}
//从系统临时文件中读出文件内容,并放到刚创建的目标文件中
while (cgiFormFileRead(file, buffer, BufferLen, &got) ==cgiFormSuccess){
if(got>0)
write(targetFile,buffer,got);
}
cgiFormFileClose(file);
close(targetFile);
goto END;
FAIL:
fprintf(stderr,"Failed to upload");
return 1;
END:
printf("File \"%s\" has been uploaded",fileNameOnServer);
return 0;
}
开发者ID:blockey,项目名称:WebCgi,代码行数:60,代码来源:upload2.c
示例9: cgiMain
int cgiMain() {
char username[40]; //用户名
char value[20]; //中间值
long sessionId; //会话ID
char actName[20]; //请求动作
char result[4096]; //请求结果
char params[500]; //请求参数
actName[0]= NULL; //初始化
result[0] = NULL; //初始化
//解决中文乱码
cgiHeaderContentType("text/html; charset=UTF-8");
/* 获取参数 */
cgiFormString("username",username,40);
cgiFormString("sessionId",value,20);
sessionId = atol(value);
cgiFormString("actName",actName,20);
cgiFormString("params",params,500);
/* 检查session有效性 */
//会话无效
if(!isSessionValid(sessionId,username)){
//提示用户未登录或会话已过期
printf("NLogin");
return 0;
}
//会话有效
else{
//更新session访问时间
updateSessionService(sessionId);
}
/* 权限验证 */
//权限不足
if(!isAuthorityValid(actName,username)){
//提示权限不足
printf("NRight");
return 0;
}
/* 调用业务层处理请求 */
//请求处理成功
if(userServices(params,actName,result)){
//输出请求结果
printf(result);
}
//请求处理失败
else{
//输出系统出错信息
printf("actName=%s;result=false",actName);
}
return 0;
}
开发者ID:blockey,项目名称:WebCgi,代码行数:57,代码来源:getUserAction.c
示例10: cgiMain
int cgiMain() {
//cgiWriteEnvironment("/CHANGE/THIS/PATH/capcgi.dat");
cgiWriteEnvironment("./capcgi.dat");
cgiHeaderContentType("text/html");
fprintf(cgiOut, "<title>Captured</title>\n");
fprintf(cgiOut, "<h1>Captured</h1>\n");
fprintf(cgiOut, "Your form submission was captured for use in\n");
fprintf(cgiOut, "debugging CGI code.\n");
return 0;
}
开发者ID:houwentaoff,项目名称:cgic_file_up_down,代码行数:10,代码来源:capture.c
示例11: cgiMain
int cgiMain(void)
{
char *ip;
ip = (char *) calloc(32, sizeof(char));
//初始化
NET_DVR_Init();
NET_DVR_SetLogToFile(3,"./sdkLog");
//设置链接时间与重连时间
NET_DVR_SetConnectTime(2000,1);
NET_DVR_SetReconnect(10000,true);
//注册设备
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDevice;
//strcpy(ip,GetIP());
lUserID = NET_DVR_Login_V30("192.168.1.64""",8000,"admin","12345",&struDevice);
if(lUserID < 0)
{
printf("Login in ERROR:%d\n",NET_DVR_GetLastError());
NET_DVR_Cleanup();
return 1;
}
printf("login success!\n");
free(ip);
cgiHeaderContentType("Text/html");
//while(1){
if(cgiFormSubmitClicked("reboot") == cgiFormSuccess)
{
TestRebootDVR(lUserID);
}
if(cgiFormSubmitClicked("Alarm") == cgiFormSuccess)
{
if(Demo_Alarm() == HPR_ERROR)
goto EXIT;
}
if(cgiFormSubmitClicked("record") == cgiFormSuccess)
{
if(record() == HPR_ERROR)
goto EXIT;
}
//}
EXIT:
NET_DVR_Logout_V30(lUserID);
NET_DVR_Cleanup();
return 0;
}
开发者ID:shulianghe,项目名称:new-project,代码行数:54,代码来源:systerm.cpp
示例12: cgiMain
int cgiMain()
{
char send_cb_string[GL_CALLBACK_MAX_SIZE];
int send_cb_len;
linkage_st lnk_st;
int enable_flag;
cgiFormResultType cgi_re;
int res=0;
cgiHeaderContentType("application/json"); //MIME
cgi_re = cgiFormInteger(FIELD_LID, &lnk_st.lnk_base.lid, 0);
cgi_re = cgiFormString(FIELD_LNKNAME, lnk_st.lnk_base.lnkname, NAME_STRING_LEN + 1);
lnk_st.lnk_base.lnkname[NAME_STRING_LEN] = '\0';
cgi_re = cgiFormString(FIELD_TRGIEEE, lnk_st.lnk_base.trgieee, IEEE_LEN + 1);
lnk_st.lnk_base.trgieee[IEEE_LEN] = '\0';
cgi_re = cgiFormString(FIELD_TRGEP, lnk_st.lnk_base.trgep, 2 + 1);
lnk_st.lnk_base.trgep[2] = '\0';
cgi_re = cgiFormString(FIELD_TRGCND, lnk_st.lnk_base.trgcnd, TRIGGER_CONDITION_LEN + 1);
lnk_st.lnk_base.trgcnd[TRIGGER_CONDITION_LEN] = '\0';
cgi_re = cgiFormString(FIELD_LNKACT, lnk_st.lnk_base.lnkact, ACTPARA_LEN + 1);
lnk_st.lnk_base.lnkact[ACTPARA_LEN] = '\0';
cgi_re = cgiFormInteger(FIELD_ENABLE, &enable_flag, 0);
lnk_st.lnk_base.enable = (char)enable_flag;
res = gnerate_per_urlobj(&lnk_st.urlobject, lnk_st.lnk_base.lnkact);
if(res <0){
goto all_over;
}
res = gnerate_linkage_trgcnd_st(&lnk_st.lnk_condition, lnk_st.lnk_base.trgcnd);
if(res <0){
goto all_over;
}
// wrtie database
res = db_init();
if(res<0){
goto all_over;
}
res = edit_linkage_db(&lnk_st);
if(res<0){
goto all_over;
}
all_over:
db_close();
api_response(res, lnk_st.lnk_base.lid, &lnk_st.lnk_base);
//push to cb_daemon
if((send_cb_len = cJsonLinkage_callback(send_cb_string, SUBID_EDIT_LINK, res, lnk_st.lnk_base.lid, &lnk_st.lnk_base)) >=0) {
//if push failed, not handle temporary
push_to_CBDaemon(send_cb_string, send_cb_len);
}
return 0;
}
开发者ID:yanlunyao,项目名称:gateway,代码行数:54,代码来源:editLinkage.c
示例13: cgiMain
int
cgiMain()
{
cgiHeaderContentType("text/html");
int serverside = 0;
cgiFormInteger("serverside", &serverside, 0);
char function_call[50];
int callback = 0;
if (cgiFormString("function_call", &function_call[0], 50) == cgiFormSuccess)
callback = 1;
if(serverside) {
/* Initialise the SEE library */
SEE_init();
/* Initialise an interpreter */
SEE_interpreter_init(&g_interp_storage);
g_interp = &g_interp_storage;
/* Bring our native functions into the interpreter */
SEE_CFUNCTION_PUTA(g_interp, g_interp->Global, "println", g_println, 1, 0);
SEE_CFUNCTION_PUTA(g_interp, g_interp->Global, "include", g_include, 1, 0);
SEE_CFUNCTION_PUTA(g_interp, g_interp->Global, "version", g_version, 1, 0);
/* evaluate bootstrapping code, and then script, then transform events */
evaluate_file(g_interp, &g_result, "/Users/alan/working/golf/boot/serverside.js");
evaluate_file(g_interp, &g_result, cgiPathTranslated);
/* this is dangerous lol. should check to make sure the callback is a function */
if(callback)
evaluate_string(g_interp, &g_result, function_call);
/* this converts elements with onclick event attributes into links */
evaluate_file(g_interp, &g_result, "/Users/alan/working/golf/boot/transform.js");
evaluate_string(g_interp, &g_result, "document.render();");
} else {
fprintf(cgiOut, "<html>\n<head>\n");
fprintf(cgiOut, "<script type = \"text/javascript\">\n");
fprintf(cgiOut, "function boot() {\n");
print_file("/Users/alan/working/golf/boot/clientside.js");
print_file(cgiPathTranslated);
fprintf(cgiOut, "\n}\n");
fprintf(cgiOut, "</script>\n</head>\n");
fprintf(cgiOut, "<body onload = \"boot();\">\n");
fprintf(cgiOut, "</body>\n</html>");
}
return EXIT_SUCCESS;
}
开发者ID:alandipert,项目名称:cgolf,代码行数:54,代码来源:golf.c
示例14: cgiMain
int cgiMain() {
cgiHeaderContentType("text/html;charset=gbk");
user *user1 = lw_new(user_klass);
user_set_username(user1, "macro chen");
user_set_pwd(user1, "111111");
user_set_salt(user1, "aabbcc");
fprintf(cgiOut, "%s , %s , %s \n", user_get_username(user1),
user_get_pwd(user1), user_get_salt(user1));
lw_destory(user1);
return 0;
}
开发者ID:xinzou,项目名称:cweb,代码行数:11,代码来源:ooptest.c
示例15: cgiMain
/***************************************************************************
Function: cgiMain
Description:
Input:
Output:
Return: 0 OK, other Error
Others: none
***************************************************************************/
int cgiMain()
{
char account[FEATURE_GDGL_ACCOUNT_MAX_LEN + 1]; //16 + terminating null
char password[FEATURE_GDGL_PASSWD_MAX_LEN + 1]; //16 + terminating null
char gateway_id[FEATURE_GDGL_ID_LEN + 1]; //12 + terminating null
char gateway_alias[FEATURE_GDGL_ACCOUNT_MAX_LEN + 1];
char gateway_passwd[FEATURE_GDGL_PASSWD_MAX_LEN + 1];
cgiFormResultType cgi_re;
int res;
cgiHeaderContentType("application/json"); //MIME
// Read ID
res = read_id(gateway_id);
if (res != 0) {
client_admin_response("noid", res, clientAdminResultStr[res]);
return res;
}
// Read alias
res = read_alias(gateway_alias);
if (res != 0) {
client_admin_response(gateway_id, res, clientAdminResultStr[res]);
return res;
}
// Read password
res = read_password(gateway_passwd);
if (res != 0) {
client_admin_response(gateway_id, res, clientAdminResultStr[res]);
return res;
}
// Check account
cgi_re = cgiFormString("account", account, FEATURE_GDGL_ACCOUNT_MAX_LEN + 1);
res = check_account(cgi_re, account, gateway_id, gateway_alias);
if (res != 0) {
client_admin_response(gateway_id, res, clientAdminResultStr[res]);
return res;
}
// Check password
cgi_re = cgiFormString("password", password, FEATURE_GDGL_PASSWD_MAX_LEN + 1);
res = check_password(cgi_re, password, gateway_passwd);
if (res != 0) {
client_admin_response(gateway_id, res, clientAdminResultStr[res]);
return res;
}
// account & password all right
client_admin_response(gateway_id, clientAdminSuccess, clientAdminResultStr[clientAdminSuccess]);
return 0;
}
开发者ID:yanlunyao,项目名称:gateway,代码行数:61,代码来源:clientLogin.c
示例16: cgiMain
int cgiMain()
{
/* Send the content type, letting the browser know this is HTML */
cgiHeaderContentType("text/html");
fprintf(cgiOut, "<HTML><HEAD>\n");
fprintf(cgiOut, "<TITLE>Robot SetName</TITLE></HEAD>\n");
if ((cgiFormSubmitClicked("send") == cgiFormSuccess)) {
handlePlainText();
}
fprintf(cgiOut, "</BODY></HTML>\n");
return 0;
}
开发者ID:michtw,项目名称:robot,代码行数:14,代码来源:SetName.c
示例17: LoadEnvironment
void LoadEnvironment()
{
if (cgiReadEnvironment(SAVED_ENVIRONMENT) !=
cgiEnvironmentSuccess)
{
cgiHeaderContentType("text/html");
fprintf(cgiOut, "<head>Error</head>\n");
fprintf(cgiOut, "<body><h1>Error</h1>\n");
fprintf(cgiOut, "cgiReadEnvironment failed. Most "
"likely you have not saved an environment "
"yet.\n");
exit(0);
}
/* OK, return now and show the results of the saved environment */
}
开发者ID:kkcloudy,项目名称:daemongroup,代码行数:15,代码来源:cgictest.c
示例18: doPostReq
int doPostReq(struct extRequest *req) {
cgiHeaderContentType("text/json");
CURL *curl;
CURLcode res;
struct curl_httppost *formpost=NULL;
struct curl_httppost *lastptr=NULL;
curl_global_init(CURL_GLOBAL_ALL);
int i;
for(i = 0; i < req->numargs; i++) {
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, req->args[i]->argName,
CURLFORM_COPYCONTENTS, req->args[i]->argVal,
CURLFORM_END);
}
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, req->url);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_function);
if(req->callback != NULL) {
fprintf(cgiOut, "%s(", req->callback);
}
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
curl_formfree(formpost);
if(req->callback != NULL) {
fprintf(cgiOut, ");");
}
return 1;
} else {
return 0;
}
}
开发者ID:alandipert,项目名称:jsonptunnel,代码行数:48,代码来源:fetch.c
示例19: pagehead
void pagehead(char* title, char *session, FILE *out) {
char res_page[81] = "";
if(out == NULL) out = cgiOut;
/* -------------------------------------------------------------------------- *
* start the head output *
* ---------------------------------------------------------------------------*/
if(out == cgiOut) cgiHeaderContentType("text/html; charset=UTF-8");
fprintf(out, "<html>\n");
fprintf(out, "<head>\n");
fprintf(out, "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/style.css\" media=\"screen\" />\n");
if(session != NULL && out == cgiOut) {
/* here goes the html redirect code to point to the results file */
snprintf(res_page, sizeof(res_page), "session-%s.htm", session);
fprintf(out, "<meta http-equiv=\"refresh\"");
fprintf(out, "content=\"1; url=%s/%s\">\n", RESULTS_DIR, res_page);
}
fprintf(out, "<meta name=\"Title\" content=\"INOVASC - %s\" />\n", title);
fprintf(out, "<meta name=\"Description\" content=\"INOVASC - OpenVAS security scanner web client\" />\n");
fprintf(out, "<meta name=\"Keywords\" content=\"OpenVAS, vulnerability assessment, scanner, audit, compliance\" />\n");
fprintf(out, "<title>INOVASC - %s</title>\n", title);
fprintf(out, "</head>\n");
fprintf(out, "<body>\n");
fprintf(out, "<div id=\"wrapper\">\n");
fprintf(out, "<div id=\"banner\">\n");
fprintf(out, "<h1>INOVASC - %s</h1>\n", title);
fprintf(out, "<h2>Web-based System Vulnerability Assessment with OpenVAS</h2>\n");
fprintf(out, "</div>\n");
fprintf(out, "<div id=\"vmenu\">\n");
fprintf(out, "<ul>\n");
fprintf(out, "<li><a href=\"%s\" class=\"selected\"><span>Home</span></a></li>\n", HOMELINK);
fprintf(out, "<li><a href=\"%s/cgi-bin/scantemplates.cgi\"><span>Scan Templates</span></a></li>\n", HOMELINK);
fprintf(out, "<li><a href=\"%s/cgi-bin/scanlogin.cgi\"><span>Direct Scan</span></a></li>\n", HOMELINK);
fprintf(out, "<li><a href=\"%s/cgi-bin/scanresults.cgi\"><span>List existing Results</span></a></li>\n", HOMELINK);
fprintf(out, "<li><a href=\"%s/cgi-bin/help.cgi\"><span>Help</span></a></li>\n", HOMELINK);
fprintf(out, "<li><a href=\"%s/cgi-bin/about.cgi\"><span>About</span></a></li>\n", HOMELINK);
fprintf(out, "</ul>\n");
fprintf(out, "</div>\n");
fprintf(out, "<div id=\"content\">\n");
}
开发者ID:fm4dd,项目名称:inovasc,代码行数:47,代码来源:pagehead.c
示例20: cgiMain
int cgiMain()
{
int i,n;
int ret;
char id_buf[10];
char inputStr[2][VALUE_SIZE];
char switch_buf[5];
char enable_buf[5];
char cmd[BUF_SIZE];
char dev_name[DEVNAME_SIZE];
memset(dev_name,0,sizeof(dev_name));
memset(id_buf,0,sizeof(id_buf));
memset(inputStr,0,sizeof(inputStr));
memset(switch_buf,0,sizeof(switch_buf));
memset(enable_buf,0,sizeof(enable_buf));
sqlite3 *db;
/* *.db must be under the root directory of web server,
* and the directory mode of *.db must be 777*/
ret = sqlite3_open("data/devices.db",&db);
if(ret != SQLITE_OK)
{
fputs(sqlite3_errmsg(db),stderr);
fputs("\n",stderr);
exit(1);
}
/* cgic header */
cgiHeaderContentType("text/plain");
cgiFormString("hub_id",id_buf,10);
cgiFormString("inputVal",inputStr[0],20);
cgiFormString("inputVal2",inputStr[1],20);
cgiFormString("switch_opt",switch_buf,5);
cgiFormString("enableBox",enable_buf,5);
int hub_id=atoi(id_buf);
n=sheet_row_modify(db,"temp_tb",hub_id,inputStr,switch_buf,enable_buf);
/*update sheet*/
if(n==0)
{
dev_getNameByHub(db,hub_id,dev_name);
sheet_row_show(db,"temp_tb",hub_id,dev_name);
}
else
printf("-1");
// printf("1|hello|world|hi|hi|hi&");
sqlite3_close(db);
return 0;
}
开发者ID:PopulusHuang,项目名称:IntellectHub,代码行数:47,代码来源:temp_submit.c
注:本文中的cgiHeaderContentType函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论