Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connection.query('SELECT * FROM users WHERE username = ?', [username], function(err, rows, fields) {
- if (err) {
- appData.error = 1;
- appData['data'] = 'Error Occured!';
- res.status(400).json(appData);
- } else {
- if (rows.length > 0) {
- if (rows[0].password == password) {
- if (rows[0].nivel== 1) {
- res.redirect(307, '/Administration');
- //eu quero passar o username/nivel para /Administration
- res.send(username);
- }else if (rows[0].nivel== 2) {
- res.redirect(307, '/Users');
- }
- else if (rows[0].nivel== 3) {
- res.redirect(307, '/usersvip');
- }
- else if (rows[0].nivel== 4) {
- res.redirect(307, '/moderador');
- }
- else if (rows[0].nivel== 2) {
- res.redirect(307, '/activar');
- }
- else {
- res.redirect(307, '/banned');
- }
- var express = require('express');
- var router = express.Router();
- router.post('/', function(req, res, next) {
- res.render('Administration/index', { title: 'Home'});
- });
- module.exports = router;
Add Comment
Please, Sign In to add comment