Skip to main content
se eliminaron 4816 caracteres en el cuerpo
Origen Enlace

login.php:

<?php
include 'inc/base.php';

function captcha() {
  $url = 'https://www.google.com/recaptcha/api/siteverify';
  $privatekey = '6LdXGA8TAAAAAEItg6VkhIwYXswy3zoJYkSsa2bT';
  $response = file_get_contents($url."?secret=".$privatekey."&response=".strip_tags($_POST['g-recaptcha-response'])."&remoteip=".$_SERVER['REMOTE_ADDR']);
  $data = json_decode($response);
  return isset($data->success) AND $data->success == true;
}

// LOGIN
if (isset($_POST['login'], $_POST['username'], $_POST['password'])) {
    $query = $db->prepare('SELECT COUNT(*) AS nb, id, username FROM users WHERE username=? AND password=?');
    $query->execute([
      $_POST['username'],
      md5($_POST['password'])
    ]);
    $data = $query->fetch();
    if ($data->nb) {
        $_SESSION['user'] = $data->username;
        $_SESSION['user_id'] = $data->id;
        header("location: index.php");
        exit;
    } else {
      $error = "Password or username incorrect";
    } 
}

// SIGNUp
if (isset($_POST['signup'], $_POST['username'], $_POST['email'], $_POST['password'], $_POST['confirm'])) {
  if (preg_match("#^[a-z0-9_-]{3,30}$#i", $_POST['username'])) {
      if (captcha()) {
    $query = $db->prepare("SELECT COUNT(*) AS nb FROM users WHERE username=?");
    $query->execute([
      $_POST['username']
    ]);
    $data = $query->fetch();

    if (!$data->nb) {
      if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $query = $db->prepare("SELECT COUNT(*) AS nb FROM users WHERE email=?");
        $query->execute([
          $_POST['email']
        ]);
        $data = $query->fetch();

        if (!$data->nb) {
          if ($_POST['password'] === $_POST['confirm']) {
            if (strlen($_POST['password']) >= 4) {

              $query = $db->prepare("INSERT INTO users(username, email, password) VALUES(:username, :email, :password)");
              $query->execute([
                "username" => $_POST['username'],
                "email" => $_POST['email'],
                "password" => md5($_POST['password'])
              ]);

              $_SESSION['user'] = $_POST['username'];
              $_SESSION['user_id'] = $db->lastInsertId();

              header("Location: index.php");
              exit;

            } else {
              $error = "The password must be at least 4 characters";
            }
          } else {
            $error = "The two passwords must match";
          }
        } else {
          $error = "This email is already taken";
        }
      } else {
        $error = "Incorrect email format";
      }
    } else {
      $error = "This username is already taken";
    }
  }
  else 
  {
      $error = "Invalid captcha";  
  }
  }
  else
  {
    $error = "The username must be within 3 and 30 characters";
  }
}

include 'inc/header.php';
?>
    <?php
    if (isset($error)) echo "<div class=\"message_erreur\">$error</div>";
    ?>
        <section>
            <h1 class="title">Log in</h1>
            <form method="POST">
            Username : <input type="text" name="username" required />
            Password : <input type="password" name="password" required />
        <input type="submit" name="login" value="Se connecter" required />
        </form>
        </section>

        <section>
            <h2 class="title">Sign Up</h2>
            <form method="POST">
            <label>Username :<br />
              <input type="text" name="username" <?php if(isset($_POST['username'])) echo 'value="'.htmlspecialchars($_POST['username']).'"'; ?> required />
            </label>
            <label>Email :<br />
              <input type="text" name="email" <?php if(isset($_POST['email'])) echo 'value="'.htmlspecialchars($_POST['email']).'"'; ?> required />
            </label>
            <label>Password :<br />
              <input type="password" name="password" required />
            </label>
            <label>Repeat password :<br />
              <input type="password" name="confirm" required />
            </label>
            <center><div class="g-recaptcha" data-sitekey="6LdXGA8TAAAAAKV0MvCvn5eT3--7v4eipyvKPD0s"></div></center><br/>
            <input type="submit" name="signup" value="Créer un compte" />
        </form>
        </section>
<?php
include 'inc/footer.php';

login.php:

<?php
include 'inc/base.php';

