initial commit

This commit is contained in:
equippedcoding-master
2025-09-17 09:37:06 -05:00
parent 86108ca47e
commit e2c98790b2
55389 changed files with 6206730 additions and 0 deletions

61
user/process-signup.php Normal file
View File

@@ -0,0 +1,61 @@
<?php
require_once "../include.php";
// /home/cradle2careertxxyz/portal/dashboard/core/api/php/init.php
// if (empty($_POST["name"])) {
// die("Name is required");
// }
if ( ! filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
die("Valid email is required");
}
if (strlen($_POST["password"]) < 8) {
die("Password must be at least 8 characters");
}
if ( ! preg_match("/[a-z]/i", $_POST["password"])) {
die("Password must contain at least one letter");
}
if ( ! preg_match("/[0-9]/", $_POST["password"])) {
die("Password must contain at least one number");
}
if ($_POST["password"] !== $_POST["password_confirmation"]) {
die("Passwords must match");
}
$password_hash = password_hash($_POST["password"], PASSWORD_DEFAULT);
$mysqli = func_get_database();
$sql = "INSERT INTO " . $GLOBALS["AUTH_USER_TABLE"] . " (name, email, username, password_hash) VALUES (?, ?, ?, ?)";
$stmt = $mysqli->stmt_init();
if ( ! $stmt->prepare($sql)) {
die("SQL error: " . $mysqli->error);
}
$stmt->bind_param("ssss",
$_POST["name"],
$_POST["email"],
$_POST["username"],
$password_hash);
if ($stmt->execute()) {
header("Location: signup-success.html");
exit;
} else {
if ($mysqli->errno === 1062) {
die("email already taken");
} else {
die($mysqli->error . " " . $mysqli->errno);
}
}