zoukankan      html  css  js  c++  java
  • 嵌入式开发实践的简单登录代码

    #include <stdio.h>
    int main() {
    printf("Content-type:text/html "); //CGI的头
    printf("<html>");
    printf("<head>");
    printf("<title>test</title>");
    printf("</head>");

    printf("<body>");
    printf("<fieldset>");

    printf("<form method ='POST' action='http://localhost:8080/test/hello.html?login=%B5%C7%C2%

    BC' name='frmLogin' >");
    printf("<tr>");
    printf("<td>用户名:</td>");
    printf("<td><input type='text' name='username' value='Your name' size='20' maxlength='20'

    onfocus='if (this.value=='Your name') this.value='';' /></td>");
    printf("<td > </td>");
    printf("<td> </td>");
    printf(" </tr>");
    printf("<tr>");
    printf("<td>密 码:</td>");
    printf("<td><input type='password' name='password' value='Your password' size='20'

    maxlength='20' onfocus='if (this.value=='Your password') this.value='';' /></td>");
    printf("<td> </td>");
    printf(" <td> </td>");
    printf("</tr>");
    printf("<tr>");
    printf("<td><a href='#' onclick='shuaxin();'>刷新</a></td>");
    printf("</tr>");
    printf("<tr>");
    printf("<td><input type='checkbox' name='zlogin' value='1'>自动登录</td>");
    printf("</tr>");
    printf("</table>");
    printf("</td>");
    printf("<tr>");
    printf("<td> </td> ");
    printf("<td><table>");
    printf("<tr>");
    printf("<td><a href='http://192.168.0.115/cgi-bin/ad' input type='submit' name='login' onClick='return validateLogin
    ()'/>登录</a></td>");
    printf("<td><input type='reset' name='rs' value='重置'></td>");
    printf("</tr></tr></table></td></table></fieldset></form>");
    printf("<script language='javascript'>");
    printf("function validateLogin(){");
    printf("var sUserName = document.frmLogin.username.value ;");
    printf("var sPassword = document.frmLogin.password.value ;");
    printf("if ((sUserName =='') || (sUserName=='Your name')){");
    printf("alert('请输入用户名!');");
    printf("return false ;}");
    printf("if ((sPassword =='') || (sPassword=='Your password')){");
    printf("alert('请输入密码!');");
    printf("return false ;}}");
    printf(" </script></body></html>");


    }

  • 相关阅读:
    Thread类常用方法
    sql 语句NVL()用法
    SQL极限函数limit()详解<分页必备>
    查询用户上次登录时间问题
    ROWNUM-Oracle中的分页代码
    分组统计查询
    Oracle中的多表查询
    Oracle中的单行函数
    JDBC中的事务-Transaction
    MySql中增加一列
  • 原文地址:https://www.cnblogs.com/dys6/p/11304142.html
Copyright © 2011-2022 走看看