error with database

2011-02-27 Thread a17s
Hello,
I am having an issue with a cakephp site. I keep having an error in
connecting to mysql database though my database config seems correct.
Any suggetions.
Find below error messages

Warning (2): mysql_connect() [function.mysql-connect]: Can't connect
to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 540]
Code | Context

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


media view

2011-02-22 Thread a17s
Hello,
I am trying to use the MediaView class to set a download of pdf file.
So far my attempts are not working and I can't seem to find any fault
in my code copied from the book.cakephp.org website. Any help or
thoughts will be appreciated.

Find sample code below:


$this->view = 'Media'; //set to media download
$params = array(
'id' => 'catalogue.pdf',
'name' => 'new_catalogue',
'download'=>true,
'extension' => 'pdf',
'path' => $this->webroot . 'files' . DS   );
$this->set($params);

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Database modelling

2010-10-16 Thread a17s
Hello all, I have a dummy application which has public users and admin
users entities. Public users can belong to a Group while Admin users
can manage the Group and those joining the group. Should the Admin be
a separate model from the Public user or can both be in the same
model, e.g User and be managed using a role_id?

Thanks.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


auth

2010-10-15 Thread a17s
Hello, I'm trying to use the Auth component but cannot redirect or
allow request to the webroot of a test site using $this->Auth-
>redirect('/'), and $this->Auth->allow('/');
Kindly suggest possible ways to get this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP Authentication component

2010-10-07 Thread a17s
Thanks a lot. Got it working. Had to fix my login form fields as well
to match my Auth->field() specified.

On Oct 7, 5:49 pm, cricket  wrote:
> Auth hashes password fields automatically, so it's being hashed twice here.
>
> On Thu, Oct 7, 2010 at 12:31 PM, a17s  wrote:
> > I am trying to register and authenticate users using the Auth
> > component in CakePHP but keep getting a failed login attempt even with
> > the right credentials. Please see below my register and login function
>
> > var $components = array('Auth');
> > ...
> > function register(){
> >                if(!empty($this->data)){
> >                        $this->data['User']['password'] = 
> > $this->Auth->password($this-
> >>data['User']['password']);
> >                        $this->User->create($this->data);
> >                        if($this->User->save($this->data)){
> >                                $this->Session->setFlash('Congratulations, 
> > your account has been
> > successfully created. Password: '.$this->data['User']
> > ['password']);
> >                                $this->redirect(array('controller'=>'users',
> > 'action'=>'index'));
> >                        }
> >                                else{
> >                                //unable to save data
> >                                $this->Session->setFlash(__('Unable to 
> > register user, please try
> > again'));
> >                        }
> >                }
> >        }
>
> > function login(){
>
> >        }
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


CakePHP Authentication component

2010-10-07 Thread a17s
I am trying to register and authenticate users using the Auth
component in CakePHP but keep getting a failed login attempt even with
the right credentials. Please see below my register and login function

var $components = array('Auth');
...
function register(){
if(!empty($this->data)){
$this->data['User']['password'] = 
$this->Auth->password($this-
>data['User']['password']);
$this->User->create($this->data);
if($this->User->save($this->data)){
$this->Session->setFlash('Congratulations, your 
account has been
successfully created. Password: '.$this->data['User']
['password']);
$this->redirect(array('controller'=>'users',
'action'=>'index'));
}
else{
//unable to save data
$this->Session->setFlash(__('Unable to register 
user, please try
again'));
}
}
}

function login(){

}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


redirect not working

2010-10-06 Thread a17s
Hello, got a problem with using cakephp redirect. Get an error saying
header already been set. Please how can I redirect to another action
after processing a post. My error keeps pointing to the cake/
basic.php, and the controller/controller.php

See error and code below:

Error

Congratulations, your new account has been successfully created

Warning (2): Cannot modify header information - headers already sent
by (output started at /home/asco3112/public_html/projects/library/cake/
basics.php:655) [CORE/cake/libs/controller/controller.php, line 746]
Code | Context

$status =   "Location: http://a17s.com/projects/library/users";

header - [internal], line ??
Controller::header() - CORE/cake/libs/controller/controller.php, line
746
Controller::redirect() - CORE/cake/libs/controller/controller.php,
line 725
UsersController::register() - APP/controllers/users_controller.php,
line 97
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83

Code

function register(){
if(!empty($this->data)){
$this->User->create($this->data);
if($this->User->save($this->data)){
$this->Session->setFlash(__('Congratulations, 
your new account has
been successfully created'));
unset($this->data);
$this->redirect(array('controller'=>'users',
'action'=>'index'));
}
else{
//unable to save data
$this->Session->setFlash(__('Unable to register 
user, please try
again'));

}
}
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en