function captcha() {
  $url = 'https://www.google.com/recaptcha/api/siteverify';
  $privatekey = '6LdXGA8TAAAAAEItg6VkhIwYXswy3zoJYkSsa2bT';
  $response = file_get_contents($url."?secret=".$privatekey."&response=".strip_tags($_POST['g-recaptcha-response'])."&remoteip=".$_SERVER['REMOTE_ADDR']);
  $data = json_decode($response);
  return isset($data->success) AND $data->success == true;
}

// LOGIN
if (isset($_POST['login'], $_POST['username'], $_POST['password'])) {
    $query = $db->prepare('SELECT COUNT(*) AS nb, id, username FROM users WHERE username=? AND password=?');
    $query->execute([
      $_POST['username'],
      md5($_POST['password'])
    ]);
    $data = $query->fetch();
    if ($data->nb) {
        $_SESSION['user'] = $data->username;
        $_SESSION['user_id'] = $data->id;
        header("location: index.php");
        exit;
    } else {
      $error = "Password or username incorrect";
    } 
}

// SIGNUp
if (isset($_POST['signup'], $_POST['username'], $_POST['email'], $_POST['password'], $_POST['confirm'])) {
  if (preg_match("#^[a-z0-9_-]{3,30}$#i", $_POST['username'])) {
      if (captcha()) {
    $query = $db->prepare("SELECT COUNT(*) AS nb FROM users WHERE username=?");
    $query->execute([
      $_POST['username']
    ]);
    $data = $query->fetch();

    if (!$data->nb) {
      if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $query = $db->prepare("SELECT COUNT(*) AS nb FROM users WHERE email=?");
        $query->execute([
          $_POST['email']
        ]);
        $data = $query->fetch();

        if (!$data->nb) {
          if ($_POST['password'] === $_POST['confirm']) {
            if (strlen($_POST['password']) >= 4) {

              $query = $db->prepare("INSERT INTO users(username, email, password) VALUES(:username, :email, :password)");
              $query->execute([
                "username" => $_POST['username'],
                "email" => $_POST['email'],
                "password" => md5($_POST['password'])
              ]);

              $_SESSION['user'] = $_POST['username'];
              $_SESSION['user_id'] = $db->lastInsertId();

              header("Location: index.php");
              exit;

            } else {
              $error = "The password must be at least 4 characters";
            }
          } else {
            $error = "The two passwords must match";
          }
        } else {
          $error = "This email is already taken";
        }
      } else {
        $error = "Incorrect email format";
      }
    } else {
      $error = "This username is already taken";
    }
  }
  else 
  {
      $error = "Invalid captcha";  
  }
  }
  else
  {
    $error = "The username must be within 3 and 30 characters";
  }
}

include 'inc/header.php';
?>
    <?php
    if (isset($error)) echo "<div class=\"message_erreur\">$error</div>";
    ?>
        <section>
            <h1 class="title">Log in</h1>
            <form method="POST">
            Username : <input type="text" name="username" required />
            Password : <input type="password" name="password" required />
        <input type="submit" name="login" value="Se connecter" required />
        </form>
        </section>

        <section>
            <h2 class="title">Sign Up</h2>
            <form method="POST">
            <label>Username :<br />
              <input type="text" name="username" <?php if(isset($_POST['username'])) echo 'value="'.htmlspecialchars($_POST['username']).'"'; ?> required />
            </label>
            <label>Email :<br />
              <input type="text" name="email" <?php if(isset($_POST['email'])) echo 'value="'.htmlspecialchars($_POST['email']).'"'; ?> required />
            </label>
            <label>Password :<br />
              <input type="password" name="password" required />
            </label>
            <label>Repeat password :<br />
              <input type="password" name="confirm" required />
            </label>
            <center><div class="g-recaptcha" data-sitekey="6LdXGA8TAAAAAKV0MvCvn5eT3--7v4eipyvKPD0s"></div></center><br/>
            <input type="submit" name="signup" value="Créer un compte" />
        </form>
        </section>
<?php
include 'inc/footer.php';
se añadieron 4822 caracteres en el cuerpo
Origen Enlace

login.php:

<?php
include 'inc/base.php';

