SHARE
TWEET

Untitled

a guest Jun 17th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var username = request.body.username;
  2. var password = request.body.password;
  3. if (username && password) {
  4.     connection.query('SELECT * FROM users WHERE username = ? AND password = ?', [username, password], function(error, results, fields) {
  5.         console.log(results);
  6.         if (results.length > 0) {
  7.             request.session.loggedin = true;
  8.             request.session.username = username;
  9.             // request.session.w_id = us;
  10.             response.redirect('/');
  11.             next();
  12.         } else {
  13.             response.render('login', {layout: 'login',error:'Invalid Username Or Password'});
  14.         }          
  15.         response.end();
  16.     });
  17. } else {
  18.     response.render('login', {layout: 'login',error:'Please Enter Username And Password'});
  19.     response.end();
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top