-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_code.txt
92 lines (45 loc) · 1.37 KB
/
admin_code.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
app.get("/desc_admin/:id", (req, res) => {
var query = querystring.parse(req.params.id);
post_model.findById(query.img).populate("comments").exec(function (err, campy) {
res.render("desc", { obj: campy, user: null, cmt: campy,admin:query.admin });
})
})
app.get('/get_admin/:id',(req, res)=>{
var query = querystring.parse(req.params.id);
console.log(query);
var scope = query.scope;
var admin = query.admin;
post_model.find({scope},(err,item)=>{
admin_model.findById(admin, (err, it)=>{
res.render('admin_post',{obj:item,admin:it});
});
})
})
app.post('/get/post',(req,res)=>{
var special_id = req.body.login[0];
admin_model.find({special_id},(err,item)=>{
var scope = item.scope;
post_model.find({scope},(err,it)=>{
res.render('admin_post',{obj:it,admin:item[0]});
})
})
console.log(req.body);
})
app.get('/admin',(req,res)=>{
res.render('Admin_login');
})
app.get('/admin_check/:id',(req,res)=>{
var query = querystring.parse(req.params.id);
var img = query.img;
var admin = query.admin;
admin_model.findById(admin,(err,item)=>{
item.vote.push(img);
item.save();
});
post_model.findById(img,(err,item)=>{
console.log(item);
item.verify = 'yes';
item.save();
})
res.redirect("/get_admin/scope=global&admin="+admin);
})