Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $app->get('/login/{username}&{password}', function (Request $request, Response $response) use($app, $pdo) {
- $username = $request->getAttribute('username');
- $password = $request->getAttribute('password');
- $query = $pdo->select()
- ->from('employee')
- ->where('username', '=', $username)
- ->where('password', '=', md5($password))
- ;
- $stmt = $query->execute();
- $employee = $stmt->fetch();
- if($employee) {
- $data = array('status' => $response->getStatusCode(), $employee);
- $data = $response->withJson($data, 201);
- } else {
- $data = array('status' => $response->getStatusCode(), 'message' => 'Employee does not exist');
- $data = $response->withJson($data, 404);
- }
- return $data;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement