基于嵌入式web服务器的网站及应用开发

合集下载

基于LwIP的嵌入式设备Web服务器设计与实现

基于LwIP的嵌入式设备Web服务器设计与实现

基于LwIP的嵌入式设备Web服务器设计与实现陈志星;杨金孝【摘要】随着嵌入式设备的发展,很多嵌入式设备都具有网口通信功能,通过网口对嵌入式设备进行内部参数设置是一种既方便又简单的方式.设计了一种基于LwIP协议的嵌入式设备Web服务器.利用网页就可以配置嵌入式设备内部参数及程序升级.充分利用STM32平台内部集成以太网模块和LwIP轻型网络协议栈的特点,通过以太网物理层芯片LAN8720和RJ45接口相连,完成了网页和Web服务器之间的数据收发.测试表明,设计的基于LwIP协议栈的嵌入式设备Web服务器是正确和可行的.%With the development of embedded devices,many embedded devices have the function of network communication,and it is a convenient and easy way to set the internal parameters of embedded devices through the network port. This paper designs an embedded device Web server based on LwIP protocol. The internal parameters of embedded devices can be configured and updated by using the web page. The Web server make full use of the platform of STM32 internal integration Ethernet modules and the characteristics of LwIP light network protocol stack. Through the Ethernet physical layer chip LAN8720 and RJ45 interface to link together,Web pages and Web server can achieve bidirectional data transmission. The test shows that the embedded device Web server based on the LwIP protocol stack is correct and feasible.【期刊名称】《电子设计工程》【年(卷),期】2018(026)011【总页数】4页(P110-113)【关键词】LwIP;STM32;LAN8720;Web服务器;嵌入式设备【作者】陈志星;杨金孝【作者单位】西北工业大学电子信息学院,陕西西安710129;西北工业大学电子信息学院,陕西西安710129【正文语种】中文【中图分类】TN919.6随着物联网技术的兴起和智能家居的发展,嵌入式设备需要接入局域网或者因特网已成为一种趋势,由于网口通信比其他模式通信速率高且抗干扰性强,在局域网中往往很多嵌入式设备只留有网口供于外部通信,此时对于嵌入式设备内部一些参数设置和内部程序升级只能由网口通信完成。

嵌入式Web服务器的实现及其CGI应用

嵌入式Web服务器的实现及其CGI应用
a d t eW e e v r n bS re. h
Ke r s e e d d w b s r e ;S t d;e e d d d mo b a d;C ;C C y wo d : mb d e e e r ht v p mb d e e o r GI GI
王 俊 ,郭 书军
( 方 工 业 大 学 信 息工 程 学 院 ,北 京 1 o4 ) 北 0 lJ 4
摘 要 :嵌 入 式 设 备 资 源有 限 , 这 种 情 况 下 实现 We 在 b服 务 功 能 比较 困难 。 针 对 嵌 入 式 设 备 这种 特 点 , 文 通 过 比较 本 几种 We b服 务 器 的 优 缺 点 , 定 了 S t d作 为嵌 入 式 We 选 ht p b服 务 器 , 对 其 在 Ln x嵌入 式 平 台下 进 行 了移 植 。 文 中 并 i u 详 细 解析 了 C I 术 的 相 关 原 理 , 结合 H ML表 单 和 C I 术 , 出 了用 C语 言编 写 的基 于 C I G技 并 T G技 给 G C库 的 串 口程 序 ,
( oeeo n r ai n i eig N r hn n esyo Tc nl y B in 0 14 C i ) C lg f m t nE gn r , ot C i U i ri f ehoo , e ig104 , hn l fI o o e n h a v t g j a
l rr a ie ,whc o ie i i ayw sgv n b ih cmbn d wt HTML fr n GItc n lg , e iigd n mi nea t i ewen tecin h msa d C h oo o e y ra zn y a citrci t b t e l t l 21 .

基于ARM嵌入式Web服务器系统的设计与研究

