Re: CakePHP 2.4 Auth-login() always return TRUE ... ?

2015-06-07 Thread Rawal Hardik
I have same issue! Code seems almost seems.
Can anyone please help me out???plz

-- appcontroller

?php

// app/Controller/AppController.php
class AppController extends Controller {
 public $components = array(
'Session',
'Auth' = array(
'loginRedirect' = array(
'controller' = 'users',
'action' = 'index'
),
'loginAction' = array('controller' = 'users', 'action' = 
'login'),

'logoutRedirect' = array(
'controller' = 'users',
'action' = 'login',
),'authorize' = array('Controller')

)
);


public function beforeFilter() {
  $this-Auth-allow('index', 'view','login');
}
}
?

login.ctp

div class=users form
?php echo $this-Session-flash('auth'); ?
?php echo $this-Form-create('User'); ?
fieldset
legend
?php echo __('Please enter your username and password'); ?
/legend
?php echo $this-Form-input('username');
echo $this-Form-input('password');
?
/fieldset
?php echo $this-Form-end(__('Login')); ?
/div

controller

public function login() { 
 
if ($this-request-is('post')) {

 $this-Auth-authenticate['Form'] = array('fields' = array('username' 
= 'username'));
 //$this-request-data['User']['id'] = $this-User-id; 
 debug($this-request-data);
if ($this-Auth-login()) {
 $this-Session-setFlash(sprintf(Welcome %s!, 
$this-Auth-user('username')));
return $this-redirect($this-Auth-redirect());
}
$this-Session-setFlash(__('Invalid username or password, try 
again'));
}
}

help plz

On Tuesday, 15 April 2014 17:16:56 UTC+5:30, MedAL wrote:

 Hello,Iread the documentation to create a simple login form.each time I 
 try to log in it returns true  always;

 //UsersController
 public function login() { 
  if ($this-Auth-user()) {
 $this-redirect($this-Auth-redirect());
 }

 if ($this-request-is('post')) {

  $this-Auth-authenticate['Form'] = array('fields' = 
 array('username' = 'username'));
  $this-request-data['User']['id'] = $this-User-id; 
  debug($this-request-data);
 if ($this-Auth-login($this-request-data['User'])) {
  $this-Session-setFlash(sprintf(Welcome %s!, 
 $this-Auth-user('username')));
 return $this-redirect($this-Auth-redirect());
 }
 $this-Session-setFlash(__('Invalid username or password, try 
 again'));
 }
 }





 //AppController
 class AppController extends Controller {

 public $components = array(
 'Session',
 'Auth' = array(
 'loginRedirect' = array(
 'controller' = 'Events',
 'action' = 'index'
 ),
 'loginAction' = array('controller' = 'Users', 'action' = 
 'login'),

 'logoutRedirect' = array(
 'controller' = 'Users',
 'action' = 'login',
 'home'
 ),'authorize' = array('Controller')

 )
 );

 public function beforeFilter() {
 //parent::beforeFilter();
 $this-Auth-allow('index', 'view','login');
 /* $this-Auth-authenticate = array(
 'Basic' = array('userModel' = 'User'),
 'Form' = array('userModel' = 'User')
 );*/

 }



 //login.ctp


 div class=users form
 ?php echo $this-Session-flash('auth'); ?

 ?php echo $this-Form-create('User'); ?

 fieldset
 legend
 ?php echo __('Please enter your username and password'); ?
 /legend
 ?php echo $this-Form-input('username'); 
 echo $this-Form-input('password');
 ?
 /fieldset
 ?php echo $this-Form-end(__('Login')); ?
 /div


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


stocker un tableau avec l'option serialize() cakephp

2015-06-07 Thread moncif aidi
Bonjour,

https://lh3.googleusercontent.com/-HjI1kOgHZv4/VXFsJa5QsuI/ASg/fRNVvWHhx3M/s1600/Capture%2Bd%25E2%2580%2599e%25CC%2581cran%2B2015-06-05%2Ba%25CC%2580%2B10.29.46.png
est ce que quelqu'un peut m aidé pour stocker un tableau qui contient une 
colonne date par mois et des lignes de type d'absence , j'utilise cakephp , 
j'ai réussie de stocker une seul colonne, mais j'arrive pas de stocker tout 
le tableau . merci

voila mon code de mon controleur 

public function edit($id = null) {
if (!$this-Clas-exists($id)) {
throw new NotFoundException(__('Invalid clas'));
}
if ($this-request-is(array('post', 'put'))) {
 if ($this-Clas-saveAll($this-request-data)) {
$_POST['data']['Clas']= 
mysql_escape_string(serialize($_POST['data']['Clas']));
var_dump($_POST['data']['Clas']);
$this-Session-setFlash(__('The clas has been saved.'));
return $this-redirect(array('action' = 'index'));
} else {
debug($this-request-data);
$this-Session-setFlash(__('The clas could not be saved. Please, try 
again.'));
}
} else {
 $options = array('conditions' = array('Clas.' . $this-Clas-primaryKey 
= $id));
$this-request-data = $this-Clas-find('first', $options);
}
}

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


502 Bad Gatewa

2015-06-07 Thread Grzegorz Herman
Hello,
Can sameone help me, I have all the time 502 Bad Gateway when I make pr or 
similar functions. Besides this everything works fine.

error.log
2015/06/06 14:34:20 [error] 11591#0: *15 recv() failed (104: Connection 
reset by peer) while reading response header from upstream, client: 
83.238.276.91, server: domena.pl, request: POST /users/login HTTP/1.1, 
upstream: fastcgi://127.0.0.1:9000, host: domena.pl, referrer: 
http://domena.pl/users/login;



nginx
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /www/domena.pl/htdocs/webroot;
index index.php index.html index.htm;

server_name domena.pl www.domena.pl;

access_log /www/domena.pl/logs/access.log;
error_log /www/domena.pl/logs/error.log;

   location / {
index  index.php index.html index.htm;
try_files $uri $uri/ /index.php?$uri$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}





-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: cakephp 3.0- login and registration using custom tables

2015-06-07 Thread Leo Wong
Hello,

I have the same question, cakephp provide advance feature but require some 
specific Talbe/Field, How can we know more detail about those name ?
Thank you.

On Monday, June 1, 2015 at 5:39:15 AM UTC+8, sakshi bhalla wrote:

 Hello,
  
 can anyone please help me with the source code for login and registration 
 using custom tables.
 I am able to do using users table but not able to do using my existing db 
 tables.


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


containable

2015-06-07 Thread Lokesh S
Can we use containable in a model, Can anyone please suggest me on this ...

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Regarding module creation in cakephp v 3.0

2015-06-07 Thread Naman Kaushik
I am new to cakephp.
I want to break the whole module into module chunks .
How can I do that.
Please help me out.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Cake 2.x include multiple external php files in cakephp View

2015-06-07 Thread Curtis var jsonData
I want to include several external php files in a cakephp View 


*require_once and require methods*
I can use require_once() and require() to get one of the php files to show 
in the View. However, the rest of the 'require_once' php files do not show 
eg. THe page renders but only the first require_once / require shows in 
View.

Question: is there a limit to number of require_once's on a cakephp page?

*App::import('Vendor', 'phpfilename') method*

As an alternative I have tried to get App::import('Vendor', 'phpfilename') 
to work with no success. 

I have put the php files i wnat to include in the View into the Vendor 
folder.

Its not 100% clear to me from documentation, or various posts on 
App::import .. where the 'App::import' part goes.  

I have put *?php App::import('vendor', '**phpfilename'); ?  *in the View 
where i want to page to be included but doesn't work eg stops the page from 
rendering at that point.  

I suspect there is more to it but again not clear.

I am aware that the more advanced options of either a) building plugin or 
perhaps b) using helper, exist, but i am not up to that task.

So any advice on how to include the external files in View are warmly 
welcomed!!  


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


cakephp.org website problems

2015-06-07 Thread Jeffery Seiffert
Where or to who can I report bad links on the website too?

I even went to http://cakefoundation.org/contact and it has an internal 
error.

Thanks,

Jeffery

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Special table/column name

2015-06-07 Thread Leo Wong
Hi,

It seems there are some special table/column name will have advantage for 
cakephp, like the column name will be show rather than id. Th username 
and password also.

My question is, where can I found the information about the special name ?

Thank you.

Leo   

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.