• 嵌入式开发实践的简单登录代码


    #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>");


    }

  • 相关阅读:
    Jenkins(5)生成allure报告
    git 命令
    外连跳转微信
    微信分享接口
    微信接口
    计算php程序运行时间
    数组合并 不覆盖
    LARAVEL 分页
    laravel 随笔
    jq 监听返回事件
  • 原文地址:https://www.cnblogs.com/dys6/p/11304142.html
Copyright © 2020-2023  润新知