• 3.1.2 视图实例演示-登录页面


      function do_login(){
    		   //获取用户名和密码信息,和数据库中比对
    		   // echo 111111111;
    		    dump($_POST);
    		   // dump($_SESSION);
    		   $username=$_POST['username'];
    		   $password=$_POST['password'];
               $code=$_POST['code'];
    		    if($_SESSION['verify']!==md5($code))
    			{
    			$this->error('验证码错误');
    			}
    			/* else
    			{$this->show('登录成功');}
    			 */
    			$m=new Model('user');
    			$where['username']=$username;
    			
    			//$where['password']=$password;
    			
    			$i=$m->where($where)->count();
    			
    			
    			
    			
    dump($_POST); 打印出来的内容:
    
    array (size=3)
      'username' => string 'gege' (length=4)
      'password' => string '1234567' (length=7)
      'code' => string '2268' (length=4)
      
      
      登录页面:
      <!-- form 表单 table 表格 td 单元格 tr 行标签 -->
    
    <!doctype html>
    <html lang="en">
     <head>
    
      <meta name="Generator" content="EditPlus?">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
     
     <title>Document</title>
    
     
    	
      <link rel='stylesheet' type='text/css' href='__PUBLIC__/Css/login.css'/>
       <link rel='stylesheet' type='text/css' href='__PUBLIC__/Css/basic.css'/>
       <script src="__PUBLIC__/Js/login.js"></script>
     </head>
     
     <body>
      <!doctype html>
    <html lang="en">
     <head>
    
      <meta name="Generator" content="EditPlus?">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <title>Document</title>
     </head>
     <body>
     <center>
     <h1>中均运维管理平台</h1>
       <!--图片标签-->
    <img class="img_bk" src="__PUBLIC__/Images/scan.jpg"/>
     </center>
     <!--表单提交-->
     <form action='__URL__/do_login' method='post' name="myForm">
    
    <center>
    <table cellspacing="0" cellpadding="0">
    
    <tr>
    
    <td class="td1">用户名:</td>
    <td><input type="text" name="username"/></td>
    <td class="td3"></td>
    <tr/>
    
    <tr>
    <td class="td1">密码:</td>
    <td><input type="password" name="password"/></td>
    <td class="td3"></td>
    <tr/>
    
    
    <tr>
    	<td class="td1">验证码:</td>
    	<td>   <input type='text' name='code' /></td>
    	<td class="td3"><img src="__APP__/Public/code" onclick='this.src=this.src+"?"+Math.random()'/></td>
    </tr>
    
    <center>
    <tr>
    	<td class="td1"></td>
    	
    	<td>
    	<!-- onclick 一个事件  login()方法来自__PUBLIC__/Js/login.js-->
    	<img src="__PUBLIC__/Images/login.jpg" onclick="login()"/>
    	<!--img src="__PUBLIC__/Images/login.jpg" />-->
    	</td>
    	<td class="td3"></td>
    </tr>
    <center/>
    <center/>
    
     </form>
    
     </body>
    </html>
    
     </body>
    </html>
      

  • 相关阅读:
    LocalDateTime和Date使用@JsonFormat显示毫秒时间
    curl查看ip的几种方式
    thinkphp5.1生成缩略图很模糊
    ajax发送时禁用按钮
    thinkphp5 不使用form,用input+ajax异步上传图片
    GOLANG 闭包和普通函数的区别
    GOLANG 匿名函数笔记
    父级自适应自己高度且高度完全一致css
    子元素等高 css
    ios 用jquery为元素标签绑定点击事件时,ios上不执行点击事件
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199522.html
Copyright © 2020-2023  润新知