在你说它是另一个问题的副本之前,请继续阅读.
我的开发环境是:
我需要的 :
提示:
会是什么,你建议?
我有一个简单的html登录表单
<form method="post" action="http://www.example.com/login">
<input type="text" name="text_box" />
<input type="password" name="pass_word" />
<input type="submit" name="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
当我提交表格并在控制器中
public function login(){
$pass_word = $this->input->post('pass_word');
die($pass_word);
}
Run Code Online (Sandbox Code Playgroud)
这里的问题,它显示了普通密码,如果我输入123456控制器,我得到123456.
wireshark吗?怎么避免这个?在发送到控制器之前,我可以在视图中加密密码吗?请提前帮助,谢谢.
我们使用Phil Sturgeons酷的Restful API框架为codeigniter构建了我们的API ,这是生产就绪并且用作我们的移动应用程序实现的一部分.
在Java中使用API时遇到问题
httpConnection = (HttpConnection) Connector.open(url, Connector.READ, true);
// Set content type by given parameter......
httpConnection.setRequestProperty("Accept", contentType);
httpConnection.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/FCLDC-1.0");
httpConnection.setRequestProperty("Content-Type", contentType);
httpConnection.setRequestProperty("TK-API-KEY", UrlFactory.TK_API_KEY);
// httpConnection.setRequestProperty("Model",
// StyleUtil.getDeviceModel());
if (httpConnection.getResponseCode() == 302)
{
String redirectUrl = httpConnection.getHeaderField("Location");
httpConnection = (HttpConnection) Connector.open(redirectUrl, Connector.READ_WRITE, true);
}
if (httpConnection.getResponseCode() == HttpConnection.HTTP_OK)
{
io = httpConnection.openInputStream();
int ch;
while ((ch = io.read()) != -1)
{
bo.write(ch);
}
}
Run Code Online (Sandbox Code Playgroud)
httpConnection.getResponseCode()无法获取状态代码并返回格式错误的异常.我们的API服务器是NGINX.
我遇到了一个问题......
我有一堆像这样的陈述......
$this->db->where('Pool', "1");
$this->db->where('Bedrooms >=', "3");
Run Code Online (Sandbox Code Playgroud)
然后是限制声明
$this->db->limit($limit, $offset);
Run Code Online (Sandbox Code Playgroud)
最后我得到了声明
$query = $this->db->get('table-name');
Run Code Online (Sandbox Code Playgroud)
我的问题是我需要在我的限制语句之前计算结果,以获得没有限制的总行数.所以我尝试了这个..
$this->db->where('Pool', "1");
$this->db->where('Bedrooms >=', "3");
$num_rows = $this->db->count_all_results();
$this->db->limit($limit, $offset);
$query = $this->db->get('table-name');
Run Code Online (Sandbox Code Playgroud)
这将使用where语句对我的行进行计数.但是,get语句现在获取没有先前where语句工作的记录.
它是不可见的,但有大量的代码处理更多的语句,并抓住网址中的东西,所以我宁愿不执行两次数据检索,以解决这个问题...
干杯!
我想知道是否有任何简单的方法在代码点火器中调试路由?
我希望能够在日志中看到以下内容:
Client sent : apps/something
Route found : apps/(:any) --> applications/searchbyname/$1
Redirecting : apps/something --> applications/searchbyname/something
//and just cause we can lets make the searchbyname function not exist
ERROR - 2012-09-16 22:10:05 --> 404 Page Not Found --> applications/searchbyname/something
Run Code Online (Sandbox Code Playgroud)
基本上它意味着我们可以看到我们何时到达路线以及它何时尝试加载.
有没有办法在这些方面启用某些东西?
我想用名为csrf_cookie_name的 cookie设置一个带有此函数的值$ this-> security-> get_csrf_hash(); 但是,它不起作用.
我在我的控制器中有这个:
$csrf_cookie_value = $this->security->get_csrf_hash();
$this->input->set_cookie('csrf_cookie_name', $csrf_cookie_value);
echo $this->input->cookie('csrf_cookie_name');
die();
Run Code Online (Sandbox Code Playgroud)
但它不起作用,没有任何回应.
如果我只尝试这个:
$csrf_cookie_value = $this->security->get_csrf_hash();
echo $csrf_cookie_value;
Run Code Online (Sandbox Code Playgroud)
我工作,生成的字符串被回显.
所以,我认为接下来的两行中的某些内容是错误的:
$this->input->set_cookie('csrf_cookie_name', $csrf_cookie_value);
echo $this->input->cookie('csrf_cookie_name');
Run Code Online (Sandbox Code Playgroud)
谢谢你的建议.
嗨,我需要验证这样的多维形式
<input type="text" class="input-xlarge span5 req" id="contact_first_name" name="hotel[<?=$id?>][contact_first_name]" value="<?= set_value('hotel[contact_first_name]') ?>">
<input type="text" class="input-xlarge span5 req" id="contact_last_name" name="hotel[<?=$id?>][contact_last_name]" value="<?= set_value('hotel[contact_last_name]') ?>">
Run Code Online (Sandbox Code Playgroud)
我不知道最终数组的维度,因为输入是通过jquery动态添加的.
我在服务器端使用Codeigniter Form_Validation,在客户端使用JQuery Validator通过JQuery.
这是我的form_validation规则
$config['add_hotel'] = array(
array(
'field' => 'hotel[][hotel_name]',
'label' => 'Hotel Name',
'rules' => 'required'
),
array(
'field' => 'hotel[][contact_first_name]',
'label' => 'First Name',
'rules' => 'trim|required'
),
array(
'field' => 'hotel[][contact_last_name]',
'label' => 'Last Name',
'rules' => 'trim|required'
),
Run Code Online (Sandbox Code Playgroud)
这就是我通过jquery验证器做的方式
$("#add_hotel").validate({
rules: {
"hotel[][hotel_name]": "required"
/* errorElement: "div",
wrapper: "div"*/
},
messages: {
"hotel[][hotel_name]": …Run Code Online (Sandbox Code Playgroud) 我已经设置了codeigniter来上传小于2MB的小文件,并且工作正常.但我无法上传大型文件20MB>
function stage1()
{
ini_set('upload_max_filesize', '200M');
ini_set('post_max_size', '200M');
ini_set('max_input_time', 3000);
ini_set('max_execution_time', 3000);
$config['upload_path'] = './temp/';
$config['allowed_types'] = 'zip';
$this->load->library('upload', $config);
$this->upload->initialize($config);
if(!$this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
//do stuff
}
}
Run Code Online (Sandbox Code Playgroud)
我不确定上面的代码有什么问题.我重写php.ini接受更大的文件,并花更多的时间执行脚本,但它仍然返回相同的错误:
You did not select a file to upload.
Run Code Online (Sandbox Code Playgroud)
同样,这适用于小文件但不适用于大文件.
编辑:原来我的服务器提供商有限的文件上传,所以除了FTP文件之外没有解决方案.
<?php foreach($products as $product) : ?>
<li><a href="<?php echo base_url(); ?>main/products/<?php echo $product->id; ?>">
<?php echo $product->name; ?> </a></li>
<?php endforeach; ?>
Run Code Online (Sandbox Code Playgroud)
所以上面的代码获取了a中的所有记录DB并生成链接.表中的100条记录 - 我想将设计分成5列.所以我会这样做,CSS但我需要能够附上
<ul> on every 20 records</ul>
Run Code Online (Sandbox Code Playgroud)
我怎么能count循环并做到这一点?
我见过人们使用这段代码,我试图理解它的作用,因为我没有在任何codeigniter文档或数据库类的源代码中看到它.
$this->db->ar_orderby
Run Code Online (Sandbox Code Playgroud)