Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无数据库的codeigniter登录控制器_Codeigniter - Fatal编程技术网

无数据库的codeigniter登录控制器

无数据库的codeigniter登录控制器,codeigniter,Codeigniter,我想创建一个演示帐户。如何创建不需要数据库的简单登录控制器 这是我的看法 <div class="col-lg-12"> <label class="control-label"> Username / Email Address </label> </div> <div class="col-lg-12"> <input class="f

我想创建一个演示帐户。如何创建不需要数据库的简单登录控制器

这是我的看法

  <div class="col-lg-12">
     <label class="control-label">
           Username / Email Address
      </label>
      </div>
      <div class="col-lg-12">
          <input class="form-control" type="text" name="email_address" autofocus />
      </div>
      <div class="col-lg-12">
          <label class="control-label">
                Password:
          </label>
       </div>
       <div class="col-lg-12">
           <input class="form-control" type="password" name="password" />
       </div>
       <div class="col-lg-12">
           <input type="submit" name="button" value="" class="btn-submit-student"/>
   </div>

用户名/电子邮件地址
密码:
使用这个我理解你的问题


您不需要数据库吗?对于最佳实践,您需要数据库是很好的。或者只使用
==
是我不需要数据库。以纯文本形式存储密码不是一个好主意。您可以轻松地
sha1()
/
散列('sha256',xxx)
这一点,如果不加盐的话。在新编辑中,您仍然以纯文本形式存储密码。我仍然可以看到密码是我的密码。您需要在应用程序之外对其进行SHA1。例如,
$u_pw='b44885d6c6d33c97192b69fa4d1c3acb53fa5a39'
。然后,您需要对发布的密码进行散列,例如:
sha1($pw)==$u_pw
您不需要对用户名进行散列@很好,我不知道那些方法!
<?php
if(isset($_POST['button']))
{
    $user = $_POST['email_address'];
    $pw = $_POST['password'];

    if($user =='my_username' and $pw=='My_Password')
    {
        //code if user name and Password matched
        echo 'Sucess';
    }
    else
    {
        //username and password Failed
        echo 'Failed';

    }
}