-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
shubham
committed
Jun 19, 2020
1 parent
422f75d
commit 147367a
Showing
24 changed files
with
413 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
DB_HOST=localhost | ||
DB_USER=root | ||
DB_PASSWORD=shubham@2506 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,50 +37,55 @@ router.get('/notification',function(req,res){ | |
}) | ||
router.post('/notification',function(req,res,next){ | ||
console.log(req.body) | ||
async.waterfall([ | ||
function(done) { | ||
var sql="SELECT * FROM login WHERE id='"+req.body.id+"'"; | ||
pool.query(sql,function(err, user) { | ||
if (!user.length) { | ||
req.flash('error', 'No account with that email address exists.'); | ||
return res.redirect('/admin/notification'); | ||
} | ||
|
||
var sql1="INSERT into notification(`game_id`,`notification`,`user_id`,`warning`) VALUES ('"+req.body.game_id+"','"+req.body.notification+"','"+req.body.id+"','"+req.body.warning+"')"; | ||
var warning; | ||
if(!req.body.warning){ | ||
warning=0; | ||
} | ||
else{ | ||
warning=1; | ||
} | ||
var sql1="INSERT into notification(`game_id`,`notification`,`user_id`,`warning`) VALUES ('"+req.body.game_id+"','"+req.body.notification+"','"+req.body.id+"','"+warning+"')"; | ||
pool.query(sql1,function(err,result){ | ||
if(err)throw err; | ||
done(err, user); | ||
}); | ||
}); | ||
}, | ||
function(user, done) { | ||
console.log(user[0].email) | ||
var smtpTransport = nodemailer.createTransport({ | ||
service: 'Gmail', | ||
port: 587, | ||
secure: false, | ||
auth: { | ||
user: '', | ||
pass: '', | ||
} | ||
}); | ||
var mailOptions = { | ||
from: '"Gaming Website"', | ||
to: '[email protected]', | ||
subject: 'Online Gaming Website', | ||
text: 'You are receiving this because you (or someone else) has been sent a notification by the admin of the gaming Website +\n\n+'+req.body.notification+'\n\n' + | ||
'If you did not request this, please ignore this email.\n' | ||
}; | ||
let info = smtpTransport.sendMail(mailOptions, function(err) { | ||
console.log('mail sent'); | ||
req.flash('success', 'An e-mail has been sent your mail with further instructions.'); | ||
done(err, 'done'); | ||
}); | ||
} | ||
], function(err) { | ||
if (err) return next(err); | ||
res.redirect('/admin/notification'); | ||
}); | ||
|
||
router.get('/report_bugs',function(req,res){ | ||
var sql="SELECT a.sr_no,a.uid,a.bug,a.time,b.name FROM report_bugs AS a INNER JOIN login AS b ON a.uid=b.id"; | ||
console.log(sql) | ||
pool.query(sql,function(err,result){ | ||
if(err)throw err; | ||
console.log(result) | ||
result.forEach(res => { | ||
res.time = moment(res.time).format("MMMM Do YYYY, h:mm:ss a"); | ||
}); | ||
res.render('admin_reported_bugs.ejs',{ | ||
bugs:result | ||
}); | ||
}); | ||
}); | ||
|
||
router.get('/report_feedback',function(req,res){ | ||
var sql="SELECT a.id,a.uid,a.feedback,a.time,b.name,b.username FROM feedback AS a INNER JOIN login AS b ON a.uid=b.id"; | ||
console.log(sql) | ||
pool.query(sql,function(err,result){ | ||
if(err)throw err; | ||
console.log(result) | ||
result.forEach(res => { | ||
res.time = moment(res.time).format("MMMM Do YYYY, h:mm:ss a"); | ||
}); | ||
res.render('admin_feedback.ejs',{ | ||
feedback:result | ||
}); | ||
}); | ||
}); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
|
||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="description" content=""> | ||
<meta name="author" content=""> | ||
|
||
<title>Online Gaming Website - Admin</title> | ||
|
||
<%- include('./partials/head') %> | ||
|
||
<link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet"> | ||
|
||
</head> | ||
|
||
<body id="page-top" class="sidebar-toggled"> | ||
|
||
<!-- Page Wrapper --> | ||
<div id="wrapper"> | ||
|
||
<%- include('./partials/sidebar') %> | ||
|
||
<!-- Content Wrapper --> | ||
<div id="content-wrapper" class="d-flex flex-column"> | ||
|
||
<!-- Main Content --> | ||
<div id="content"> | ||
|
||
<%- include('./partials/header') %> | ||
|
||
<!-- Begin Page Content --> | ||
<div class="container-fluid"> | ||
|
||
<h1 class="h3 mb-2 text-gray-800">Users</h1> | ||
|
||
<div class="card shadow"> | ||
<div class="card-header"> | ||
<h6 class="m-0 font-weight-bold text-primary">User Details</h6> | ||
</div> | ||
|
||
<div class="card-body"> | ||
<div class="table-responsive"> | ||
<table class="table table-bordered" id="user_table" width="100%" cellspacing="0"> | ||
<thead> | ||
<tr> | ||
<th>User Id</th> | ||
<th>User Name</th> | ||
<th>User Handle</th> | ||
<th>Feedback</th> | ||
<th>Time</th> | ||
</tr> | ||
</thead> | ||
<tfoot> | ||
<tr> | ||
<th>User Id</th> | ||
<th>User Name</th> | ||
<th>User Handle</th> | ||
<th>Feedback</th> | ||
<th>Time</th> | ||
</tr> | ||
</tfoot> | ||
<tbody> | ||
<% | ||
if(feedback.length) { | ||
for(var i = 0;i < feedback.length;i++) { %> | ||
<tr> | ||
<td><%=feedback[i].id%></td> | ||
<td><%=feedback[i].name%></td> | ||
<td><%=feedback[i].username%></td> | ||
<td><%=feedback[i].feedback%></td> | ||
<td><%=feedback[i].time%></td> | ||
</tr> | ||
<% } | ||
} %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
<!-- End of Main Content --> | ||
|
||
<%- include('./partials/footer') %> | ||
|
||
</div> | ||
<!-- End of Content Wrapper --> | ||
|
||
</div> | ||
<!-- End of Page Wrapper --> | ||
|
||
<!-- Scroll to Top Button--> | ||
<a class="scroll-to-top rounded" href="#page-top"> | ||
<i class="fas fa-angle-up"></i> | ||
</a> | ||
|
||
<%- include('./partials/foot') %> | ||
|
||
<!--Page Level Plugins --> | ||
<script src="vendor/datatables/jquery.dataTables.min.js"></script> | ||
<script src="vendor/datatables/dataTables.bootstrap4.min.js"></script> | ||
|
||
<script> | ||
$(document).ready(function() { | ||
$("#user_table").DataTable(); | ||
}); | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.