我登录时收到密码不匹配,当用户注册时,我将密码保存为
$password = password_hash($this->input->post('password'), PASSWORD_BCRYPT);
Run Code Online (Sandbox Code Playgroud)
当用户登录我正在检查这样的密码时,
$hash = password_hash($password, PASSWORD_BCRYPT);
$this->db->select('password');
$this->db->from('usersdetails');
$this->db->where('email', $email);
$this->db->limit(1);
$query = $this->db->get();
$passwordcheck = $query->row()->password;
if (password_verify($passwordcheck, $hash)) {
return true;
} else {
return false;
}
Run Code Online (Sandbox Code Playgroud)
但它总是返回密码不匹配..为什么????? 任何帮助深表感谢...
我的模型中有一个查询,我需要在视图中打印数据
模型
function get_bank()
{
$query = $this->db->query("SELECT
(
12* (YEAR('account_add_date') - YEAR('start_date')) +
(MONTH('account_add_date') - MONTH('start_date'))
) AS differenceInMonth
->FROM ('bank')
WHERE mem_id = '".$this->session->userdata('id')."'");
return $query->result();
$data['account_age'] = $query->row_array();
}
Run Code Online (Sandbox Code Playgroud)
我试图在我的模型中打印输出,但它不起作用,我不知道我哪里出错了.我是MVC的新手并且仍然习惯它.
视图
<h2>age of account</h2>
<?php
$age = $this->model('profiles_model' , $data );
print "<h2>$age</h2>";
?>
Run Code Online (Sandbox Code Playgroud)
调节器
function index()
{
$data = array();
$this->load->model('user_profile/profiles_model');
$query = $this->profiles_model->get_bank();
if(!empty($query))
{
$data['records'] = $query;
}
$this->load->view('profile_view', $data);
}
Run Code Online (Sandbox Code Playgroud) 我基本上是将表单值提交给我的控制器,而我正在使用CodeIgniter Framework.但是,当我将值发送到我的控制器的函数时,页面将更改为控制器并离开index.php(当前页面)
index.php文件:
<form action="<?php echo base_url();?>index.php/LoginController/loginuser" method="post">
<input id="login_emailbox" name="login_emailbox" type="text" class="form-control welcome-login-email" placeholder="Email" required="">
<input id="login_passbox" name="login_passbox" type="password" class="form-control welcome-login-password" placeholder="Password" required="">
<button id="loginbtn" type="submit" class="btn btn-info" style="margin-left: 30px">Login</button>
</form>
Run Code Online (Sandbox Code Playgroud)
LoginController.php:
class LoginController extends CI_Controller {
public function __construct()
{
parent::__construct();
}
function index()
{
$this->load->helper('html');
$this->load->helper('url');
$this->load->view('header');
$this->load->view('footer');
$this->load->view('index.php');
}
public function loginuser(){
echo $_POST['login_emailbox'];
echo $_POST['login_passbox'];
}
}
Run Code Online (Sandbox Code Playgroud)
我在运行时采取的步骤:
1)我通过=> http://localhost/codeig/index.php/LoginController/index浏览到index.php
2)填写表格并点击提交.值将提交给函数:loginuser
3)页面被重定向到'loginuser'函数
如何避免这种情况并基本上将值发送到控制器中的loginuser函数而不刷新当前页面?
我试图使用代码点火器PHP生成这个
<button type="submit" class="btn btn-bricky pull-right ">
Login
<i class="fa fa-arrow-circle-right"></i>
</button>Run Code Online (Sandbox Code Playgroud)
我在login_view.php中完成了这个
<?php
$data = array(
'class' => 'btn btn-bricky pull-right fa fa-arrow-circle-right',
'type' => 'submit',
'content' => 'Login'
);
echo form_button($data);
?>
Run Code Online (Sandbox Code Playgroud)
但它不会产生预期的结果.我怎么能使用codeigniter辅助函数来做到这一点?这是我想要使用codeigniter实现的纯粹样式相关的目标.
我正在使用CodeIgniter构建一个快速站点,目前我正在使用CI'加密'库.通过这里阅读听起来像我只是快速:
$this->encrypt->encode($secret_data);
Run Code Online (Sandbox Code Playgroud)
并在您想要使用它时执行此操作:
$this->encrypt->decode($encripted_string);
Run Code Online (Sandbox Code Playgroud)
然后CI和Mcrypt的魔力完成其余的工作.
好吧,我不确定在不知道后台发生了什么的情况下我可以睡觉.所以我有两个问题......
这是怎么回事?或者是否有一个很好的资源向我解释这是如何工作的,我可以阅读它?
这通常被认为是加密数据的安全方式吗?如果不是我应该在哪里看.
php encryption cryptography codeigniter encryption-symmetric
我试图从日期在当前日期的两周内的数据库中提取行,我正在使用CodeIgniter,这是我的模型:
function GetToDoItems($userID)
{
$range = date('Y-m-d', strtotime("+2 weeks"));
$query = $this->db->query("SELECT * FROM FYP_Milestones
INNER JOIN FYP_Modules ON FYP_Milestones.ModuleID = FYP_Modules.ID
WHERE FYP_Milestones.MilestoneDue < $range
ORDER BY FYP_Milestones.MilestoneDue ASC
");
return $query->result();
}
Run Code Online (Sandbox Code Playgroud)
它运行此查询:
SELECT * FROM FYP_Milestones INNER JOIN FYP_Modules ON FYP_Milestones.ModuleID = FYP_Modules.ID WHERE FYP_Milestones.MilestoneDue < 2016-04-14 ORDER BY FYP_Milestones.MilestoneDue ASC
Run Code Online (Sandbox Code Playgroud)
考虑到2016-04-07比2016-04-14还要少7天,我期待单独排一行,但是SQL返回空结果,为什么会这样呢?
PHP中是否有任何方法或函数可以从Internet获取特定时区的当前DateTime.不是本地系统的时间.请指导我.
我正在使用codeigniter控制器将数据推送到页面
public function trial(){
/* after commiting now show them the next page which will directly allow them to invest */
$usertable =$this->user_profile->getUserTable();
$userId = $usertable['ORIG_ID'];
$facebookId = $this->Facebook->getUser();
$sidebarData = array(
'userName' => $this->user_profile->getUserName(),
'facebookId' => $facebookId,
'caller' => 'investment_bucket'
);
$headerData = array(
$this->history->getPreviousPageInArray(),
'userName' => $this->user_profile->getUserName(),
'facebookId' => $facebookId
);
$investAmount = 100;
$loanPeriod = 60;
$investdata = array(
'investAmount' => $investAmount ,
'loanPeriod ' => $loanPeriod,
'pathName' => 'invest'
);
$this->load->view('header', $headerData);
$this->load->view('borrower_sidebar_view', $sidebarData);
$this->load->view("invest_created_basket_view",$investdata);
$this->load->view('footer'); …Run Code Online (Sandbox Code Playgroud) 我试图从我的一个页面访问boostrap.min.css文件,我收到以下错误
"NetworkError:403 Forbidden - http://localhost/mycodeigniter/ci/application/assets/css/boostrap.min.css
我已经在config.php文件中加载了我的url帮助器.并尝试访问我的控制器中的以下boostrap文件的路径
class User extends CI_Controller{
public function index(){
$this->load->view('users/user_index');
}
}
Run Code Online (Sandbox Code Playgroud)
在视图中的user_index页面:
<?php
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo base_url("ci/application/assets/css/boostrap.min.css"); ?>">
</head>
<body>
<h1>user index</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
从来没有遇到过这种类型的错误.我怎么能解决这个问题?
我一直在尝试更改CodeIgniter文件结构,使其更安全,更清洁,但我无法使其正常工作。我想分离将对用户可见的应用程序/系统和公共文件。
- application
- system
- public
Run Code Online (Sandbox Code Playgroud)
它有效,但我必须输入
example.com/public/index.php或example.com/public/controller
我希望能够像example.com/controller这样输入基本URL。
我该怎么做?
codeigniter ×10
php ×10
mysql ×3
html ×2
.htaccess ×1
cryptography ×1
css ×1
date ×1
encryption ×1
forms ×1
login ×1
passwords ×1