echo json_encode(array("code" => 5)); die; } $r = $q->fetch_assoc(); if ($r['type'] != $var) { echo json_encode(array("code" => 5)); die; } } return $temp; } $u = $conn->real_escape_string($_SESSION['user']->userid); $title = setV("title", false); $level = setV("level", true); $sch = setV("sch", true); $subj = setV("subj", true); if (isset($_POST['pass'])) { $pass = sha1($conn->real_escape_string($_POST['pass'])); } else { $pass = ""; } if (!isset($_POST['notes'])) { echo json_encode(array("code" => 4)); die; } $f = $_POST['notes']; $file = new File($f, $conn); if ($file->error == 4) { echo json_encode(array("code" => 4)); die; }
} $r = $q->fetch_assoc(); if ($r['type'] != $var) { echo json_encode(array("code" => 5)); die; } } return $temp; } $name = setV("name"); $level = setV("level"); $sch = setV("sch"); $email = setV("email"); $user = setV("user"); $pass = setV("pass"); $pass2 = setV("pass2"); if ($pass != $pass2) { echo json_encode(array("code" => 3)); die; } $hash = password_hash($pass, PASSWORD_BCRYPT); $code = sha1(time() . rand() . "saltingnotesacademy"); $q = $conn->query("INSERT INTO users VALUES (NULL, '{$name}', '{$email}', '{$sch}', '{$level}', '{$user}', '{$hash}', 0, '{$code}')"); if ($conn->error != "") { echo json_encode(array("code" => 4)); die; } include "mail.php"; require 'vendor/autoload.php'; use Mailgun\Mailgun; # Instantiate the client.