This commit is contained in:
louiscklaw
2025-01-31 19:15:17 +08:00
parent 09adae8c8e
commit 6c60a73f30
1546 changed files with 286918 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?php
if(strlen(trim($_POST['username']))>0 && strlen(trim($_POST['password']))>0){
$userName = $_POST['username'];
$pwd = $_POST['password'];
if(substr_count($userName,"@")==1){
require_once('ini/conn.php');
$sql= "SELECT password FROM administrator WHERE email='$userName'";
$result = mysqli_query($conn,$sql) or die(mysqli_errno($conn));
if(mysqli_num_rows($result)==1){
$record = mysqli_fetch_assoc($result);
if($pwd==$record["password"]){
setcookie("AdminName", $userName, time()+60*15);
header("location: adminOrder.php");
}else{
header("location: index.php?Login=FALSE");
}
}else{
header("location: index.php?Login=FALSE");
}
}else{
require_once('ini/conn.php');
$sql= "SELECT password FROM dealer WHERE dealerID='$userName'";
$result = mysqli_query($conn,$sql) or die(mysqli_errno($conn));
if(mysqli_num_rows($result)==1){
$record = mysqli_fetch_assoc($result);
if($pwd==$record["password"]){
setcookie("DealerName", $userName, time()+60*15);
header("location: createOrder.php");
}else{
header("location: index.php?Login=FALSE");
}
}else{
header("location: index.php?Login=FALSE");
}
}
}else{
header("location: index.php?userName=FALSE&pwd=FALSE");
}
?>