<?php
session_start();
error_reporting(0);
include '../../assets/constant/config.php';
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if (isset($_POST['submit'])) {
$stmt = $conn->prepare("INSERT INTO `join_member`(`name`, `email`, `phone`, `gender`, `amount`) VALUES (?,?,?,?,?)");
$stmt->execute([
htmlspecialchars($_POST['name'], ENT_QUOTES, 'UTF-8'),
htmlspecialchars($_POST['email'], ENT_QUOTES, 'UTF-8'),
htmlspecialchars($_POST['phone'], ENT_QUOTES, 'UTF-8'),
htmlspecialchars($_POST['gender'], ENT_QUOTES, 'UTF-8'),
htmlspecialchars($_POST['amount'], ENT_QUOTES, 'UTF-8'),
]);
$_SESSION['success'] = "Added Product";
?>
<script>
// Redirect to ../about_seo.php
window.location.href = "../../../index.php";
</script>
<?php
}
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
function compressImage($source, $destination, $quality)
{
$info = getimagesize($source);
if ($info['mime'] == 'image/jpeg') {
$image = imagecreatefromjpeg($source);
imagejpeg($image, $destination, $quality);
} elseif ($info['mime'] == 'image/png') {
$image = imagecreatefrompng($source);
imagepng($image, $destination, round(9 - ($quality / 10))); // PNG quality ranges from 0 to 9
}
}