File manager - Edit - /home/custbahd/mediagepr.com/consult/add.php
Back
<?php session_start(); include_once('../admin/consult/db/connection.php'); if(isset($_POST['submit'])){ if($_POST['username'] != ''){ $_SESSION['username'] = $_POST['username']; } else { $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $sql = "INSERT INTO consult (name, email, phone) VALUES ('$name', '$email', '$phone')"; //use for MySQLi OOP if($conn->query($sql)){ $_SESSION['success'] = 'Consultation request submitted successfully'; } /////////////// //use for MySQLi Procedural // if(mysqli_query($conn, $sql)){ // $_SESSION['success'] = 'Member added successfully'; // } ////////////// else{ $_SESSION['error'] = 'Something went wrong while submitting consultation request. Try again later or <a href="tel:+256393236704">call us</a>'; } } } header('location: ../'); ?> <?php //Auto Responder $conn= mysqli_connect("localhost", "custbahd_customassistname", "Rwatangabo1son", "custbahd_mediage"); use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; require_once __DIR__ . '/vendor/phpmailer/src/Exception.php'; require_once __DIR__ . '/vendor/phpmailer/src/PHPMailer.php'; require_once __DIR__ . '/vendor/phpmailer/src/SMTP.php'; $mail = new PHPMailer(true); $mail->SMTPDebug = 0; $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = "info@mediagepr.com"; $mail->Password = "Mediagepr@256"; $mail->SMTPSecure = "ssl"; $mail->Port = 465; if(isset($_POST['submit'])){ if($_POST['username'] != ''){ $_SESSION['username'] = $_POST['username']; } else { $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST["phone"]; $mail->From = "info@mediagepr.com"; $mail->FromName = "Media Age Team"; $mail->addAddress("$email"); $mail->isHTML(true); $mail->Subject = "Consult | Media Age PR"; $mail->Body = file_get_contents("html/index.html"); try { $mail->send(); echo ""; } catch (Exception $e) { echo "Mailer Error: " . $mail->ErrorInfo; } } } ?> <?php //Mediage receiver $mail = new PHPMailer(true); $mail->SMTPDebug = 0; $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = "info@mediagepr.com"; $mail->Password = "Mediagepr@256"; $mail->SMTPSecure = "ssl"; $mail->Port = 465; if(isset($_POST['submit'])){ if($_POST['username'] != ''){ $_SESSION['username'] = $_POST['username']; } else { $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST["phone"]; $mail->From = "info@mediagepr.com"; $mail->FromName = "Media Age Team"; $mail->addAddress("$email"); $mail->isHTML(true); $mail->Subject = "Consult | Media Age PR"; $mail->Body = "<b>$name has requested for a consultation. <a href='tel:$phone'>$phone</a> <a href='mailto:$email'>$email</a></b><br><br> <br><br> <b align='center'>Consult | Media Age ©</b>"; try { $mail->send(); echo ""; } catch (Exception $e) { echo "Mailer Error: " . $mail->ErrorInfo; } } } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 2.3 |
proxy
|
phpinfo
|
Settings