cakephp

Updating user with or without password - CakePHP

百般思念 提交于 2020-01-11 07:53:09
问题 I try to find a good and clean way to deal with an admin panel "edit user" in cakePHP v.2.7. To be clear : I want to be able to edit my user with or without overwriting their password, but the cakePHP validator tool don't let me do what I want... I've already take a look at CakePHP: Edit Users without changing password and Updating user email and password with CakePHP but it seem really dirty : the first one don't apply the rules onUpdate the second display the hash (just no... u_u") There is

CakePHP 2 separate login tables

↘锁芯ラ 提交于 2020-01-10 15:27:12
问题 I have a Cake website and it needs to have two separate logins, each one will have their own login form and see different pages, it would be nice to have two different tables because there are no similarities between the two types of people. Each login form will only be used by certain people and they will never login to the other form, and vice versa. Also, the two login tables have a relationship between them, which requires 2 tables? Is this possible? 回答1: First, add a couple of empty

CakePHP 2 separate login tables

白昼怎懂夜的黑 提交于 2020-01-10 15:26:32
问题 I have a Cake website and it needs to have two separate logins, each one will have their own login form and see different pages, it would be nice to have two different tables because there are no similarities between the two types of people. Each login form will only be used by certain people and they will never login to the other form, and vice versa. Also, the two login tables have a relationship between them, which requires 2 tables? Is this possible? 回答1: First, add a couple of empty

Last x blog entries - but only once per user

冷暖自知 提交于 2020-01-10 03:24:49
问题 I would like to display a box with the last x (say 5) blog entries. But I would like to avoid that a very active user is listed twice. My tryout boils down to: $stats['blog'] = $this->User->Blog->find('all', array( 'order'=>array('Blog.published' => 'DESC'), 'conditions' => array('Blog.status' => 1), 'contain' => array('User.username'), 'group' => array('User.id'), 'limit' => 5, )); But - of course - it groups too soon without the chance of sorting it first. The resulting sql often loses the

Error: Allowed memory size of 67108864 bytes exhausted

ⅰ亾dé卋堺 提交于 2020-01-10 03:03:57
问题 When I upload a picture File size: 375kb Width: 2000px Height: 3000px I get an error ERROR Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2157 bytes) in... Why this happen, when 67108864 = 64MB? I use a shared server. My .htaccess is: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] </IfModule> where must I write php_value memory_limit 128M ? 回答1: It seems you only have 64M (67108864 / 1024 / 1024) allocated

CakePHP Auth Component Using 2 Tables

倾然丶 夕夏残阳落幕 提交于 2020-01-10 01:35:27
问题 CakePHP Version 1.2.5 I would like a single user to have multiple email addresses. I would like a single user to have a single password. I would like users to log in using any of their multiple email addresses and their single password. I have created a users table with an id and a password field. I have created a user_email_addresses table with an id field a user_id field and an email_address field. Question: How do I modify the auth component minimally to look for the "username" in this

CakePHP Session Timeout on Inactivity only

佐手、 提交于 2020-01-09 06:20:14
问题 So the crux of this question is just how to prevent CakePHP from de-authenticating a session ONLY after a period of inactivity. So, if the user does nothing then I expect CakePHP to log them out after a period of 30 minutes. However, if the user chooses to visit a page on the 28th minute of inactivity, then CakePHP should 'reset' it's timeout counter. This currently isn't happening. Regardless of activity, CakePHP times out after the specified time in my core configuration (app/Config/core

How do you make strings “XML safe”?

拈花ヽ惹草 提交于 2020-01-09 02:15:28
问题 I am responding to an AJAX call by sending it an XML document through PHP echos. In order to form this XML document, I loop through the records of a database. The problem is that the database includes records that have '<' symbols in them. So naturally, the browser throws an error at that particular spot. How can this be fixed? 回答1: By either escaping those characters with htmlspecialchars, or, perhaps more appropriately, using a library for building XML documents, such as DOMDocument or

CakePHP中Element的运用!

半腔热情 提交于 2020-01-08 23:32:55
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 最近整个团队在通过协作完成一个类似各大网站邮件服务的功能!以让大家把之前所学的内容与实际的项目相结合起来!首先我把自己负责的那小部分功能通过这篇文章总结一下! 我们先看下效果图! 功能介绍:统计当前用户收件箱,发送箱以及保存箱中邮件的数量;当天以及昨天发送和接收邮件的数量。由于这些统计信息可以在许多地方使用到,所以我把它做成了一个element! 首先我们把元素文件放在views/elements/目录下,其代码片段为: requestAction(array('controller'=>'notes','action'=>'info')); ?> info 收件箱: 发送箱: 保存箱: 今日发送: 今日接收: 昨日发送: 昨日接收: 请注意requestAction最适合用在(使用了缓存的)页面元素(element)的相关处理上,用于在渲染页面之前取得该元素需要的数据。 然后我们来看下notes控制器中info()action中的代码片断: //get yesterday sent $ysent = $this->Note->SentNote->find('count',array( 'conditions'=>array( $yconditions, 'SentUser.id' => $this->Auth

Cakephp routing (in PHP too) [closed]

限于喜欢 提交于 2020-01-07 09:38:50
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I am using Cake, but how do I make the routing like: Router::connect('/', array('controller' => 'homes', 'action' => 'index')); case insensitve? For instance: Router::connect ( '/:user', array('controller' =>