function captcha() {
  $url = 'https://www.google.com/recaptcha/api/siteverify';
  $privatekey = '6LdXGA8TAAAAAEItg6VkhIwYXswy3zoJYkSsa2bT';
  $response = file_get_contents($url."?secret=".$privatekey."&response=".strip_tags($_POST['g-recaptcha-response'])."&remoteip=".$_SERVER['REMOTE_ADDR']);
  $data = json_decode($response);
  return isset($data->success) AND $data->success == true;
}

// LOGIN
if (isset($_POST['login'], $_POST['username'], $_POST['password'])) {
    $query = $db->prepare('SELECT COUNT(*) AS nb, id, username FROM users WHERE username=? AND password=?');
    $query->execute([
      $_POST['username'],
      md5($_POST['password'])
    ]);
    $data = $query->fetch();
    if ($data->nb) {
        $_SESSION['user'] = $data->username;
        $_SESSION['user_id'] = $data->id;
        header("location: index.php");
        exit;
    } else {
      $error = "Password or username incorrect";
    } 
}

// SIGNUp
if (isset($_POST['signup'], $_POST['username'], $_POST['email'], $_POST['password'], $_POST['confirm'])) {
  if (preg_match("#^[a-z0-9_-]{3,30}$#i", $_POST['username'])) {
      if (captcha()) {
    $query = $db->prepare("SELECT COUNT(*) AS nb FROM users WHERE username=?");
    $query->execute([
      $_POST['username']
    ]);
    $data = $query->fetch();

    if (!$data->nb) {
      if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $query = $db->prepare("SELECT COUNT(*) AS nb FROM users WHERE email=?");
        $query->execute([
          $_POST['email']
        ]);
        $data = $query->fetch();

        if (!$data->nb) {
          if ($_POST['password'] === $_POST['confirm']) {
            if (strlen($_POST['password']) >= 4) {

              $query = $db->prepare("INSERT INTO users(username, email, password) VALUES(:username, :email, :password)");
              $query->execute([
                "username" => $_POST['username'],
                "email" => $_POST['email'],
                "password" => md5($_POST['password'])
              ]);

              $_SESSION['user'] = $_POST['username'];
              $_SESSION['user_id'] = $db->lastInsertId();

              header("Location: index.php");
              exit;

            } else {
              $error = "The password must be at least 4 characters";
            }
          } else {
            $error = "The two passwords must match";
          }
        } else {
          $error = "This email is already taken";
        }
      } else {
        $error = "Incorrect email format";
      }
    } else {
      $error = "This username is already taken";
    }
  }
  else 
  {
      $error = "Invalid captcha";  
  }
  }
  else
  {
    $error = "The username must be within 3 and 30 characters";
  }
}

include 'inc/header.php';
?>
    <?php
    if (isset($error)) echo "<div class=\"message_erreur\">$error</div>";
    ?>
        <section>
            <h1 class="title">Log in</h1>
            <form method="POST">
            Username : <input type="text" name="username" required />
            Password : <input type="password" name="password" required />
        <input type="submit" name="login" value="Se connecter" required />
        </form>
        </section>

        <section>
            <h2 class="title">Sign Up</h2>
            <form method="POST">
            <label>Username :<br />
              <input type="text" name="username" <?php if(isset($_POST['username'])) echo 'value="'.htmlspecialchars($_POST['username']).'"'; ?> required />
            </label>
            <label>Email :<br />
              <input type="text" name="email" <?php if(isset($_POST['email'])) echo 'value="'.htmlspecialchars($_POST['email']).'"'; ?> required />
            </label>
            <label>Password :<br />
              <input type="password" name="password" required />
            </label>
            <label>Repeat password :<br />
              <input type="password" name="confirm" required />
            </label>
            <center><div class="g-recaptcha" data-sitekey="6LdXGA8TAAAAAKV0MvCvn5eT3--7v4eipyvKPD0s"></div></center><br/>
            <input type="submit" name="signup" value="Créer un compte" />
        </form>
        </section>
<?php
include 'inc/footer.php';

login.php:

<?php
include 'inc/base.php';