基于ARM嵌入式Web服务器系统的设计与研究
关 键词 : 入 式 We 务 器 ;iu ; C /P协议 ; R 嵌 b服 Ln x T P I AM
中图分类 号 :P 7 T 23
文 献标识 码 : A
文 章编 号 :0 6— 9 6 2 0 )3— 0 4一 6 10 8 9 ( 0 8 0 0 4 O
De i n a e e r h o a e be de e sg nd r s a c n n m d dW b s r e y t m a e n e v r s s e b s d o ARM
XU u —l i Xi e
(i zoWafn l n m Mauatr gC . T H n n J ou 5 10,hn ) J ou na gAu u nfc i o L D, ea ,i zo4 4 0 C i a mi un a a
Ab t a t Th e in a d r aiain o i d o e e s r c : e d sg n e lz to fa k n fn w mbe d d W e e v r b s d o d e b s r e a e n ARM o t fr i s s f r n a d r r nr d c d i h s p p ra d t e T o wa e a d h r wa e a e i to u e n t i a e n h CP/I r tc l an b ee td a d t P p o o os c i e s l ce n smp i e o c odig t h e la p ia in st ain o h mbe d d W e e e .I e e p rme i lf d to a c r n ot e r a p lc t iu to ft e e i o d e b s r r ,h x e i n- v ’ t lr s l s o ta h e a e u t h ws h tt e mbe d d d e W e e e e eo d o te o wa e n a d r ltom b s r r d v lpe n h s f r a d h r wa e p a r v t f mo e c n r aie t e d t e ie f c in i o lx s se b s d o he i tr e n h y t m d a e lz h aa s r c un t n a c mp e y tm a e n t ne ta d t e s se v o n h s h g eibi t n to g r a i u c in a d c n u sl s e o r e . a ih rla l y a d sr n e lt i me f n t n o s me e sr s u c s o

基于STM32的嵌入式WEB服务器设计+(1)

基于STM32的嵌入式WEB服务器设计+(1)

毕业设计说明书摘要在科学技术日新月异的今天,嵌入式系统已成为计算机领域的一个重要组成部分。

嵌入式系统具有软件、硬件的可裁剪性,系统精简,具有高时效性,且功耗较低。

由于HTML语言的标准统一性,只要在嵌入式设备中有一个微型服务器, 就可以使用任意一种Web浏览器接收和发送信息。

本论文首先讨论了基于ARM Cortex-M3的嵌入式Internet技术,介绍了嵌入式网络通信技术的基础知识,然后根据嵌入式设备的特点,对标准TCP/IP协议进行了合理的简化,实现了符合ARM Cortex-M3单片机的嵌入式精简TCP/IP协议栈。

在协议栈的基础上,实现了简单的嵌入式Web服务器。

本论文结合嵌入式技术、互联网通讯技术,介绍了嵌入式Web服务器的具体实现过程。

论文采用STM32F103C8T6+ENC28J60的硬件构架,基于超文本传输协议(HTTP)传输控制数据和用户信息,设计了微型嵌入式WEB服务器,通过以太网和-据传输共享以单片机应用系统为中心的小型嵌入式设备的信息,实现了嵌入式系统的Internet接入,Internet上的远程用户就可以通过浏览器访问嵌入式Web服务器,进而实现对嵌入式系统的远程控制和监测。

关键字:STM32 WEB服务器远程控制IAbstractThis system adopts the ST company Cortex-M3 kernel STM32 microprocessor STM32F103. STM32F103 is STMicroelectronics launched a new STM32 connection type (Connectivity) is a high performance products series of micro controller, the chip integrates a variety of standard high performance industrial interface, and different types of STM32 products in the pin and software with perfect compatibility, can be easily adapted to more applications. The new STM32 standard peripherals including 10 timer, two 12 1-Msample/s AD (ADC) (rapid alternating mode 2M sample/s), two of 12 DA (DAC), two I2C ports, five USART ports and three SPI ports and high quality digital audio interface IIS, and STM32F103 with a full USB (OTG) interface, two CAN2.0B interface, and Ethernet 10/100 MAC module. This chip can meet the industrial, medical, building automation, home audio and home appliances market a variety of products demand.. System is the main content of the network control is connected with the equipment and access to the equipment status and data informa-tion can be released; the webpage; timely response control command from the remote user. In addition, the embedded equipment with simple function, low power con-sumption and portability etc.Keywords : STM32 Web server Remote controlII目录摘要 (I)Abstract ......................................................................................................................... I I 目录 ............................................................................................ 错误!未定义书签。

基于ARM的嵌入式WebServer的应用

基于ARM的嵌入式WebServer的应用
制 网络 和数 据 网络 实现互 联 的 网关 , 由其 完 成 将 传 输 内容 按 照 T P/P协议 进 行 相 应 意一 台接人 以太 网的具 备 网络 浏 览 器 的 计算 机 , 用 户身 份 确 定 后 可 以通过 以太 网实 经 时地 得 到现 场数 据 , 并可 实 现对数 据 采集 设 备 的 相关 测量 参 数 进 行 远 端 修 正 , 面对 嵌 入式 We 务 下 b服
性 高 的 嵌 入 式 We evr 全 部 流 程 。 bSre 之 关 键 词 : 算 机 技 术 ; 络 服 务 器 ; 入 式 ; 用 网关 接 口 ; 入 式 l u 操 作 系 统 计 网 嵌 通 嵌 ix n 中图 分 类 号 :P 9 ; H T 33 T 7
^ _, -L - J.0 _
2 系统 软 件 体 系结 构 简 介
2 1 嵌入 式 OS的选 择 .
由于本 系 统 采 用 的 是 没 有 内存 管 理 单 元 ( MMU) 能 模 块 的基 于 A M T MI的 ¥ C 4 0作 为 功 R 7D 3 4B
C U, 以 O P 所 s采用 了 u l u ,Ciu Ci x u l x是 从 l u 2 0 2 4内核派 生而 来 , 袭 了 主流 l u n n i x ./ . n 沿 i x的绝 大 部分 特 n 性, 它专 门针 对 没有 MMU的 C U做 了许 多小 型 化 的工作 , 常 用 于具 有很 少 内存 或 Fah的嵌 人 式 系 P 通 ls
Vo . 8 No 5 12 . Oc . t 20 7 0
文章 编 号 :6 2—6 7 (0 7 0 0 2 0 17 8 1 2 0 ) 5— 0 5— 4
基 于 A M 的嵌 入 式 We ev r R bS re 的应 用

嵌入式WEBSERVER的设计与实现

嵌入式WEBSERVER的设计与实现

1.绪论自18世纪的工业革命以来,人类社会在每个世纪都有它的主流技术。

在经历了机械时代,蒸汽机时代和电气时代后,以信息的收集,处理和发布为主要特点的信息技术是成为我们这个时代的主流技术。

信息技术的蓬勃发展,对我们这个社会产生了极为深远的影响。

1.1 嵌入式系统的发展及现状嵌入式概念早在20世纪60年代末己被提出,在经历了二、三十年的缓慢发展后,截止到上世纪90年代,它获得了全面的应用和发展。

目前,随着IT 业向数字化、网络化和智能化方向发展,嵌入式技术的应用全面展开。

在通信领域中,采用嵌入式技术的交换和路由设备实现了智能的交换和路由。

在广播电视领域,嵌入式软件技术和数字技术的结合,造就了家电行业的未来发展方向-信息家电。

在控制领域,广泛应用于ATM机、自动售货机、工业控制等设备。

在商业领域中,先进的PDA己能在屏幕上实现汉字写入、短消息语音发布,应用范围也将日益广阔。

在个人领域中,嵌入式产品将主要作为个人移动的数据处理和通信软件。

由于嵌入式设备具有人性化的人机交互界面,GUI屏幕为中心的多媒体界面给人以很大的亲和力,手写文字输入、语音拨号、收发电子邮件以及彩色图形、图像取得初步成效,所有上述产品都离不开嵌入式系统技术。

中国的单片机应用和嵌入式系统开发有15年的历程,有超过10万名从事单片机开发应用的工程师,但绝大多数是以封闭的方式开发几乎不可重用的软件。

今天面对的是嵌入式系统工业化的潮流,嵌入式软件必须以工业化的方式生产开发,这对加速知识创新和建立面向新世纪的知识经济具有战略意义。

[1] 本文将讲述的单片机+TCP/IP软件的方法就可以使嵌入式系统上英特网,使嵌入式设备之间可以相互通信。

这种技术现今已用于工业自动化,POS(电子收款机系统)网络及电子商务,智能公路等方面。

1.2 嵌入式系统的定义嵌入式系统泛指单片机和微处理器构成的电子设备。

根据IEEE的定义,嵌入式系统是“控制、监视、或者辅助设备、机器和车间运行的装置”(devices used to control, monitor, or assist the operation of equipment, machinery or plants)。

基于stm32的嵌入式web服务器的设计

基于stm32的嵌入式web服务器的设计

基于stm32的嵌入式web服务器的设计摘要随着社会的进步和发展,嵌入式系统的东西也渐渐融入了我们的生活当中,比如嵌入式WEB网络服务器,LED电视机等等。

通过越来越多的人使用嵌入式系统,并且随着PC机在人群中的普及,我们开始越来越希望拥有一个系统可以远程控制和使用我们身边的设备,这里我们便有了我们现在的研究,那就是基于STM32的嵌入式WEB服务器的设计。

起初对这个设计的概念是比较模糊的,大致为通过网页和单片机互联,并且做到在TCP/IP,LWIP等协议的运行下,通过网页来控制单片机。

而现在,随着技术越来越成熟和合理,我们通过智能家居等等在TCP/IP的协议下进行远程的通讯,在线的升级和访问Internet等。

这篇文章,就是我们一STM32F4为平台所设计的WEB服务器。

我们主要是通过LWIP的应用程序接口LWIP API编写HTTP程序。

在我们所设计的程序中,WEB服务器会处理来自网页中的信息,发送给PC机,同样,PC机也可以给WEB服务器传送信息,使网页接受来自PC机的信息,实现了PC机和网页的信息交互。

关键字:STM32;嵌入式;WEBABSTRACTWith the progress and development of society, embedded systems are gradually integrated into our lives, such as embedded WEB network server, LED TV and so on. By more and more people use embedded system, and with the popularity of PC machines in the crowd, we began to increasingly want to have a system to and the use of the remote control and equipment around us. Here, we will have the we now study, which is based on STM32 embedded web server design.At first, the concept of this design is relatively vague, roughly through the Internet and the Internet, and do in TCP/IP, LWIP and other protocols running through the web to control the microcontroller.And now, as the technology is more mature and reasonable, we are through the smart home, etc. in the TCP/IP protocol for remote communications, online upgrade and access Internet, etc..This article, is through the STM32F4 development board design of embedded WEB server. We mainly through the LWIP application program interface API LWIP to prepare the HTTP program. In the program, the web server will process the information from a web page, send to the PC. Similarly, PC can also to the web server sends information to pages to accept information from PC, realize the information interaction between the PC and web.Key words: STM32;embedded;WEB第一章绪论1.1 课题的研究背景和意义如今,随着智能手机,智能家居的出现,生活越来越走向了数字化,信息化的时代。

基于W3150A+的嵌入式Web服务器设计

基于W3150A+的嵌入式Web服务器设计
Ke r s:W 3 5 A + ;e b d e b s r e ;H TTP ;ARM y wo d 1 0 m e d d we e v r

个 独 立 的 s c e , 个 s c e 具 有 2 KB 的 缓 冲 区 。 o k t每 ok t
引 言
通 过 以 太 网 进 行 传 输 已经 成 为 一 种 经 济 、 效 的 数 据 有
输 , 且 需 要 通 过 浏 览 器 来 实 现 人 与 设 备 的 交 互 , 而 对 而 从 设 备 进 行 远 程 监 测 、 程 控 制 、 程 维 护 和 管 理 。 内 嵌 于 远 远 设 备 的 We b服 务 器 可 以提 供 统 一 的 基 于 浏 览 器 方 式 的操
大 为 6 MHz的 C U 操 作 频 率 , 部 具 有 1 0 P 内 6 KB 的 RAM , 2 / 5 1 8 2 6 KB片 内 F a h程 序 存 储 器 , 有 可 配 置 的 ls 具 外 部 8 1 / 2位 总 线 , 进 行 外 部 RAM 扩 展 。 /63 可
Em b dd d W e e e b Ser er Ba ed o 31 A+ v s n W 50
K a g W e g a g, m i n n u n Hu Li n
( Zhu iU nie h Po e e hno o ha t c w rT c l gy Co., Lt .,Zhuha 9 0, d i51 07 Chi ) na Absr c : Em be de e e ve s n i po t n e hnia m e ns o r a ie r m o e m o t i nd c nto1 Thi r il v s a de i ta t d d w b s r r i a m ra ttc cl a t e lz e t niorng a o r . s a tc e gie sgn
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

基于嵌入式web服务器的网站及应用开发CGI 的工作原理:CGI 是一种通用的接口标准。

CGI 程序就是符合这种接口标准的,运行在Web 服务器上的程序。

它的工作就是控制信息要求,产生并传回所需的文件。

CGI 由浏览器的输入发这个程序。

先看看浏览器浏览网页是怎样实现的。

作为一个用户首先在浏览器的地址栏中添加上要访问的主页地址并回车触发这个申请。

浏览器将申请发送到服务器上。

We服务器接收这些申请并根据.htm 或.html 的后缀并认识到这是HTML 文件。

Web 服务器从当前硬盘或内存中读取正确的HTML 文件,然后将它送回浏览器。

HTML 文件将被用户的浏览器解释并将结果显示在用户浏览器上。

CGI 程序可以用来在web 内加入动态的内容。

通过接口,浏览器能够发送一个可执行应用程序的HTTP 请求,而不仅仅只是静态的HTML 文件。

服务器运行指定的应用程序,这个应用程序读取与请求相关的信息,获得请求传过来的数值。

例如使用者填写HTML 表单提交了数据,浏览器将这些数据发送到Web 服务器上。

Web 服务器接收这些数据并根据客户机指定的CGI 程序把这些数据递交给指定的CGI 程序,并使CGI 在服务器上运行。

CGI程序运行结束,生成HTML 页面,Web 服务器把CGI 程序运行的结果送回用户浏览器。

HTML 文件将会被用户的浏览器解释并将结果显示在用户浏览器上。

CGI 的基本工作情况如下图所示:CGI的输入与输出:Web 服务器与CGI程序之间通过四种途径进行通信:环境变量、命令行、标准输入和标准输出。

其中负责输入的有环境变量、命令行和标准输入。

命令行只用于ISINDEX查询, 较少使用。

环境变量存放服务器向CGI程序传递的一些运行参数, 比如REQUEST_METHOD表示用户提出请求或提交数据的方法是GET还是POST。

方法(METHOD)是HTTP 中对命令的称呼。

GET 方法通过环境变量QUERY- STRING传递用户提交的数据。

经过编码的数据以问号打头追加在标识CGI 脚本地址的URL 后一起传给Web 服务器。

服务器将其存于QUERY-STRING 中,CGI程序可以通过getenv() 函数来读取。

编码数据除了表单数据,还可以是直接调用CGI 脚本时追加在URL 地址后面的参数。

POST 方法则通过标准输入( stdin)传递提交数据。

编码了的表单数据独立地传送给Web 服务器,CGI程序从标准输入中获得,可以用getchar( ) ,sscanf( ) ,fread( )等函数。

要注意的是数据的长度是通过读取环境变量CONTENT_LENGTH 获得的,而不是通过文件尾标识符来判断。

嵌入式WEB 服务器的硬件结构嵌入式WEB服务器的硬件结构如图2所示。

其主要由CPU芯片、MPEG-4音视频编码芯片、Flash芯片、SDRAM内存、以太网络接口、大容量硬盘组成。

其中CPU采用M OTOROLA公司的PowerPC系列嵌入式通信处理器MPC8250。

MPEG-4音视频编码芯片完成对从摄像头传送过来的视频数据的压缩和编码。

根据网络带宽、拓扑结构以及对图像质量的要求,本系统选用基于MPEG-4标准的分层可扩展性编码方案。

压缩后的视频数据根据需要,可以存储在大容量硬盘中,或者通过以太网进行网络传输。

为了实现视频存储功能,需要采用大容量的硬盘。

WEB服务器与CGI程序WEB服务器通过HTTP协议与监控端浏览器软件进行信息交互,提供其他应用程序模块的接口以及视频数据浏览界面和摄像机控制界面。

此外,它还要对监控端的访问权限进行控制,过滤监控端的请求和控制信息,处理多个监控端的请求和控制的同步和优先级问题。

本系统选择适合于嵌入式系统的Boa WEB服务器。

Boa是一个单任务的HTTP服务器,支持能够实现动态WEB技术的CGI技术,源代码开放、性能高。

同时服务器程序本身所占空间很小,因而十分适用于嵌入式系统。

同时,本系统采用了CGI(公用网关接口) 来实现动态WEB技术,CGI规定了WEB服务器调用其他可执行程序(CGI程序)的接口协议标准。

WEB服务器通过调用CGI程序实现和浏览器的交互,也就是CGI程序接受浏览器发送给WEB服务器的信息,进行处理,将响应结果再回送给WEB服务器及浏览器。

原则C GI程序可以用任何程序设计语言编写,但是用C语言编写的CGI程序具有执行速度快、安全性高等特点。

点击相关按钮所调用的CGI函数及函数的实现int main(){char *button;int fd_fifo1,fd_fifo2,fd_fifo3,fd_fifo4;char cmd[5];int i;printf("Content-Type:text/html\n\n");此行通过标准输出将字符串″Contenttype:text/plain\n\n″传送给Web服务器。

它是一个MIME 头信息,它告诉Web服务器随后的输出是以纯ASCII文本的形式。

请注意在这个头信息中有两个换行符,这是因为Web服务器需要在实际的文本信息开始之前先看见一个空行。

button=getenv("QUERY_STRING");CGI定义:当GET方法提交的表单被发送到服务器断后,表单中的数据被保存在服务器上一个叫做QUERY_STRING的环境变量中。

这种表单的处理相对简单,只要读取环境变量就可以了。

for(i=0;i<4;i++){cmd[i]=*(button+i);}cmd[4]='\0';if(!strcmp("cmd1",cmd)){fd_fifo1 = open("FIFO_1",O_RDWR);fd_fifo2 = open("FIFO_2",O_RDWR);fd_fifo3 = open("FIFO_3",O_RDWR);write(fd_fifo1,"open_camera",strlen("open_camera"));write(fd_fifo2,"open_infreared",strlen("open_infreared"));write(fd_fifo3,"open_tempreature",strlen("open_tempreature"));close(fd_fifo1);close(fd_fifo2);close(fd_fifo3);}else if(!strcmp("cmd2",cmd)){fd_fifo1 = open("FIFO_1",O_RDWR);fd_fifo2 = open("FIFO_2",O_RDWR);fd_fifo3 = open("FIFO_3",O_RDWR);write(fd_fifo1,"close_camera",strlen("close_camera"));write(fd_fifo2,"close_infreared",strlen("close_infreared"));write(fd_fifo3,"close_tempreature",strlen("close_tempreature"));close(fd_fifo1);close(fd_fifo2);close(fd_fifo3);}else if(!strcmp("cmd3",cmd)){fd_fifo1 = open("FIFO_1",O_RDWR);write(fd_fifo1,"open_camera",strlen("open_camera"));close(fd_fifo1);}else if(!strcmp("cmd4",cmd)){fd_fifo1 = open("FIFO_1",O_RDWR);write(fd_fifo1,"close_camera",strlen("close_camera"));close(fd_fifo1);}else if(!strcmp("cmd5",cmd)){fd_fifo2 = open("FIFO_2",O_RDWR);write(fd_fifo2,"open_infreared",strlen("open_infreared"));close(fd_fifo2);}else if(!strcmp("cmd6",cmd)){fd_fifo2 = open("FIFO_2",O_RDWR);write(fd_fifo2,"close_infreared",strlen("close_infreared")); close(fd_fifo2);}else if(!strcmp("cmd7",cmd)){fd_fifo1 = open("FIFO_1",O_RDWR);write(fd_fifo1,"get_camera",strlen("get_camera"));close(fd_fifo1);}else if(!strcmp("cmd8",cmd)){fd_fifo4 = open("FIFO_4",O_RDWR);write(fd_fifo4,"send_info",strlen("send_info"));close(fd_fifo4);}return 0;}登陆界面及调用的相关CGI函数的实现int main(){char *info;FILE *fp;char usr_pwd[]="textfield=name&textarea=12345";用户自己设定的名字和密码char pri_pwd[50];int i=0,j=0;printf("Content-type:text/html\n\n");注意上一行不能省略printf("<html><title>get name & pwd</title>\n");if (getenv("QUERY_STRING")){info = getenv("QUERY_STRING");while(j!=2){pri_pwd[i]=*(info+i);if(pri_pwd[i]=='&'){j++;}i++;}While语句用于实现把第二个&符之前的参数存到字符数组中去pri_pwd[i-1]='\0';if(!strcmp(usr_pwd,pri_pwd)){printf("<metahttp-equiv=\"refresh\"content=\"1;url=../index.html\">"); }如果名字和密码输入正确进入index页面else{printf("用户名或密码错误,请重新输入!\n");printf("<metahttp-equiv=\"refresh\"content=\"2;url=../land.html\">");}出错则返回登陆界面}printf("</html>");return 0;}。

相关文档
最新文档