Example #1
0
function regUpdateContactInfo($old_login, $login, $cust_password, $Email, $first_name, $last_name, $subscribed4news, $additional_field_values)
{
    db_query("update " . CUSTOMERS_TABLE . "  set " . " Login = '******', " . " cust_password = '******', " . " Email = '" . xToText($Email) . "', " . " first_name = '" . xToText(trim($first_name)) . "', " . " last_name = '" . xToText(trim($last_name)) . "', " . " subscribed4news = " . (int) $subscribed4news . " " . " where Login='******'");
    foreach ($additional_field_values as $key => $val) {
        SetRegField($key, $login, $val["additional_field"]);
    }
    if (!strcmp($old_login, $login)) {
        //update administrator login (core/config/connect.inc.php)
        db_query("update " . CUSTOMERS_TABLE . " set Login='******' where Login='******'");
    }
    $customerID = regGetIdByLogin($login);
    if ($subscribed4news) {
        subscrAddRegisteredCustomerEmail($customerID);
    } else {
        subscrUnsubscribeSubscriberByEmail(base64_encode($Email));
    }
}
Example #2
0
        $login = $_POST["login"];
        $cust_password1 = $_POST["cust_password1"];
        $cust_password2 = $_POST["cust_password2"];
        $first_name = $_POST["first_name"];
        $last_name = $_POST["last_name"];
        $Email = $_POST["email"];
        $subscribed4news = isset($_POST["subscribed4news"]) ? 1 : 0;
        $additional_field_values = ScanPostVariableWithId(array("additional_field"));
        if (trim($login) != trim($_SESSION["log"]) && regIsRegister($login)) {
            $error = ERROR_USER_ALREADY_EXISTS;
        }
        if (!isset($error)) {
            $error = regVerifyContactInfo($login, $cust_password1, $cust_password2, $Email, $first_name, $last_name, $subscribed4news, $additional_field_values);
        }
        if ($error == "") {
            unset($error);
        }
        if (!isset($error)) {
            regUpdateContactInfo($_SESSION["log"], $login, $cust_password1, $Email, $first_name, $last_name, $subscribed4news, $additional_field_values);
            $_SESSION["log"] = $login;
            $_SESSION["pass"] = cryptPasswordCrypt($cust_password1, null);
            Redirect("index.php?contact_info=yes");
        } else {
            $smarty->assign("error", $error);
        }
    }
    // additional fields
    $additional_fields = GetRegFields();
    $smarty->assign("additional_fields", $additional_fields);
    $smarty->assign("main_content_template", "contact_info.tpl");
}