|
|
|
@ -169,24 +169,24 @@ router.post('/login', urlencodedParser, function (req, res, next) {
|
|
|
|
|
res.redirect('login');
|
|
|
|
|
} else {
|
|
|
|
|
username = name
|
|
|
|
|
var exec = require('child_process').exec;
|
|
|
|
|
exec(`python C:/Users/17217/Desktop/english/users/admin/log.py `+username)
|
|
|
|
|
db.run("delete from "+name,function(){ //每次先将表信息清空再重新读取文件夹里面的文件信息
|
|
|
|
|
});
|
|
|
|
|
fs.readdir('./users/'+name, 'utf8', function(err, data) {
|
|
|
|
|
console.log(data);
|
|
|
|
|
for (var key in data) {
|
|
|
|
|
console.log(key);
|
|
|
|
|
var a=key
|
|
|
|
|
console.log(data[key]);
|
|
|
|
|
var b=data[key]
|
|
|
|
|
var c = fs.statSync(path.join(__dirname,'../users/'+name+'/'+data[key]))
|
|
|
|
|
console.log(c.size)
|
|
|
|
|
var add = db.prepare("INSERT INTO "+name+"(fid,fname,fsize,fowner) VALUES(?,?,?,?)");//读取用户名文件夹下文件ID、文件名、大小并写入数据库中
|
|
|
|
|
add.run(a,b,c.size,name);
|
|
|
|
|
add.finalize();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// var exec = require('child_process').exec;
|
|
|
|
|
// exec(`python C:/Users/17217/Desktop/english/users/admin/log.py `+username)
|
|
|
|
|
// db.run("delete from "+name,function(){ //每次先将表信息清空再重新读取文件夹里面的文件信息
|
|
|
|
|
// });
|
|
|
|
|
// fs.readdir('./users/'+name, 'utf8', function(err, data) {
|
|
|
|
|
// console.log(data);
|
|
|
|
|
// for (var key in data) {
|
|
|
|
|
// console.log(key);
|
|
|
|
|
// var a=key
|
|
|
|
|
// console.log(data[key]);
|
|
|
|
|
// var b=data[key]
|
|
|
|
|
// var c = fs.statSync(path.join(__dirname,'../users/'+name+'/'+data[key]))
|
|
|
|
|
// console.log(c.size)
|
|
|
|
|
// var add = db.prepare("INSERT INTO "+name+"(fid,fname,fsize,fowner) VALUES(?,?,?,?)");//读取用户名文件夹下文件ID、文件名、大小并写入数据库中
|
|
|
|
|
// add.run(a,b,c.size,name);
|
|
|
|
|
// add.finalize();
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
if (name == 'admin')
|
|
|
|
|
{
|
|
|
|
|
req.session.error = ''
|
|
|
|
|