我的ci会话有这个奇怪的问题.在localhost上工作正常,但在线日志显示错误:
会话cookie数据与预期不符.这可能是一次可能的黑客攻击.
我删除了所有cookie并清空了会话表.我还将user_agent长度设置为255. Basepath也是正确的.记录会话ID时的注意事项如下:
在登录页面上,当检查用户名/ pw时,id是相同的,然后我转到id已更改的成员区域.
另一个例子:
1.我去会员区,会话ID设置,我没有登录,我发送到登录
2.在登录页面,会话ID被更改,我登录
3.验证,会话ID不变,我'已经过验证并发送到会员区
4.在会员区,会话ID已更改,我尚未登录.
在登录页面上,我的会话表计数0行,当我登录会话表计数2/3行时.其中1个,但不是具有当前会话ID的那个保存所有正确的数据.
希望有人可以帮助我.
我使用以下代码从数据库中删除记录.但是我遇到了一个问题:当我点击确认框中的"取消"时,它会删除记录.如果我点击cancel它返回false但它如何删除记录?
怎么了?
Javascript代码:
function ConfirmDialog() {
var x=confirm("Are you sure to delete record?")
if (x) {
return true;
} else {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
视图中的PHP代码:
<?php
echo anchor('user/deleteuser/'.$row->id, 'Delete', array('class'=>'delete', 'onclick'=>"return ConfirmDialog();"));
?>
Run Code Online (Sandbox Code Playgroud) 在杂货店中,相关表格不会进行搜索.
搜索仅发生在该表字段中.
function index() {
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('table_name');
$crud->display_as('id','Name');
$crud->callback_column('id', array($this, 'changeName'));
$output = $crud->render();
}
Run Code Online (Sandbox Code Playgroud)
function changeName($value, $row) {
$new = $this->db->select('name')->where('another_table.id', $row->id)->get('another_table')->result();
if(!empty($new)){
return $new[0]->name;
} else {
return $value;
}
}
Run Code Online (Sandbox Code Playgroud)
这里搜索名称没有发生.
有人有解决方案吗?
提前致谢.
我正在使用jQuery autocompleter进行搜索.
从我的下面的代码我的搜索只发生在区分大小写,我想进行不区分大小写的搜索.例如.$array={the king, The king, The man}
我的搜索关键字是"The",然后我目前只得到输出,就像{The king, The man}
我没有得到的,the king因为它是小写的.
我想要的是,如果我写"the"那么我应该得到所有三个结果.
请帮我解决我的问题
view.php
<script type="text/javascript">
$(document).ready(function() {
$(function() {
$( "#autocomplete" ).autocomplete({
source: function(request, response) {
$.ajax({ url: "<?php echo base_url().'search/suggestions'?>",
data: { term: $("#autocomplete").val()},
dataType: "json",
type: "POST",
success: function(data){
response(data);
}
});
},
minLength: 3,
select: function (a, b) {
$(this).val(b.item.value);
$(".searchform1").submit()
}
});
});
$('#autocomplete').focus();
});
function monkeyPatchAutocomplete() {
// Don't really need to save the old fn, …Run Code Online (Sandbox Code Playgroud) 我正在使用CI与数据库相关的会话.所以我们所有的会话都在我们数据库的ci_sessions表中,并且考虑到session_id每5分钟不断变化,它可以获得很多行.
我们是否需要清空餐桌,可能每个月/每周说一次?
假设我有一个名为的控制器
网页
并且有一种方法
slug_on_the_fly
public function slug_on_the_fly($slug)
我的路线怎么样?
例如,对于博客控制器,它很容易:
$route['blog/(:any)'] = 'pages/slug_on_the_fly/$1';
Run Code Online (Sandbox Code Playgroud)
然后http://localhost/blog/name-of-the-article效果很好
但是,如果我想这样做就好了blog,例如
http://localhost/name-of-the-article 要么 http://localhost/another-article-blablabla
怎么做,不要打破另一条路线,例如$route['friends'] = 'users';或$route['about-us'] = 'pages/about_us';?
因为如果我这样做:
$route['(:any)'] = 'pages/slug_on_the_fly/$1';
它可能会破坏其他一切或?
我正在使用codeigniter*capctha*帮助器.事情是我不能增加字母的字体大小.我试着这样做
if ($use_font == FALSE)
{
$font_size = 6;
$x = rand(0, $img_width/($length/2));
$y = 0;
}
else
{
$font_size = 20;
$x = rand(0, $img_width/($length/1.5));
$y = $font_size+2;
}
Run Code Online (Sandbox Code Playgroud)
但没有任何反应,如何改变字体大小,请帮忙.提前致谢.
我在一个请求一些json内容的页面上有几个ajax调用.在所有这些电话中,我在响应完成时获得了大量的等待时间.对于这些呼叫中的每一个,呼叫都会有几秒钟的"等待"时间,如下面的"Chrome网络"面板中所示.我附上了一张照片:

我不确定是什么导致了这一点,因为我对查询数据库的php代码进行了一些基准测试,并据此调用查询和处理json发回的调用在0.001秒左右运行.
那么,这只是网络延迟吗?这是一个我没有正确进行数据库查询的问题吗?也许我充斥着每个浏览器窗口的最大连接数?不知道.其他请求的移动速度一样慢,所以看起来它可能是一致的.
这是其余请求计时的另一张照片(其他主要的ajax调用与get_usergames_simple调用的时间一样多:
作为参考,这里是ajax调用:
self.getGamesContent = function()
{
var userID = "<?php echo $userID; ?>";
var post_data = {
userID: userID
};
$.post("https://mydomain.com/games/get_usergames_simple/", post_data, function(result)
{
var json = $.parseJSON(result);
var mappedGames = $.map(json.games, function(item) {
return new GameItem(item)
});
self.gameitems(mappedGames);
});
};
Run Code Online (Sandbox Code Playgroud)
这是运行查询的控制器中的php代码:
$userID = $this->input->post('userID');
$this->benchmark->mark('code_start');
$userGames = $this->cache->model('games', 'getGamesSimpleByUserID', array($userID), 120); // keep for 2 minutes
$returnString = "{";
$returnString .= '"user_id": "' . $userID . '",';
$gameCount = 0;
$returnString .= '"games": [';
foreach ($userGames …Run Code Online (Sandbox Code Playgroud) 使用Codeigniter会话库时,我无法理解一个问题.相同的网络用户使用相同的会话(我们与一家大公司合作,他们这样说:当有人登录系统,然后每个人都登录)!这可能吗?如何以及如何解决此问题?
我正在使用Codeigniter核心会话库,它使用数据库.
我是CodeIgniter的新手并完成了我的第一个项目.但是,在我把它放在我的托管网站上之前,我想使用CodeIgniter在config文件夹中提供的routes.php文件来清理URL.
我的网站将使用以下网址加载:
http://fakehost:8888/TheWorksPlumbing/index.php/theWorksPlumbingController/index/home
http://fakehost:8888/TheWorksPlumbing/index.php/theWorksPlumbingController/index/about
http://fakehost:8888/TheWorksPlumbing/index.php/theWorksPlumbingController/index/services
Run Code Online (Sandbox Code Playgroud)
它还将使用以下默认控制器URL加载主页: http://fakehost:8888/TheWorksPlumbing/
但是,我希望网站的每个页面都有一个网址,但无法让它工作.例如,我想:
http://fakehost:8888/TheWorksPlumbing/home
http://fakehost:8888/TheWorksPlumbing/about
http://fakehost:8888/TheWorksPlumbing/services
Run Code Online (Sandbox Code Playgroud)
以下是theWorksPlumbingController控制器文件的代码:
class TheWorksPlumbingController extends CI_Controller {
public function index($page = 'home'){
if ( !file_exists('application/views/'.$page.'.php') ) {
show_404();
}
$this->load->view('templates/header');
$this->load->view($page);
$this->load->view('templates/footer');
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的routes.php文件中的代码不起作用:
$route['default_controller'] = "theWorksPlumbingController";
$route['404_override'] = '';
$route['(:any)'] = "index.php/theWorksPlumbingController/index";
Run Code Online (Sandbox Code Playgroud)
我需要添加或更改以使网站只加载/ home或/ about或/ services?
codeigniter ×10
php ×8
session ×3
ajax ×1
captcha ×1
crud ×1
database ×1
grocery-crud ×1
helper ×1
javascript ×1
jquery ×1
knockout.js ×1
mysql ×1
routing ×1
url-routing ×1