抱歉,在我的旧项目中,我使用MD5来加密密码是新的,但是,它不够安全,我发现互联网上的一些资源建议使用密码盐.
问题是,我使用的是codeigniter,是否有任何帮助/库用于此目的/如何更改旧代码以支持生成密码盐?
谢谢你的帮助.我使用的是PHP 5.2
这里是旧代码验证,而用户帐户通过存储生成 md5($password);
function validate_credentials() {
$this->load->model('Secure_model');
$username = $this->input->post('username');
$password = md5($this->input->post('password'));
$is_valid = $this->Secure_model->validate('customer', $username, $password);
if ($is_valid) {
$data = array(
'user_id' => $this->get_user_id($username),
'user_name' => $username,
'is_logged_in_user' => true
);
$this->session->set_userdata($data);
redirect('profile');
} else {
$data['message_error'] = TRUE;
$data['main_content'] = 'front/login';
$this->load->view('front/includes/template', $data);
}
}
Run Code Online (Sandbox Code Playgroud) php security codeigniter password-protection password-encryption
问题是有一个edittext我想设置它默认有一个光标就可以了(但没有焦点和隐藏键盘)
尝试
android:textCursorDrawable="@null"
android:cursorVisible="true"
<EditText
android:id="@+id/comment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:background="@drawable/comment"
android:hint="@string/cmt"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textColor="#AAACAD"
android:textColorHint="#AAACAD"
android:textCursorDrawable="@null"
android:cursorVisible="true"
android:textSize="15sp" />
Run Code Online (Sandbox Code Playgroud)
但不行.请帮忙.非常感谢
var patt = path.match(/P[0-9][0-9][0-9]/);
patt = patt.substr(1); //Remove P
while(patt.charAt(0) === '0') { //Remove 0
patt = patt.substr(1);
}
alert(patt);
Run Code Online (Sandbox Code Playgroud)
patt固定为这种格式:例如.P001至P999
我想做的是非常基本的,只需删除P和领先0(如果有的话).但是,上面的代码不起作用.谢谢你的帮助
问题是我想在触发mouseevent功能时只触发一次,例如
$(document).ready(function() {
$("#menu").click(function(){
$('#menu_div').show();
menu_function();
});
$("#menu_close").click(function(){
$('#menu_div').hide();
});
});
function menu_function(){
$(".select_li").live(
"click",
function() {
alert("test");
}
);
}
Run Code Online (Sandbox Code Playgroud)
该示例有两个对象,菜单和菜单关闭; 当菜单按下时,显示ui框,并运行menu_function,它会触发警报测试消息.问题是当单击menu_close并关闭框并再次打开它时,警报测试将触发两次.我观察到div盒的关闭和再次打开的时间与功能的开火时间相同,我该如何解决?
如果我不想使用unbind,有没有更好的解决方案?
我目前正在使用index.php来包含另一个文件,它的结构如下:
root / index.php
/ new/ index.php
/ img/ test.jpg
Run Code Online (Sandbox Code Playgroud)
我在root/index.php中写了以下内容:
<?php
require_once("new/index.php");
?>
Run Code Online (Sandbox Code Playgroud)
问题是,其中的所有路径都是错误的.因为所有路径都基于new/index.php.
例如,在new/index.php中,我的test.jpg就像
<img src="img/test.jpg" />
Run Code Online (Sandbox Code Playgroud)
它显示http://www.test.com/new/img/test.jpg我何时直接访问new/index.php
但它显示http://www.test.com/img/test.jpg我在index.php中包含php.
怎么解决?我试过chdir(),但它不起作用期待谢谢
以PHP为例,有一个数组:
$list = array("a", "b", "c");
Run Code Online (Sandbox Code Playgroud)
我想得到数组的第N个元素,好像它是一个无限循环.例如,这里的第11个元素是"b":
a b c a b c a b c a b c ...
1 2 3 4 5 6 7 8 9 10 11 12 ...
^
Run Code Online (Sandbox Code Playgroud)
如何循环数组才能得到这个?
php ×3
javascript ×2
jquery ×2
android ×1
codeigniter ×1
function ×1
include ×1
include-path ×1
loops ×1
require ×1
security ×1
string ×1
unbind ×1