Files
web-site/Projects/Frontend/Controllers/Contact.php
T
2026-07-01 16:44:17 +03:00

55 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php namespace Project\Controllers;
use Method,Captcha,Session,View;
class Contact extends Controller{
function main(){
}
function send(){
$name = Method::post('name');
$email = Method::post('email');
$message = Method::post('message');
$token = Method::post('token');
if ($token !== Captcha::getCode()) {
echo '0&'.lang('contact','message4');
return;
}
if (empty($name) || strlen($name) < 2) {
echo '0&'.lang('contact','nameAlert');
return;
}
if (empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo '0&'.lang('contact','mailFaultAlert');
return;
}
if (empty($message) || strlen($message) < 10) {
echo '0&'.lang('contact','messageAlert');
return;
}
$lastTime = Session::select('contact_last_time');
if ($lastTime !== false && (time() - $lastTime) < 30) {
echo '0&'.lang('contact','message1');
return;
}
Session::insert('contact_last_time', time());
$email = strtolower(trim($email));
$message2 = '
Gönderildiği Yer: Pisilinux İletişim Formu
Mesajı Gönderen: '.$name.'
Mail Adresi: '.$email.'
Mesaj: '.$message;
telegram($message2);
echo '1&'.lang('contact','message1');
}
}