dj_mix_hosting_software/contact.php
Cody Cook 74f1d6e193
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 53s
PHPUnit stuff.
2024-05-14 17:54:06 -07:00

70 lines
2.8 KiB
PHP

<?php
require_once 'includes/globals.php';
require_once 'vendor/autoload.php';
use DJMixHosting\Telegram;
if ($_POST) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
require_once 'classes/Telegram.php';
$telegram = new Telegram($config['notifications']['telegram']['token'], $config['notifications']['telegram']['chat_id']);
$result = $telegram->send_message("Name: $name\nEmail: $email\nMessage: $message");
}
$title = $locale['contactus'];
require_once 'includes/header.php';
if ($_POST) {
if ($result['ok']) {
echo '<div class="alert alert-success" role="alert">Message sent successfully</div>';
} else {
echo '<div class="alert alert-danger" role="alert">An error occurred while sending the message</div>';
}
}
?>
<section>
<div class="container py-5">
<div class="row">
<div class="col">
<nav aria-label="breadcrumb" class="bg-body-tertiary rounded-3 p-3 mb-4">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="/"><?php echo $locale['home']; ?></a></li>
<li class="breadcrumb-item active"><a
href="/contact.php"><?php echo $locale['contactus']; ?></a></li>
</ol>
</nav>
</div>
</div>
</div>
</section>
<div class="container py-5">
<div class="row">
<div class="col">
<h1><?php echo $locale['contactus']; ?></h1>
<p>For any inquiries, please complete the form below.</p>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<form action="contact.php" method="post">
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="mb-3">
<label for="message" class="form-label">Message</label>
<textarea class="form-control" id="message" name="message" rows="3" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
<?php
require_once 'includes/footer.php';