Completează toate câmpurile obligatorii!
';
} elseif (!validate_fullname($nume)) {
$message = 'Numele trebuie să conțină prenume și nume.
';
} elseif (email_exists($email)) {
$message = 'Există deja un cont cu acest email.
';
} else {
// toate aplicațiile afișate necesită MAC
$needs_mac = in_array($aplicatie, ['SMART IPTV','NETIPTV','MEGAIPTV','IBO PLAYER IPTV','HOTPLAYER','SETIPTV']);
if ($needs_mac && empty($macadress)) {
$message = 'Trebuie completat câmpul MAC pentru aplicația selectată.
';
$show_otp_form = false;
} else {
$otp = rand(100000, 999999);
$transient_data = [
'nume' => $nume,
'telefon' => $telefon,
'email' => $email,
'password' => $password,
'macadress' => $macadress,
'aplicatie' => $aplicatie,
'otp' => (string)$otp,
'otp_time' => time()
];
set_transient($session_key, $transient_data, 5 * MINUTE_IN_SECONDS);
$payload = [
'instance_id' => $GLOBALS['instance_id'],
'access_token' => $GLOBALS['access_token'],
'chatId' => $telefon . '@c.us',
'message' => "Codul tău OTP: $otp (valabil 5 minute)"
];
$resp = wp_remote_post('https://wawp.net/wp-json/awp/v1/send', [
'headers' => ['Content-Type' => 'application/json'],
'body' => wp_json_encode($payload),
'timeout' => 20
]);
if (is_wp_error($resp)) {
error_log("WhatsApp API error: " . $resp->get_error_message());
$message = 'OTP generat, dar nu am reușit să trimitem pe WhatsApp.
';
} else {
$message = 'Codul OTP a fost trimis pe WhatsApp. Valabil 5 minute.
';
}
$show_otp_form = true; // pentru POP-UP OTP
}
}
}
// PASUL 2: verificare OTP (în modal)
if (isset($_POST['otp_code'])) {
$otp_code = sanitize_text_field($_POST['otp_code']);
$data = get_transient($session_key);
if (!$data) {
$message = 'Sesiunea a expirat. Reîncearcă.
';
} elseif (time() - ($data['otp_time'] ?? 0) > 300) {
delete_transient($session_key);
$message = 'Cod OTP expirat. Reîncearcă.
';
} elseif ($otp_code !== ($data['otp'] ?? '')) {
$message = 'Cod OTP incorect.
';
$show_otp_form = true;
} else {
$nume = $data['nume'];
$telefon = $data['telefon'];
$email = $data['email'];
$password = $data['password'];
$macadress = $data['macadress'];
$aplicatie = $data['aplicatie'];
$parts = preg_split('/\s+/', $nume);
$username = generate_username_from_name($nume);
$iptv_pass = $password;
$customfields_array = [
458 => strtoupper($aplicatie),
398 => $macadress,
427 => $username,
428 => $iptv_pass,
391 => date('d-m-Y'),
392 => date('d-m-Y', strtotime('+24 hours')),
394 => 'TEST 24 ORE GRATIS ( Max 1 Conexiune )',
395 => '1',
396 => '0 EURO'
];
if (email_exists($email)) {
$message = 'Există deja un cont cu acest email.
';
$show_otp_form = true;
} else {
$user_id = wp_insert_user([
'user_login' => $username,
'user_pass' => $password,
'user_email' => $email,
'first_name' => $parts[0] ?? '',
'last_name' => $parts[1] ?? '',
'display_name' => $nume,
'role' => 'abonat'
]);
if (!is_wp_error($user_id)) {
update_user_meta($user_id, 'billing_phone', $telefon);
update_user_meta($user_id, 'macadress', $macadress);
update_user_meta($user_id, 'aplicatie', $aplicatie);
update_user_meta($user_id, 'iptv_username', $username);
update_user_meta($user_id, 'iptv_password', $iptv_pass);
foreach ($customfields_array as $k => $v) {
update_user_meta($user_id, 'whmcs_cf_' . $k, $v);
}
$whmcs = wp_whmcs_api([
'action' => 'AddClient',
'firstname' => $parts[0] ?? '',
'lastname' => $parts[1] ?? '',
'email' => $email,
'password2' => $password,
'address1' => 'N/A',
'city' => 'N/A',
'state' => 'N/A',
'postcode' => '0000',
'country' => 'RO',
'phonenumber' => $telefon,
'customfields'=> base64_encode(serialize($customfields_array))
]);
if ($whmcs && isset($whmcs['result']) && $whmcs['result'] === 'success') {
$client_id = $whmcs['clientid'];
update_user_meta($user_id, 'whmcs_client_id', $client_id);
$order = wp_whmcs_api([
'action' => 'AddOrder',
'clientid' => $client_id,
'pid' => '48',
'billingcycle' => 'monthly',
'paymentmethod'=> 'banktransfer',
'customfields' => base64_encode(serialize($customfields_array)),
'noinvoice' => true,
'status' => 'Pending'
]);
}
$user_info = get_user_by('id', $user_id);
if ($user_info) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id, true);
do_action('wp_login', $user_info->user_login, $user_info);
delete_transient($session_key);
wp_safe_redirect(home_url('/my-account'));
exit;
}
}
}
}
}
}
get_header();
?>
Pasul 1: Informații cont
Sumar Test Gratuit
Test Gratuit - 24 Ore
Total
0,00 €
Cum Funcționează?
Completezi Formularul
Durează mai puțin de 60 de secunde.
Primești Confirmarea
Un email automat este trimis instant.
Activăm & Te Notificăm
Primești datele de acces în max. 24 ore.
Ce Spun Clienții Noștri
'"Bună ziua, merge și EPG pentru programe. Mulțumesc!"', "author" => "- Dan"], ["text" => '"Sunt la voi de ani buni, nu am ce să reproșez. TOP!"', "author" => "- Bebe"], ["text" => '"Super calitate, recomand cu încredere!"', "author" => "- Marian"], ["text" => '"Merge perfect, suport rapid. Mulțumesc!"', "author" => "- Elena"], ["text" => '"Cel mai bun IPTV încercat până acum."', "author" => "- Robert"], ["text" => '"Foarte mulțumit, filme și sport impecabil!"', "author" => "- Andrei"], ["text" => '"Instalare rapidă, totul simplu și clar."', "author" => "- Ciprian"], ["text" => '"Funcționează excelent și în străinătate."', "author" => "- Aftode"], ["text" => '"Recomand, stabil și calitate foarte bună."', "author" => "- Sorin"], ["text" => '"Suport răspunde imediat, 10/10."', "author" => "- Luca"], ]; // amestecă și ia doar 2 shuffle($testimonials); $selected = array_slice($testimonials, 0, 2); foreach($selected as $t): ?>Siguranță & suport
- ✓ Test 100% gratuit, fără obligații
- ✓ Datele Tale Sunt în Siguranță
- ✓ Suport prin WhatsApp & email
Confirmare cod OTP
Am trimis un cod prin WhatsApp. Introdu codul mai jos pentru a finaliza crearea contului.
