Advertisement
Guest User

Untitled

a guest
Sep 27th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. app.get('/login', (req, res) => {
  2.  
  3. if(req.query.username == '' || req.query.password == ''){
  4. res.send('f');
  5. } else {
  6.  
  7. var random = Math.floor(Math.random() * 100000) + 1;
  8. while (searchIntInArray(random, currentuids[1]) != -1){
  9. random = Math.floor(Math.random() * 100000) + 1;
  10. }
  11.  
  12. if(searchStringInArray(req.query.username, currentuids[0]) == -1){
  13. currentuids[0].push(req.query.username);
  14. currentuids[1].push(random);
  15. temp = setTimeout(() => {
  16. deleteid(random)},
  17. 30000);
  18. currentuids[2].push(temp);
  19.  
  20. } else {
  21. var temp = searchStringInArray(req.query.username, currentuids[0]);
  22. currentuids[1][temp] = random;
  23. clearTimeout(currentuids[2][temp]);
  24. currentuids[2][temp] = setTimeout(
  25. () => {deleteid(random)},
  26. 30000);
  27. }
  28.  
  29. var randomtext = random.toString();
  30.  
  31. var reponse = "t" + randomtext;
  32. res.send(reponse);
  33.  
  34. console.log(timenow() + ": " + splitip(req.ip) + ' s\'est login. username: ' + req.query.username + " password: " + req.query.password + " réponse: " + reponse);
  35. }
  36. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement