%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/www/website_6ca89795/ |
Upload File : |
<?php
include('dbcon.php');
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
$error = "";
if (isset($_POST['register'])) {
$username = trim($_POST['username']);
$phone = trim($_POST['phone']);
$email = trim($_POST['email']);
$password = trim($_POST['password']);
$confirm_password = trim($_POST['confirm_password']);
$curr_date = date('Y-m-d');
$usertype = '';
if ($password !== $confirm_password) {
$error = "Passwords do not match!";
} else {
$check = $conn->prepare("SELECT id FROM user WHERE email=?");
$check->bind_param("s", $email);
$check->execute();
$res = $check->get_result();
if ($res->num_rows > 0) {
$error = "Email already exists!";
} else {
$stmt = $conn->prepare("INSERT INTO user (username, email, password, phone, usertype, created_date) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->bind_param("ssssss", $username, $email, $password, $phone, $usertype, $curr_date);
if ($stmt->execute()) {
// EMAIL SEND
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'siddharth.websutility@gmail.com';
$mail->Password = 'ojur aoaa sugz qlwq';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('siddharth.websutility@gmail.com', 'JGT Tourism');
$mail->addAddress($email);
$mail->isHTML(true);
$mail->Subject = 'Registration Successful';
$mail->Body = "Hello $username,<br>Welcome to our website!";
$mail->send();
} catch (Exception $e) {}
echo "<script>alert('Registration successful');window.location='login.php';</script>";
exit;
} else {
$error = "Error: " . $stmt->error;
}
$stmt->close();
}
$check->close();
}
}
include('header.php');
?>
<style>
.register-section{
padding:80px 0;
background:#f5f5f5;
}
.register-card{
background:#fff;
border-radius:15px;
padding:40px;
box-shadow:0 5px 25px rgba(0,0,0,.10);
}
.register-title{
text-align:center;
margin-bottom:30px;
}
.register-title h2{
font-size:36px;
font-weight:700;
color:#111;
margin-bottom:10px;
}
.register-title p{
color:#777;
}
.form-control{
height:55px;
border-radius:8px;
border:1px solid #ddd;
}
.form-control:focus{
box-shadow:none;
border-color:#009245;
}
.btn-register{
width:100%;
height:55px;
border:none;
border-radius:8px;
background:#009245;
color:#fff;
font-size:18px;
font-weight:600;
transition:.3s;
}
.btn-register:hover{
background:#007a39;
}
.login-link{
text-align:center;
margin-top:20px;
}
.login-link a{
color:#009245;
text-decoration:none;
font-weight:600;
}
.login-link a:hover{
color:#000;
}
.alert-danger{
border-radius:8px;
}
.page-heading{
padding:40px 0;
text-align:center;
background:#fff;
border-bottom:1px solid #eee;
}
.page-heading h1{
font-size:42px;
font-weight:700;
margin-bottom:10px;
}
.page-heading a{
color:#009245;
text-decoration:none;
}
@media(max-width:768px){
.register-card{
padding:25px;
}
.register-title h2{
font-size:28px;
}
}
</style>
<div class="page-heading">
<div class="container">
<h1>Register</h1>
<p>
<a href="index.php">Home</a> /
Register
</p>
</div>
</div>
<div class="register-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-6 col-md-8">
<div class="register-card">
<div class="register-title">
<h2>Create Account</h2>
<p>
Register to start shopping with Meat And Go
</p>
</div>
<?php if($error!=""){ ?>
<div class="alert alert-danger">
<?php echo $error; ?>
</div>
<?php } ?>
<form method="post">
<div class="mb-3">
<input
type="text"
name="username"
class="form-control"
placeholder="Username"
required>
</div>
<div class="mb-3">
<input
type="email"
name="email"
class="form-control"
placeholder="Email Address"
required>
</div>
<div class="mb-3">
<input
type="text"
name="phone"
class="form-control"
placeholder="Phone Number"
required>
</div>
<div class="mb-3">
<input
type="password"
name="password"
class="form-control"
placeholder="Password"
required>
</div>
<div class="mb-4">
<input
type="password"
name="confirm_password"
class="form-control"
placeholder="Confirm Password"
required>
</div>
<button
type="submit"
name="register"
class="btn-register">
Create Account
</button>
</form>
<div class="login-link">
Already have an account?
<a href="login.php">
Login Here
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include('footer.php'); ?>