<?php
ob_start();
session_start();
$pageTitle = 'contact';
include 'init.php';
?>
<?php
if (isset($_POST['Add_cons']) OR isset($_POST['add_mail_posts']) ) {
$ip = "";
if (!empty($_SERVER["HTTP_CLIENT_IP"]))
{
// Check for IP address from shared Internet
$ip = $_SERVER["HTTP_CLIENT_IP"];
}
elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
// Check for the proxy user
$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
else
{
$ip = $_SERVER["REMOTE_ADDR"];
}
if (isset($_POST['Add_cons'])){
$checkip = $conn->prepare("SELECT ipcons FROM consultation WHERE ipcons = ? AND adddatecons between date_sub(now(),INTERVAL 1 WEEK) and now() ");
$checkip->execute(array($ip));
$check1 = $checkip->rowcount();
if ($check1 == 1) {
header('Location:ret.php?b');
exit;
}else{
$name = filter_var($_POST['cons_nme'], FILTER_SANITIZE_STRING);
$email = filter_var($_POST['cons_email'], FILTER_SANITIZE_STRING);
$phone = filter_var($_POST['cons_phone'], FILTER_SANITIZE_STRING);
$exp = filter_var($_POST['cons_exp'], FILTER_SANITIZE_STRING);
$coty = filter_var($_POST['constype'], FILTER_SANITIZE_NUMBER_INT);
$stmt = $conn->prepare("INSERT INTO
consultation(namecons, phonecons, emailcons, expcons, typecons, ipcons, adddatecons)
VALUES (:znam, :zpho, :zema, :zexp, :zcot, :zipp, now() ) ");
$stmt->execute(array(
'znam' => $name,
'zpho' => $phone,
'zema' => $email,
'zexp' => $exp,
'zcot' => $coty,
'zipp' => $ip
));
header('location:ret.php?a');
exit();
}
}
if (isset($_POST['add_mail_posts'])){
$nltemail = filter_var($_POST['cus_mail_post'], FILTER_SANITIZE_STRING);
$checkip = $conn->prepare("SELECT mailnewsip FROM mailnewsletter WHERE mailnewsip = ?");
$checkip->execute(array($ip));
$check1 = $checkip->rowcount();
$checkemail = $conn->prepare("SELECT mailnewsemail FROM mailnewsletter WHERE mailnewsemail = ?");
$checkemail->execute(array($nltemail));
$check2 = $checkemail->rowcount();
if ($check1 > 2) {
header('Location:ret.php?c');
exit;
}elseif ($check2 == 1) {
header('Location:ret.php?d');
exit;
}else{
$stmt22 = $conn->prepare("INSERT INTO
mailnewsletter(mailnewsemail, mailnewsip, mailnewsadddate)
VALUES (:zema, :zipp, now() ) ");
$stmt22->execute(array(
'zema' => $nltemail,
'zipp' => $ip
));
header('location:ret.php?e');
exit();
}
}
}else{
header('Location:index.php');
exit;}?>
<?php
include $tpl . 'footer_ar.php';
ob_end_flush();
?>| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| aboutus.php | File | 15.22 KB | 0644 |
|
| add_consultation.php | File | 2.94 KB | 0644 |
|
| contact.php | File | 4.29 KB | 0644 |
|
| costresult.php | File | 14.62 KB | 0644 |
|
| costscalc.php | File | 44.42 KB | 0644 |
|
| customer_special.php | File | 17.66 KB | 0644 |
|
| details.php | File | 6.2 KB | 0644 |
|
| error_log | File | 4.54 KB | 0644 |
|
| index.php | File | 21.4 KB | 0644 |
|
| init.php | File | 584 B | 0644 |
|
| projects.php | File | 3.01 KB | 0644 |
|
| ret.php | File | 3.39 KB | 0644 |
|
| services.php | File | 9.94 KB | 0644 |
|