$item) {
$properties_more = isset($item["PROPERTIES_MORE"]) ? $item["PROPERTIES_MORE"] : false;
if (!$properties_more) {
$total_items++;
}
}
}
if (!$total_items) {
$basket_url = $site_url . "basket.php";
$rp = get_param("rp");
if (strlen($rp)) {
$basket_url .= "?rp=" . urlencode($rp);
}
header("Location: " . $basket_url);
exit;
}
$secure_user_profile = get_setting_value($settings, "secure_user_profile", 0);
if ($secure_user_profile) {
$user_profile_url = $secure_url . "user_profile.php?return_page=" . urlencode($order_info_url);
} else {
$user_profile_url = $site_url . "user_profile.php?return_page=" . urlencode($order_info_url);
}
set_session("session_vc", "");
set_session("session_order_id", "");
set_session("session_payment_id", "");
if (get_session("session_user_id"))
{
header("Location: " . $order_info_url);
exit;
}
$t = new VA_Template($settings["templates_dir"]);
$t->set_file("main","checkout.html");
$t->set_var("order_info_href", $order_info_url);
$t->set_var("order_info_url", $order_info_url);
$t->set_var("user_profile_href", $user_profile_url);
$t->set_var("user_profile_url", $user_profile_url);
$t->set_var("forgot_password_href", $forgot_password_url);
$t->set_var("checkout_url", $checkout_url);
$login = get_cookie("cookie_user_login");
$password = get_cookie("cookie_user_password");
if(strlen($login) && strlen($password)) {
$cookie_login = true;
} else {
$cookie_login = false;
$login = "";
$password = "";
}
$errors = "";
$remember_me = get_param("remember_me");
$action = get_param("action");
if($action == "login" || $cookie_login)
{
if(!$cookie_login)
{
$login = get_param("login");
$password = get_param("password");
if(!strlen($login)) {
$error_message = str_replace("{field_name}", LOGIN_FIELD, REQUIRED_MESSAGE);
$errors .= $error_message . "
";
}
if(!strlen($password)) {
$error_message = str_replace("{field_name}", PASSWORD_FIELD, REQUIRED_MESSAGE);
$errors .= $error_message . "
";
}
}
if(!$errors && check_black_ip()) {
$errors = BLACK_IP_MSG;
}
if(!strlen($errors)) {
user_login($login, $password, "", $remember_me, $order_info_url, true, $errors);
}
}
if ($remember_me) {
$t->set_var("remember_me", "checked");
} else {
$t->set_var("remember_me", "");
}
$t->set_var("login", htmlspecialchars($login));
$user_registration = get_setting_value($settings, "user_registration", 0);
if ($user_registration == 1) {
$t->set_var("checkout_without_link", "");
} else {
$t->parse("checkout_without_link", false);
}
$types_number = 0;
// parse user types allowed for registration
$sql = " SELECT type_id, type_name FROM " . $table_prefix . "user_types WHERE is_active=1 AND show_for_user=1 ";
$db->query($sql);
if ($db->next_record()) {
do {
$types_number++;
$type_id = $db->f("type_id");
$type_name = $db->f("type_name");
$t->set_var("user_type_name", $type_name);
$t->set_var("user_profile_type_url", $user_profile_url . "&type=" . $type_id);
$t->parse("user_types", true);
} while ($db->next_record());
}
if (!$user_registration || $types_number) {
$t->sparse("new_user_block", false);
}
if(strlen($errors)) {
$t->set_var("errors_list", $errors);
$t->parse("errors", false);
} else {
$t->set_var("errors", "");
}
include("./header.php");
include("./footer.php");
$t->pparse("main");
?>