function captcha() {
  $url = 'https://www.google.com/recaptcha/api/siteverify';
  $privatekey = '6LdXGA8TAAAAAEItg6VkhIwYXswy3zoJYkSsa2bT';
  $response = file_get_contents($url."?secret=".$privatekey."&response=".strip_tags($_POST['g-recaptcha-response'])."&remoteip=".$_SERVER['REMOTE_ADDR']);
  $data = json_decode($response);
  return isset($data->success) AND $data->success == true;
}

// LOGIN
if (isset($_POST['login'], $_POST['username'], $_POST['password'])) {
    $query = $db->prepare('SELECT COUNT(*) AS nb, id, username FROM users WHERE username=? AND password=?');
    $query->execute([
      $_POST['username'],
      md5($_POST['password'])
    ]);
    $data = $query->fetch();
    if ($data->nb) {
        $_SESSION['user'] = $data->username;
        $_SESSION['user_id'] = $data->id;
        header("location: index.php");
        exit;
    } else {
      $error = "Password or username incorrect";
    } 
}

// SIGNUp
if (isset($_POST['signup'], $_POST['username'], $_POST['email'], $_POST['password'], $_POST['confirm'])) {
  if (preg_match("#^[a-z0-9_-]{3,30}$#i", $_POST['username'])) {
      if (captcha()) {
    $query = $db->prepare("SELECT COUNT(*) AS nb FROM users WHERE username=?");
    $query->execute([
      $_POST['username']
    ]);
    $data = $query->fetch();

    if (!$data->nb) {
      if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $query = $db->prepare("SELECT COUNT(*) AS nb FROM users WHERE email=?");
        $query->execute([
          $_POST['email']
        ]);
        $data = $query->fetch();

        if (!$data->nb) {
          if ($_POST['password'] === $_POST['confirm']) {
            if (strlen($_POST['password']) >= 4) {

              $query = $db->prepare("INSERT INTO users(username, email, password) VALUES(:username, :email, :password)");
              $query->execute([
                "username" => $_POST['username'],
                "email" => $_POST['email'],
                "password" => md5($_POST['password'])
              ]);

              $_SESSION['user'] = $_POST['username'];
              $_SESSION['user_id'] = $db->lastInsertId();

              header("Location: index.php");
              exit;

            } else {
              $error = "The password must be at least 4 characters";
            }
          } else {
            $error = "The two passwords must match";
          }
        } else {
          $error = "This email is already taken";
        }
      } else {
        $error = "Incorrect email format";
      }
    } else {
      $error = "This username is already taken";
    }
  }
  else 
  {
      $error = "Invalid captcha";  
  }
  }
  else
  {
    $error = "The username must be within 3 and 30 characters";
  }
}

include 'inc/header.php';
?>
    <?php
    if (isset($error)) echo "<div class=\"message_erreur\">$error</div>";
    ?>
        <section>
            <h1 class="title">Log in</h1>
            <form method="POST">
            Username : <input type="text" name="username" required />
            Password : <input type="password" name="password" required />
        <input type="submit" name="login" value="Se connecter" required />
        </form>
        </section>

        <section>
            <h2 class="title">Sign Up</h2>
            <form method="POST">
            <label>Username :<br />
              <input type="text" name="username" <?php if(isset($_POST['username'])) echo 'value="'.htmlspecialchars($_POST['username']).'"'; ?> required />
            </label>
            <label>Email :<br />
              <input type="text" name="email" <?php if(isset($_POST['email'])) echo 'value="'.htmlspecialchars($_POST['email']).'"'; ?> required />
            </label>
            <label>Password :<br />
              <input type="password" name="password" required />
            </label>
            <label>Repeat password :<br />
              <input type="password" name="confirm" required />
            </label>
            <center><div class="g-recaptcha" data-sitekey="6LdXGA8TAAAAAKV0MvCvn5eT3--7v4eipyvKPD0s"></div></center><br/>
            <input type="submit" name="signup" value="Créer un compte" />
        </form>
        </section>
<?php
include 'inc/footer.php';
se eliminaron 133 caracteres en el cuerpo
Origen Enlace

Hola estoy obteniendo un error muy seguido en php el error es:

Notice: Trying to get property of non-object in C:\xampp\htdocs\login.php on line 20

El php es el siguiente:

<?php
require 'inc/base.php';

if (!isset($_SESSION['user_id'])) {
  header("Location: index.php"); exit;
}

