$thedomain = "https://healthy-living.org";
$dbh=mysqli_connect ("localhost", "mylargi_yes", "outwest1@3$", "mylargi_mylargi") or die ('I cannot connect to the database.');
function is_email_valid($email) {
return (!preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $email)) ? FALSE : TRUE;
}
function stripltb ($s) {
trim ($s);
return strlen($s);
}
function quote_smarts($value) {
global $dbh;
return $value = "'" . mysqli_real_escape_string($dbh,$value) . "'";
}
function quote_smartn($value) {
if (is_numeric($value)) return $value;
else return 0;
}
$ip= $_SERVER['REMOTE_ADDR'];
// if this ip has entered this page more than seven times in the last 10 minutes... then ignore
$thetime = time() - 600;
$query = "DELETE FROM `applications_last_10 minutes` WHERE thetime < '$thetime'";
mysqli_query ($dbh,$query);
$thetime +=600;
$query = "SELECT `ip`, `attempts`, `thetime` FROM `order_inserts_last_10 minutes` WHERE ip = '$ip'";
$searchresult = mysqli_query ($dbh,$query);
if (mysqli_num_rows($searchresult)) {
$row = mysqli_fetch_assoc($searchresult);
$attempts = $row['attempts'];
if ($attempts >= 8) exit(0);
if ($attempts >= 4) send_mail ('MyLarginine', 'info@mylarginine.com', 'Kent Hinkson', 'kent@hinksons.net', "$attempts wholesale apply attempts", "ip ($ip) has wholesale applied too many times");
$attempts+=1;
$query = "UPDATE `applications_last_10 minutes` SET attempts='$attempts',thetime='$thetime' where ip='$ip'";
mysqli_query($dbh,$query);
}
else {
$query = "INSERT INTO `applications_last_10 minutes`(`ip`, `attempts`, `thetime`) VALUES ('$ip',1,'$thetime')";
mysqli_query($dbh,$query);
}
// get input
$sub = $ses_tld = $_GET['ses_tld'];
$submit = $_POST['submit'];
$ip= $_SERVER['REMOTE_ADDR'];
//get selected items from cookie
$items_array = explode (",",$myses_items);
foreach ($items_array as $item) {
if (preg_match("/^qty(.*):(.*)$/",$item,$matches)) $items[$matches[1]] = $matches[2];
}
if ($submit == 'Continue') {
$first = $_POST['first'];
$last = $_POST['last'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$province = $_POST['province'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$email = $_POST['email'];
$email2 = $_POST['email2'];
$phone = $_POST['phone'];
$phone2 = $_POST['phone2'];
$error = 0;
if (1 > strlen ($first)) {$first_error = "Required";$error = 1;}
if (2 > strlen ($last)) {$last_error = "Required";$error = 1;}
$email = trim($email);
$email2 = trim ($email2);
if ($email != $email2) {$email_error = $email2_error = "Email addresses don't match";$error = 1;}
if (!is_email_valid($email)) {$email_error = "$email is invalid";$error = 1;}
if (!is_email_valid($email2)) {$email2_error = "$email2 is invalid";$error = 1;}
if (10 > strlen($phone)) {$phone_error = "Invalid";$error = 1;}
$lenphone2 = strlen($phone2);
if ($lenphone2 > 0 && 10 > $lenphone2) {$phone2_error = "Invalid";$error = 1;}
if (4 > strlen($address1)) {$address1_error = 'Required';$error = 1;}
if (3 > strlen($city)) {$city_error = 'Required';$error = 1;}
if (strlen($state) < 1 && strlen($province) < 1) {$state_error = 'Required';$error = 1;}
$sx = $state."_selected";
$$sx = 'selected';
// $sx = $country."_selected";
// $$sx = 'selected';
if (3 > strlen($zip) && (strlen($state) == 2 || strlen($province) > 1) ) {$zip_error = 'Required';$error = 1;}
if ($shipping == '') {$shipping_error = 'Required';$error = 1;}
//if (strpos('-AB-BC-MB-NB-NL-NS-NT-NU-ON-PE-QC-SK-YT',$state) > 0 && $country != 'c') { $country_error = 'Inconsistent with state'; $error = 1; }
if ( ($shipping == 'c' && $country != 'c') || ($shipping != 'c' && $country == 'c') ) { $country_error = '
| Shipping inconsistent for country. Either go back and select a different shipping option or select a different country. |