⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video_crypt.c

📁 嵌入式linux的一个cgi网站
💻 C
字号:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <getopt.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/config.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include "cgivars.h"
#include "htmllib.h"
#include "config_phase.h"
#include "sysconf.h"

#define DEBUG        0

#define ID_VID_CRYPT          11

static config_item ** items;
static int config_list[] = {11};
static char *config_name[] = {"VID_CRYPT"};

char java[] = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<HTML><HEAD>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Cache-Control content=\"No-cache,must revalidate\">
<META http-equiv=Content-Type content=\"text/html; charset=gb2312\">
<STYLE type=text/css>BODY {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
TD {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
FORM {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
OPTION {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
TEXTAREA {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
P {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
OL {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
INPUT {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
SELECT {
	FONT-SIZE: 10pt; FONT-FAMILY: Arial
}
.style1 {
	FONT-WEIGHT: bold; FONT-SIZE: 14pt
}
</STYLE>


<META content=\"MSHTML 6.00.6000.16414\" name=GENERATOR></HEAD>";



void  video_crypt(char **postvars, int form_method)
{
	int config_num = sizeof(config_list)/sizeof(int);
	int i;
	int r_fd, w_fd;

	int temp_int;
	char *temp_string;
	char *crypt = NULL;

	printf("%s\n", java);

	//r_fd = open_read_fifo();
     items = init_config_item(items, config_num, config_list);
	
	  if(form_method == POST)
	 
	  {
	  	 GetConfValues(config_list, items, config_num);
	  //  trace("post\n");
	//	tracePostVars(postvars);
		item_update( ID_VID_CRYPT, items ,  config_num,  "0");   //checkbox的特殊性
		if(SaveConfig(postvars, items, config_list, config_name, config_num))
		{/*
			w_fd = open_write_fifo();
			notify_config(w_fd);
			close_write_fifo(w_fd);

			read_fifo(r_fd);
			*/
		}
	}

	GetConfValues(config_list, items, config_num);

	printf("<BODY leftMargin=30 topMargin=24 rightMargin=30>\n");
	printf("<P class=style1>视频加密</P><TABLE width=\"100%\">\n");
	printf("<TBODY><TR><TD><FORM name=video_crypt action=\"/video_crypt.cgi\" method=post target=msgFrame>\n");
	printf("<TABLE style=\"BORDER-COLLAPSE: collapse\" borderColor=#dae3eb cellSpacing=0 cellPadding=0 width=\"100%\" border=1>\n");
	printf("<TBODY><TR bgColor=#cccccc><TD colSpan=3><B>视频加密设置</B></TD></TR>\n");

	if(temp_string = getdata(ID_VID_CRYPT, items, config_num))
	{
		temp_int = atoi(temp_string);
		if( 1 == temp_int )
			printf("<TR><TD colSpan=3><INPUT type=checkbox name=VID_CRYPT value=1 checked >启用JPEG高强度加密功能\n");
		else
			printf("<TR><TD colSpan=3><INPUT type=checkbox name=VID_CRYPT value=1>启用JPEG高强度加密功能\n");
	}
		printf("<INPUT type=hidden value=chs name=lang> n");

	printf("</TD></TR></TBODY></TABLE><P align=left><INPUT type=submit value=应用><INPUT type=reset value=清除>\n");
	printf("</P></FORM></TD></TR><TR><TD> </TD></TR></TBODY></TABLE></BODY></HTML>\n");
            
	free_config_item(items, config_num);
	//close_read_fifo();
}


////////////////////////////////////////////////////////////////////////////
// Function: main
////////////////////////////////////////////////////////////////////////////
int main(void)
{
    char **postvars = NULL;  // POST request data repository
    char **getvars = NULL;   // GET request data repository
    int form_method;         // POST = 1, GET = 0

    // CGI part start here
    adminCheck();
    form_method = getRequestMethod();

    if(form_method == POST)
    {
       // getvars = getGETvars();
        postvars = getPOSTvars();
    }
    else if(form_method == GET)
    {
        getvars = getGETvars();
    }

    // CGI start here, set COM port
    video_crypt(postvars, form_method);

    //htmlFooter();
    cleanUp(form_method, getvars, postvars);


    fflush(stdout);
    exit(0);

}  // end of main




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -