<?php
include '../components/connect.php';
if (isset($_POST['submit'])) {
$id = unique_id();
$name = $_POST['name'];
$name = filter_var($name, FILTER_SANITIZE_STRING);
$email = $_POST['email'];
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
$pass = $_POST['pass'];
$pass = filter_var($pass, FILTER_SANITIZE_STRING);
$cpass = $_POST['cpass'];
$cpass = filter_var($cpass, FILTER_SANITIZE_STRING);
$image = $_FILES['image']['name'];
$image = filter_var($image, FILTER_SANITIZE_STRING);
$ext = pathinfo($image, PATHINFO_EXTENSION);
$rename = unique_id() . '.' . $ext;
$image_size = $_FILES['image']['size'];
$image_tmp_name = $_FILES['image']['tmp_name'];
$image_folder = '../uploaded_files/' . $rename;
$select_seller = $conn->prepare("SELECT * FROM `sellers` WHERE email = ?");
$select_seller->execute([$email]);
if ($select_seller->rowCount() > 0) {
$warning_msg[] = 'Email already exists!';
} else {
if ($pass != $cpass) {
$warning_msg[] = 'Confirm password does not match';
} else {
$hashed_password = password_hash($cpass, PASSWORD_BCRYPT);
$insert_seller = $conn->prepare("INSERT INTO `sellers` (id, name, email, password, image) VALUES (?, ?, ?, ?, ?)");
$insert_seller->execute([$id, $name, $email, $hashed_password, $rename]);
move_uploaded_file($image_tmp_name, $image_folder);
$success_msg[] = 'New seller registered! Please log in now';
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blue Sky Summer - Seller Registration</title>
<link rel="stylesheet" href="../css/admin_style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
</head>
<body>
<div class="form-container">
<form action="" method="post" enctype="multipart/form-data" class="registration">
<h3>Register Now</h3>
<div class="flex">
<div class="col">
<div class="input-fields">
<p>Your Name <span>*</span></p>
<input type="text" name="name" placeholder="Enter your name" maxlength="50" required class="box">
</div>
<div class="input-fields">
<p>Your Email <span>*</span></p>
<input type="email" name="email" placeholder="Enter your email" maxlength="50" required class="box">
</div>
</div>
<div class="col">
<div class="input-fields">
<p>Your Password <span>*</span></p>
<input type="password" name="pass" placeholder="Enter your password" maxlength="50" required class="box">
</div>
<div class="input-fields">
<p>Confirm Password <span>*</span></p>
<input type="password" name="cpass" placeholder="Confirm your password" maxlength="50" required class="box">
</div>
</div>
</div>
<div class="input-fields">
<p>Your Profile <span>*</span></p>
<input type="file" name="image" accept="image/*" required class="box">
</div>
<p class="link">Already have an account? <a href="login.php">Login now</a></p>
<input type="submit" name="submit" value="Register Now" class="btn">
</form>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
<script src="../js/script.js"></script>
<?php include '../components/alerts.php'; ?>
</body>
</html>
Can you help me identify why the PHP code snippet appears at the top of the browser and how to fix it?
ino
#1
0 Likes
OdatNurd
#2
This is a forum for support issues related to Sublime Text; your question is more a general purpose programming question.
Someone may be able to help you, but overall I would recommend seeking out a forum more directly related to programming topics.
0 Likes