Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
How i can check a user getting banned?

My html doesn't work. I wanna checking user are banned or not then i used:

<html>
<head style="background-color:#171745"> 
      <style>
      h1 {
      color:white;
      }
      h3 {
      color:white;
      }
      h5 {
      color:gray;
      }
      p {
        color:white;
      }
      </style>
  </head>
  <body>
  <script>
    function checkCookie() {
    let ban = getCookie("banned");
    if (ban != "1") {
    alert("You are banned.");
    } else {
    window.location.replace("https://tuan-os.github.io/home")
    alert("Welcome");
  }
}
  </script>
  </body>
</html>

The user are banned will get a message say him are banned. The not banned user is redirect to tuan-os.github.io/home. But when i test it then the front my eyes is a blank and it no redirect like i think. And i wont the cookie is not detected by the verification....

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

First of all, you are not calling the function:

<script type="text/javascript">
  function getCookie(name) {
    const value = `; ${document.cookie}`;
    const parts = value.split(`; ${name}=`);
    if (parts.length === 2) return parts.pop().split(";").shift();
  }
  function checkCookie() {
    let ban = getCookie("banned");
    if (ban != "1") {
      alert("You are banned.");
    } else {
      window.location.replace("https://tuan-os.github.io/home");
      alert("Welcome");
    }
  }
  checkCookie(); // You should always call the function after creating
</script>

Secondly, there is no getCookie function by default. You should create one using the script like below if you want to get a cookie stored in the browser:

function getCookie(name) {
  const value = `; ${document.cookie}`;
  const parts = value.split(`; ${name}=`);
  if (parts.length === 2) return parts.pop().split(";").shift();
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!