1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
public function loginAction()
{
$request = $this->container->get('request');
//$request = Request::createFromGlobals();
if ($request->getMethod() == 'POST')
{
$lo = '';
$lo = $request->request->get('identifiant');
//$tab = $this->getRequest()->request->get('login');
//$lo = $this->getRequest()->request->get('identifiant');
//$lo = $request->attributes->get('identifiant');
//$lo = $tab['identifiant'];
$pa = $request->request->get('Password');
$em = $this->container->get('doctrine')->getEntityManager();
/**
$product = $this->getDoctrine()
->getRepository('AcmeStoreBundle:Product')
->find($id);
if (!$product) {
throw $this->createNotFoundException('No product found for id '.$id);
**/
if($lo != '')
{
$q = $em->creatQueryBuilder();
$q->select('count(*)')
->from('gestionBundle:client', 'c')
->where('c.login = :lo')
->setParameter('lo', '%'.$lo.'%');
$req = $q->getQuery();
$trouv = $req->getResult();
if($trouv > 0)
{
$qq = $em->CreatQueryBuilder();
$qq->select('c.passwd')
->from('gestionBundle:client','c')
->where('c.login = :lo')
->setParameter('lo', '%'.$lo.'%');
$reqq = $qq->getQuery();
$passs = $reqq->getResult();
if($passs == $pa)
{
$msg= "Merci de votre connexion !";
return $this->container->get('templating')->renderResponse('gestionBundle:Default:hello.html.twig',array('msg' => $msg)
);
}
else
{
$msg= "Mot de passe incorrect !";
return $this->container->get('templating')->renderResponse('gestionBundle:Default:hello.html.twig',array('msg' => $msg)
);
}
}
else
{
$msg= "Login incorrect !";
return $this->container->get('templating')->renderResponse('gestionBundle:Default:hello.html.twig',array('msg' => $msg)
);
}
}
else
{
$msg= "login encore vide !";
return $this->container->get('templating')->renderResponse('gestionBundle:Default:hello.html.twig',array('msg' => $msg)
);
}
}
else
$msg= "N est pas une fonction AJAX !";
return $this->container->get('templating')->renderResponse('gestionBundle:Default:hello.html.twig',array('msg' => $msg)
);
}
} |
Partager