Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login($login, $pass)
- {
- $cnx = new PDO("sqlsrv:Server=SRVLYCJ;Database=dbLogin_resseguier", "Resseguier","Resseguier13");
- $select = "
- SELECT user_id, username, userpassword
- FROM usertable
- WHERE username = '%s' AND userpassword = '%s';
- ";
- $fixedlogin = $login;
- $fixedpass = $pass;
- $query = sprintf($select, $fixedlogin, $fixedpass);
- $req = $cnx->prepare($query);
- $req->execute();
- // Récupération des résultats
- while ($row = $req->fetch(PDO::FETCH_OBJ))
- {
- $output[0] = $row->user_id;
- }
- if(empty($output[0]))
- {
- return -1;
- }
- else
- {
- return $output[0];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement