<!DOCTYPE HTML>
<html>
  <head>
    <% include ./partials/header.ejs %>
    <% include ./partials/nav.ejs %>

    <link rel="icon" type="image/jpg" href="https://media.discordapp.net/attachments/506425178822279168/507496898823847936/dbr.png">
    <title>403-2 - Discord Bot Reviews</title>
  </head>
  <body>
    </div>
    <noscript>
        <div class="alert alert-danger" role="alert">
          This website requires Javascript to work. Please enable Javascript or use a browser that supports Javascript.
        </div>
    </noscript>
    <div class="container">
    <h1>
      <center>403-2 Unauthorized - Banned</center>
    </h1>
      <center>You are banned from this website</center>
      <br>
      <center><div id="reason">
        Fetching reason...
        </div></center>
      <br>
      <center><a href="/logout" class="btn btn-primary">Log out</a></center>
  </body>
</html>
<script>
var xmlhttp = new XMLHttpRequest();

xmlhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    var response = JSON.parse(this.responseText);
   idiot(response)
  }
};
xmlhttp.open("GET", "https://aimbotwallhack.glitch.me/data/bans?user=<%=req.user.id%>", true);
xmlhttp.send();

function idiot(response) {
  if(response.error === false) {
  var dude1 = response.time ? 'Banned untill: <br> (DD/MM/YYYY) <p style="color:lime;">' + response.time + '</p>' : '<p style="color:red;">You are permanently banned from DBR.</p>'
  var dude2 = response.time ? "<br><br><br> You have been temporary banned from DBR, however any bot(s) awaiting approval or already listed will be declined/deleted." : ""
 document.getElementById("reason").innerHTML = dude1 + "Reason: <br>" + response.message + dude2
  } else {document.getElementById("reason").innerHTML = response.message + '<p style="color: red;">This is an error. If you have been banned before 6th july, 2019 you are most likely to see this as we have updated the ban system. <br> However, if you have been banned after but still see this, contact support immediately.</p>'}

}
  
</script>