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

📄 index.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>

//<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">
//<META HTTP-EQUIV=\"expires\" CONTENT=\"-1\">

static char adminGate[] = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3c.org/TR/1999/REC-html401-19991224/frameset.dtd\">
<HTML><HEAD><TITLE>IPCAMER</TITLE>
<META http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">


<META content=\"MSHTML 6.00.6000.16414\" name=GENERATOR>
</HEAD>
<FRAMESET border=0 
frameSpacing=0 rows=* frameBorder=NO>
	<FRAMESET border=0 
frameSpacing=0 frameBorder=NO cols=129,*,0><FRAME name=leftFrame 
src=\"menus.htm\" noResize><FRAME name=mainFrame 
src=\"/sysinfo.cgi\"><FRAME name=msgFrame 
src=\"about:blank\"></FRAMESET></FRAMESET></HTML>\n\n";

//static char userGate[] = "Location: rt_video.cgi\n\n";

static char userGate[] = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3c.org/TR/1999/REC-html401-19991224/frameset.dtd\">
<HTML><HEAD><TITLE>IPCAMER</TITLE>
<!--
<META http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">
-->
<META content=\"MSHTML 6.00.6000.16414\" name=GENERATOR>
</HEAD>
<FRAMESET border=0 
frameSpacing=0 rows=* frameBorder=NO>
	<FRAMESET border=0 
frameSpacing=0 frameBorder=NO *,*,0><FRAME name=mainFrame 
src=\"/rt_video.cgi\"><FRAME name=msgFrame 
src=\"about:blank\"></FRAMESET></FRAMESET></HTML>\n\n
";

int main(void)
{
   char * userName = getenv("REMOTE_USER");

   if(!strcmp("admin",userName))
	{
      printf("%s\n",adminGate);
	}
	else if(!strcmp("user",userName))
	{
      printf("%s\n",userGate);
	}


    fflush(stdout);
    exit(0);

}  // end of main

⌨️ 快捷键说明

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