Initial commit

This commit is contained in:
ldy
2025-06-06 17:14:52 +08:00
parent 0465a9baef
commit f0aabfb5ac
91 changed files with 4466 additions and 0 deletions

38
login/RegisterByDB.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
include "../indexes/ConnectDB.php";
//get posted messages
$user = $_POST["user"]; // username from login form
$pwd = $_POST["pwd"]; // password from login form
$user_type = $_POST["user_type"]; // password from login form
// check if user is empty
$sql_regname = "SELECT * FROM $user_type WHERE name = '$user'";
$res = mysqli_query($conn, $sql_regname);
$row = mysqli_num_rows($res);
if($row == 0){
if($user){
// prepare sql
$sql_insert = "INSERT INTO `$user_type` (`name`, `pwd`) VALUES ('$user', '$pwd')";
$result = mysqli_query($conn, $sql_insert); //if success, return 1
// redirect to interfaces
if($result > 0){
echo "<script type='text/javascript'>
window.location.href = './interfaces/register_success.php';
</script>";
}
else {
echo "<script type='text/javascript'>
window.location.href = './interfaces/register_interrupted.php';
</script>";
}
}
}
else{
echo "<script type='text/javascript'>
window.location.href = './interfaces/register_failed.php';
</script>";
}
?>