Thursday, December 20, 2012

Re: Find Method issue

On Thu, Dec 20, 2012 at 2:22 PM, Naveed Yousaf
<michaelsubhan994@gmail.com> wrote:
> Hi all,
> I have Sign In action which will get an email and password then it will
> sign in user and show him/her data. There is an issue in this system i-e i
> am having three user each of the user has his/her specific email (Primary
> key of Database) but its actually showing the data of user with id=1 no
> matter you send the email of user with id=4,5,6,7,8,9,10.....etc
>
> the action of Sign In is as follows:
> function SignIn(){
> if ($this->request->is('post')) {
> $email=$this->data['Donor']['Email'];

Should be all lowercase: ['email']

How do you create the form input?


> if($email==null){
> $this->Session->setFlash("Email and Password Not Entered");
> $this->redirect(array('action' => 'SignIn'));
> }
> $password=$this->data['Donor']['Password'];
>
> $Donoremial=$this->Donor->find('first',array('conditions'=>array('Donors_Email'=>$email)));

Donor (singular), email (lowercase) and separated by a dot (.)

> $useremail = Set::extract($Donoremial, '{n}.Donor_Email');

Same thing here.


> $int1= strcmp ( $email , $useremail);
> if($int1==0){
> # $passworduser=Set::extract($Donoremial,
> '{n}.Donor_Password');
> # $int2=strcmp($password,$passworduser);
> # if($int2==0){
> $this->user_Email=$email;
> $this->Session->started();
>
> $this->Session->write('Email',$this->data['Donor']['Email']);

['email']

> $this->redirect(array('action' => 'View'));
> # }
> # else{
> # $this->Session->setFlash(__("Wrong Email or
> Password"));
> # }
> }
> else{
>
> $Donoremial=$this->Staff->find('first',array('conditions'=>array('Staff_Email'=>$email)));

Staff.email

> $useremail = Set::extract($Donoremial, '{n}.Staff_Email');

Staff.email

> $int1= strcmp ( $email , $useremail);
> if($int1==0){
> echo $email."<br/>";
> echo $password."<br/>";
>
> }
> else{
>
> $Donoremial=$this->Admin->find('first',array('conditions'=>array('Admin_Email'=>$email)));

Admin.email

> $useremail = Set::extract($Donoremial,
> '{n}.Admin_Email');

Admin.email

> $int1= strcmp ( $email , $useremail);
> if($int1==0){
> echo $email."<br/>";
> echo $password."<br/>";
>
> }
>
> else{
> $this->Session->setFlash(__("Invalid Email Or
> Password"));
> }
>
> }
> }
>
>
> }
>
> }
>
>
>
>
>
> -----
> |\|@\/EE|)
> --
> View this message in context: http://cakephp.1045679.n5.nabble.com/Find-Method-issue-tp5712873.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> --
> 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 post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: