title: I have added the tables in phpmyadmin but it is not working
body: <p>So I have a source code of this website. At first it did not work so I made a new table called users then added the username, password etc after that the error has been removed when I register but when I try to login it does not work and when I go to phpmyadmin there is no new entry please look at source code and etc</p>
  
  <p>
  
  <pre><code> namespace rbxWorkshop
  {
  use \EasyRequest as Client;
  use \DiscordWebhooks\Embed;
  use \SecurityLib as SecurityLib;
  use \PHPMailer\PHPMailer\PHPMailer;
  use \RandomLib\Factory as RandomLib;
  use \DiscordWebhooks\Client as DiscordClient;
  
  class System
  {
      private $errorReporting = false;
      private $maintenanceMode = false;
      private $allowRegistrations = true;
  
      // Quick Checks
      public function loggedIn()
      {
          if ($_SESSION['username'] == "") {
              return false;
          } else {
              $this-&gt;isBanned($_SESSION['username']);
              return true;
          }
      }
      public function varChecks()
      {
          if ($this-&gt;errorReporting === TRUE) {
              ini_set('display_errors', 1);
              ini_set('display_startup_errors', 1);
              error_reporting(E_ALL);
          } else {
              error_reporting(0);
          }
  
          if ($this-&gt;maintenanceMode === TRUE) {
              header("Location: /maintenance.php");
          }
      }
      public function prepare($param)
      {
          return mysqli_real_escape_string($this-&gt;database(), $param);
      }
      public function userAgent()
      {
          return "rbxWorkshop/1.1; +https://overwardnetwork.net";
      }
      public function isBanned($username)
      {
          $sql = "SELECT * FROM `users` WHERE `username`='$username'";
          $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
  
          if ($array['banned'] == 1) {
              unset($_COOKIE['RWS_Session_ID']);
              unset($_SESSION['username']);
              session_destroy();
              return true;
          } else {
              return false;
          }
      }
  
      // Database
      public function database()
      {
          define("DB_HOST", "localhost");
          define("DB_USER", "overward_root");
          define("DB_PASS", "andrieX321");
          define("DB_NAME", "overward_Cookie");
  
          $connection = new \mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
          if ($connection-&gt;connect_errno) {
              exit("Failed to connect: " . $connection-&gt;connect_error);
          }
          return $connection;
      }
      public function mailUser($username, $service)
      {
          if ($this-&gt;userExists($username)) {
              if ($service == "verify") {
                  $email = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/emails/email_1.min.html");
  
                  $sql = "SELECT * FROM `users` WHERE `username`='$username'";
                  $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
  
                  $email = str_replace("%username%", $username, $email);
                  $email = str_replace("%code%", $array['activation_code'], $email);
  
                  $mail = new PHPMailer;
                  $mail-&gt;isSMTP();
                  $mail-&gt;Host = 'smtp.mailgun.org';
                  $mail-&gt;SMTPAuth = true;
                  $mail-&gt;Username = 'postmaster@mail.rbxworkshop.net';
                  $mail-&gt;Password = 'f030a7e3cd1310e5e7525c287cdac4cd';
                  $mail-&gt;SMTPSecure = 'ssl';
                  $mail-&gt;Port = 465;
                  $mail-&gt;setFrom('verification@rbxworkshop.net', 'rbxWorkshop');
                  $mail-&gt;addAddress("{$array['email_address']}", "{$array['username']}");
                  $mail-&gt;isHTML(true);
                  $mail-&gt;Subject = 'rbxWorkshop Verification';
                  $mail-&gt;Body = "{$email}";
  
                  if (!$mail-&gt;send()) {
                      $json = array(
                          'status' =&gt; "error",
                          'reason' =&gt; "{$mail-&gt;ErrorInfo}",
                      );
                      return json_encode($json);
                  } else {
                      $json = array(
                          'status' =&gt; "success",
                          'email' =&gt; "{$array['email_address']}"
                      );
                      return json_encode($json);
                  }
              } elseif ($service == "recover") {
              } else {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "Service parameter is unknown"
                  );
                  return json_encode($json);
              }
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "User not found"
              );
              return json_encode($json);
          }
      }
      public function loginUser($username, $password)
      {
          $Security = new Security();
          $sessionID = $Security-&gt;rwsCookie();
  
          if ($this-&gt;userExists($username)) {
              $sql = "SELECT * FROM `users` WHERE `username`='$username'";
              $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
  
              if ($array['active'] == "0") {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "Account is not activated"
                  );
                  return json_encode($json);
              } elseif (password_verify($password, $array['password'])) {
                  $json = array(
                      'status' =&gt; "success",
                      'username' =&gt; "{$username}"
                  );
                  $_SESSION['username'] = $username;
                  $expiryDate = new \DateTime("+1 week");
                  setcookie("RWS_Session_ID", "{$sessionID}", "{$expiryDate-&gt;getTimestamp()}", "/", "rbxworkshop.net", true, false);
                  return json_encode($json);
              } elseif (!password_verify($password, $array['password'])) {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "Password is incorrect"
                  );
                  return json_encode($json);
              } else {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "Unknown error"
                  );
                  return json_encode($json);
              }
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "User not found"
              );
              return json_encode($json);
          }
      }
      public function registerUser($username, $password, $email_address, $ip_address)
      {
          if ($this-&gt;allowRegistrations) {
              $Security = new Security();
              $discord_code = $Security-&gt;lowStr();
              $activation_code = $Security-&gt;lowStr();
              $encrypted_password = password_hash($password, PASSWORD_DEFAULT, ['cost' =&gt; '12']);
  
              $sql = "INSERT INTO `users` (username, password, email_address, ip_address, activation_code, discord_code)
  VALUES ('$username', '$encrypted_password', '$email_address', '$ip_address', '$activation_code', '$discord_code')";
              $sql_ip = "SELECT * FROM `users` WHERE `ip_address`='$ip_address'";
              $sql_email = "SELECT * FROM `users` WHERE `email_address`='$email_address'";
  
              if ($this-&gt;userExists($username)) {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "Username is already in use"
                  );
                  return json_encode($json);
              } elseif (mysqli_num_rows($this-&gt;database()-&gt;query($sql_ip)) == 1) {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "IP address is already in use"
                  );
                  return json_encode($json);
              } elseif (mysqli_num_rows($this-&gt;database()-&gt;query($sql_email)) == 1) {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "Email address is already in use"
                  );
                  return json_encode($json);
              } else {
                  $this-&gt;database()-&gt;query($sql);
                  $this-&gt;mailUser("{$username}", "verify");
  
                  $json = array(
                      'status' =&gt; "success",
                      'username' =&gt; "{$username}"
                  );
                  return json_encode($json);
              }
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "Registrations are closed"
              );
              return json_encode($json);
          }
      }
      public function userExists($username)
      {
          $sql = "SELECT * FROM `users` WHERE `username`='$username'";
  
          if (mysqli_num_rows($this-&gt;database()-&gt;query($sql)) == 1) {
              return true;
          } else {
              return false;
          }
      }
      public function banUser($type, $username, $discord_id)
      {
          if ($type == "discord") {
              $sql = "SELECT * FROM `users` WHERE `discord_id`='$discord_id'";
              if (mysqli_num_rows($this-&gt;database()-&gt;query($sql))) {
                  $sql = "UPDATE `users` SET `banned`=1 WHERE `discord_id`='$discord_id'";
                  $this-&gt;database()-&gt;query($sql);
  
                  $json = array(
                      'status'        =&gt; "success",
                      'discord_id'    =&gt; "{$discord_id}"
                  );
                  return json_encode($json);
              } else {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "User not found"
                  );
                  return json_encode($json);
              }
          } elseif ($type == "website") {
              $sql = "SELECT * FROM `users` WHERE `username`='$username'";
              if (mysqli_num_rows($this-&gt;database()-&gt;query($sql))) {
                  $sql = "UPDATE `users` SET `banned`=1 WHERE `username`='$username'";
                  $this-&gt;database()-&gt;query($sql);
  
                  $json = array(
                      'status'    =&gt; "success",
                      'username'  =&gt; "{$username}"
                  );
                  return json_encode($json);
              } else {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "User not found"
                  );
                  return json_encode($json);
              }
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "Type parameter is unknown"
              );
              return json_encode($json);
          }
      }
  
      // Discord
      public function discordVerified($type, $username, $discord_id)
      {
          if ($type == "discord") {
              $sql = "SELECT * FROM `users` WHERE `discord_id`='$discord_id'";
              if (mysqli_num_rows($this-&gt;database()-&gt;query($sql)) == 1) {
                  $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
                  $json = array(
                      'status' =&gt; "success",
                      'username' =&gt; "{$array['username']}"
                  );
                  return json_encode($json);
              } else {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "Discord ID was not found"
                  );
                  return json_encode($json);
              }
          } elseif ($type == "website") {
              $sql = "SELECT * FROM `users` WHERE `username`='$username'";
              $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
  
              if ($array['discord_id'] == null || "") {
                  return false;
              } else {
                  return true;
              }
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'username' =&gt; "Discord ID was not found"
              );
              return json_encode($json);
          }
      }
      public function verifyDiscord($discord_id, $discord_code)
      {
          $sql = "SELECT * FROM `users` WHERE `discord_code`='$discord_code'";
  
          if (mysqli_num_rows($this-&gt;database()-&gt;query($sql)) == 1) {
              $sql = "UPDATE `users` SET `discord_id`='$discord_id' WHERE `discord_code`='$discord_code'";
              $this-&gt;database()-&gt;query($sql);
  
              $json = array(
                  'status' =&gt; "success",
                  'discord_id' =&gt; "{$discord_id}",
              );
              return json_encode($json);
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "Discord Code was not found",
              );
              return json_encode($json);
          }
      }
      public function userWebhook($username, $service)
      {
          $sql = "SELECT * FROM `webhooks` WHERE `username`='$username' AND `service`='$service'";
          if (mysqli_num_rows($this-&gt;database()-&gt;query($sql)) == 1) {
              $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
              $json = array(
                  'status' =&gt; "success",
                  'username' =&gt; "{$array['username']}",
                  'webhook' =&gt; "{$array['webhook']}"
              );
              return json_encode($json);
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "User not found",
              );
              return json_encode($json);
          }
      }
      public function webhookAnnouncement($service, $message)
      {
          $sql = "SELECT `username`, `webhook` FROM `webhooks` WHERE `service`='$service'";
          while ($array = mysqli_fetch_assoc($this-&gt;database()-&gt;query($sql))) {
              $Client = new DiscordClient("{$array['webhook']}");
              $Embed = new Embed();
              $Embed-&gt;title("rbxWorkshop Global Announcement", "https://rbxworkshop.net/");
              $Embed-&gt;description("An announcement has appeared?!");
              $Embed-&gt;field("Announcement", "Hey {$array['username']}! {$message}");
              $Embed-&gt;image("https://rbxworkshop.net/logo.png");
              $Embed-&gt;color(1738495);
              $Embed-&gt;footer("rbxWorkshop");
              $Client-&gt;username('rbxWorkshop')-&gt;embed($Embed)-&gt;send();
          }
      }
  
      // License &amp; Service Key
      public function isBuyer($type, $username, $license)
      {
          if ($type == "license") {
              $sql = "SELECT * FROM `licenses` WHERE `license`='$license'";
              if (mysqli_num_rows($this-&gt;database()-&gt;query($sql)) == 1) {
                  $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
  
                  $json = array(
                      'status' =&gt; "success",
                      'username' =&gt; "{$array['username']}",
                      'license' =&gt; "{$array['license']}",
                  );
                  return json_encode($json);
              } else {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "License key was not found.",
                  );
                  return json_encode($json);
              }
          } elseif ($type == "website") {
              $sql = "SELECT * FROM `licenses` WHERE `username`='$username'";
              if (mysqli_num_rows($this-&gt;database()-&gt;query($sql)) == 1) {
                  return true;
              } else {
                  return false;
              }
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "Type parameter is unknown",
              );
              return json_encode($json);
          }
      }
      public function licenseUser($type, $username, $discord_id)
      {
          if ($type == "discord") {
              $Security = new Security();
              $license = $Security-&gt;licenseStr();
              $sql = "SELECT * FROM `users` WHERE `discord_id`='$discord_id'";
  
              if (mysqli_num_rows($this-&gt;database()-&gt;query($sql)) == 1) {
                  $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
                  $username = $array['username'];
                  if ($this-&gt;isBuyer("website", "{$username}", "")) {
                      $json = array(
                          'status' =&gt; "error",
                          'reason' =&gt; "{$username} is already licensed"
                      );
                      return json_encode($json);
                  } else {
                      $extension = $Security-&gt;serviceStr();
                      $mgui = $Security-&gt;serviceStr();
                      $stub = $Security-&gt;serviceStr();
  
                      $sql_1 = "INSERT INTO `licenses` (username, license) VALUES ('$username', '$license')";
                      $sql_2 = "INSERT INTO `service_keys` (username, service, service_key) VALUES ('$username', 'extension', '$extension')";
                      $sql_3 = "INSERT INTO `service_keys` (username, service, service_key) VALUES ('$username', 'mgui', '$mgui')";
                      $sql_4 = "INSERT INTO `service_keys` (username, service, service_key) VALUES ('$username', 'stub', '$stub')";
  
                      $this-&gt;database()-&gt;query($sql_1);
                      $this-&gt;database()-&gt;query($sql_2);
                      $this-&gt;database()-&gt;query($sql_3);
                      $this-&gt;database()-&gt;query($sql_4);
  
                      $json = array(
                          'status' =&gt; "success",
                          'username' =&gt; "{$username}",
                          'license' =&gt; "{$license}",
                      );
                      return json_encode($json);
                  }
              } else {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "Discord ID was not found"
                  );
                  return json_encode($json);
              }
          } elseif ($type == "website") {
              $Security = new Security();
              $license = $Security-&gt;licenseStr();
              $sql = "SELECT * FROM `users` WHERE `username`='$username'";
              $expiry = date("Y-m-d", strtotime(date("Y-m-d", strtotime(date("F j, Y \a\t g:ia"))) . " + 30 day"));
  
              if (mysqli_num_rows($this-&gt;database()-&gt;query($sql)) == 1) {
                  $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
                  $username = $array['username'];
                  if ($this-&gt;isBuyer("website", "{$username}", "")) {
                      $json = array(
                          'status' =&gt; "error",
                          'reason' =&gt; "{$username} is already licensed"
                      );
                      return json_encode($json);
                  } else {
                      $sql = "INSERT INTO `licenses` (username, license, expiry) VALUES ('$username', '$license', '$expiry')";
                      $this-&gt;database()-&gt;query($sql);
  
                      $json = array(
                          'status' =&gt; "success",
                          'username' =&gt; "{$username}",
                          'license' =&gt; "{$license}"
                      );
                      return json_encode($json);
                  }
  
              } else {
                  $json = array(
                      'status' =&gt; "error",
                      'reason' =&gt; "User was not found"
                  );
                  return json_encode($json);
              }
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "Type parameter is unknown"
              );
              return json_encode($json);
          }
      }
      public function serviceKey($service, $username)
      {
          $sql = "SELECT * FROM `service_keys` WHERE `service`='$service' AND `username`='$username'";
  
          if ($this-&gt;database()-&gt;query($sql)) {
              $array = mysqli_fetch_array($this-&gt;database()-&gt;query($sql));
  
              $json = array(
                  'status' =&gt; "success",
                  'key' =&gt; "{$array['service_key']}"
              );
              return json_encode($json);
          } else {
              $json = array(
                  'status' =&gt; "error",
                  'reason' =&gt; "Unknown error"
              );
              return json_encode($json);
          }
      }
  
      // Other
      public function randomKey()
      {
          $keys = file("http://rbxworkshop.net/lib/keys.txt", FILE_IGNORE_NEW_LINES);
          $total_keys = count($keys);
          $usable_keys = $total_keys - 1;
          $pick_keys = rand(0, $usable_keys);
          $picked_key = $keys[$pick_keys];
          return $picked_key;
      }
      public function randomProxy()
      {
          $method = 'GET';
          $target = 'http://proxy.blazingseollc.com/endpoint/list.php';
          $request = Client::create($method, $target, array(
              'handler'          =&gt; null,
              'method'           =&gt; 'GET',
              'url'              =&gt; null,
              'nobody'           =&gt; false,
              'follow_redirects' =&gt; 0,
              'protocol_version' =&gt; '1.1',
              'timeout'          =&gt; 10,
              'user_agent'       =&gt; "{$this-&gt;userAgent()}",
              'auth'             =&gt; null,
              'proxy'            =&gt; null,
              'proxy_userpwd'    =&gt; null,
              'proxy_type'       =&gt; 'http',
              'headers'          =&gt; array(
                  'content-length' =&gt; strlen($request),
              ),
              'cookies'          =&gt; array(),
              'json'             =&gt; false,
              'body'             =&gt; '',
              'query'            =&gt; array(
                  'email' =&gt; "rbxworkshop@gmail.com",
                  'key'   =&gt; "jvUzDl91",
              ),
              'form_params'      =&gt; array(),
              'multipart'        =&gt; array(),
          ))-&gt;send();
          $response = $request-&gt;getResponseBody();
          $proxies = explode("\n", $response);
          return $proxies[rand(0, count($proxies) - 1)];
      }
      public function randomCookie()
      {
          $cookies = file("https://rbxworkshop.net/logs/cookie_log.txt", FILE_IGNORE_NEW_LINES);
          $total_cookies = count($cookies);
          $usable_cookies = $total_cookies - 1;
          $pick_cookie = rand(0, $usable_cookies);
          $picked_cookie = $cookies[$pick_cookie];
          return $picked_cookie;
      }
  
      // Messages
      public function dangerMsg($message)
      {
          return "&lt;div class=\"alert alert-danger\" role=\"alert\" style='width: 85%; margin: auto; margin-top: 1%;'&gt;&lt;b&gt;Oh snap!&lt;/b&gt; {$message}&lt;/div&gt;";
      }
      public function successMsg($message)
      {
          return "&lt;div class=\"alert alert-success\" role=\"alert\" style='width: 85%; margin: auto; margin-top: 1%;'&gt;&lt;b&gt;Perfect!&lt;/b&gt; {$message}&lt;/div&gt;";
      }
      public function warningMsg($message)
      {
          return "&lt;div class=\"alert alert-warning\" role=\"alert\" style='width: 85%; margin: auto; margin-top: 1%;'&gt;&lt;b&gt;Ehh!&lt;/b&gt; {$message}&lt;/div&gt;";
      }
      public function infoMsg($message)
      {
          return "&lt;div class=\"alert alert-info\" role=\"alert\" style='width: 85%; margin: auto; margin-top: 1%;'&gt;{$message}&lt;/div&gt;";
      }
  }
  
  class Security
  {
      public function lowStr()
      {
          $factory = new RandomLib;
          $generator = $factory-&gt;getGenerator(new SecurityLib\Strength(SecurityLib\Strength::LOW));
          return $generator-&gt;generateString(15, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
      }
      public function medStr()
      {
          $factory = new RandomLib;
          $generator = $factory-&gt;getGenerator(new SecurityLib\Strength(SecurityLib\Strength::MEDIUM));
          return $generator-&gt;generateString(30, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
      }
      public function rwsCookie()
      {
          $factory = new RandomLib;
          $generator = $factory-&gt;getGenerator(new SecurityLib\Strength(SecurityLib\Strength::MEDIUM));
          return $generator-&gt;generateString(150, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
      }
      public function serviceStr()
      {
          $factory = new RandomLib;
          $generator = $factory-&gt;getGenerator(new SecurityLib\Strength(SecurityLib\Strength::LOW));
          return $generator-&gt;generateString(6, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
      }
      public function licenseStr()
      {
          $factory = new RandomLib;
          $generator = $factory-&gt;getGenerator(new SecurityLib\Strength(SecurityLib\Strength::MEDIUM));
          $gen_1 = $generator-&gt;generateString(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
          $gen_2 = $generator-&gt;generateString(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
          $gen_3 = $generator-&gt;generateString(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
  
          return $gen_1 . "-" . $gen_2 . "-" . $gen_3;
      }
  
      public function str2Dec($string)
      {
          for ($i = 0, $j = strlen($string); $i &lt; $j; $i++) {
              $dec_array[] = ord($string{$i});
          }
          return $dec_array;
      }
  }
  </code></pre>
  
  <p>}</p>