include 'inc/header.php';
?>
        <section>
            <h1 class="title">Encryptclass="title"> now</h1>
                <?php
        $query = $db->prepare("SELECT timestamp FROM users WHERE id=?");
        $query->execute([$_SESSION['user_id']]);
        $data = $query->fetch();

                if ($data->timestamp == 0) {
                    echo "<div class=message_erreur>You can't access to this, please buy our crypter.<class=message_erreur></div>";
                } elseif (time() - $data->timestamp > 1296000) {
            // 15 jours
                    echo "<div class=message_erreur>Your right to use Cesium Crypter has expired. Please buy again.</div>";
                } else {
                    
                }
          ?>
                  <div class="message_erreur">To keep it FUD, please don't check the file with virustotal.com. Use refud.me<class="message_erreur"></div>
          <form action="upload.php" method="post" enctype="multipart/form-data">
            Select file to upload:
            <input type="hidden" name="MAX_FILE_SIZE" value="100485760" />
            <input name="filexls" type="file">
            <input type="submit" value="Upload" name="submit">
          </form>
          <?php
                }
                ?>
        </section>
<?php
include 'inc/footer.php';

Mi usuario tendría los siguientes valores:

introducir la descripción de la imagen aquí

Mi tabla:

introducir la descripción de la imagen aquí

Hola estoy obteniendo un error muy seguido en php el error es:

Notice: Trying to get property of non-object in C:\xampp\htdocs\login.php on line 20

El php es el siguiente:

<?php
require 'inc/base.php';

if (!isset($_SESSION['user_id'])) {
  header("Location: index.php"); exit;
}

include 'inc/header.php';
?>
        <section>
            <h1 class="title">Encrypt now</h1>
                <?php
        $query = $db->prepare("SELECT timestamp FROM users WHERE id=?");
        $query->execute([$_SESSION['user_id']]);
        $data = $query->fetch();

                if ($data->timestamp == 0) {
                    echo "<div class=message_erreur>You can't access to this, please buy our crypter.</div>";
                } elseif (time() - $data->timestamp > 1296000) {
            // 15 jours
                    echo "<div class=message_erreur>Your right to use Cesium Crypter has expired. Please buy again.</div>";
                } else {
                    
                }
          ?>
                  <div class="message_erreur">To keep it FUD, please don't check the file with virustotal.com. Use refud.me</div>
          <form action="upload.php" method="post" enctype="multipart/form-data">
            Select file to upload:
            <input type="hidden" name="MAX_FILE_SIZE" value="100485760" />
            <input name="filexls" type="file">
            <input type="submit" value="Upload" name="submit">
          </form>
          <?php
                }
                ?>
        </section>
<?php
include 'inc/footer.php';

Mi usuario tendría los siguientes valores:

introducir la descripción de la imagen aquí

Mi tabla:

introducir la descripción de la imagen aquí

Hola estoy obteniendo un error muy seguido en php el error es:

Notice: Trying to get property of non-object in C:\xampp\htdocs\login.php on line 20

El php es el siguiente:

<?php
require 'inc/base.php';

if (!isset($_SESSION['user_id'])) {
  header("Location: index.php"); exit;
}

include 'inc/header.php';
?>
        <section>
            <h1 class="title"> now</h1>
                <?php
        $query = $db->prepare("SELECT timestamp FROM users WHERE id=?");
        $query->execute([$_SESSION['user_id']]);
        $data = $query->fetch();

                if ($data->timestamp == 0) {
                    echo "<div class=message_erreur></div>";
                } elseif (time() - $data->timestamp > 1296000) {
            // 15 jours
                    echo "<div class=message_erreur>Your right to use . Please buy again.</div>";
                } else {
                    
                }
          ?>
                  <div class="message_erreur"></div>
          <form action="upload.php" method="post" enctype="multipart/form-data">
            Select file to upload:
            <input type="hidden" name="MAX_FILE_SIZE" value="100485760" />
            <input name="filexls" type="file">
            <input type="submit" value="Upload" name="submit">
          </form>
          <?php
                }
                ?>
        </section>
<?php
include 'inc/footer.php';

Mi usuario tendría los siguientes valores:

introducir la descripción de la imagen aquí

Mi tabla:

introducir la descripción de la imagen aquí

Origen Enlace
Loading