» » El. pašto patikrinimas registracijoje

El. pašto patikrinimas registracijoje

El. pašto patikrinimas registracijoje


Registruojant naują narį galimybė patikrinti ar nėra užregistruotas jau toks el. paštas.
1. Atidarome dizaino failą registration.tpl ir surandame:
<input type="text" name="email" class="f_input" />


Pakeičiame į:
<input type="text" name="email" id="email" class="f_input" /> <input class="bbcodes" style="height :22px; font-size: 11px;" title="Patikrinti ar laisvas" onclick="CheckEmail()"; return false;" type="button" value="Patikrinti" /><br /><div id='result-email'></div>


2. Atidarome failą engine/classes/js/dle_js.js ir surandame:
function CheckLogin(){var a=document.getElementById("name").value;ShowLoading("");$.post(dle_root+"engine/ajax/registration.php",{name:a},function(a){HideLoading("");$("#result-registration").html(a)});return!1}


Apačioje pridedame:
function CheckEmail(){var a=document.getElementById("email").value;ShowLoading("");$.post(dle_root+"engine/ajax/registration.php",{email:a},function(a){HideLoading("");$("#result-email").html(a)});return!1}


3. Atidarome engine/ajax/registration.php ir surandame:
function check_name($name) { global $lang, $db, $banned_info, $relates_word, $config; ... ...


Pridedame viršuje:
function check_email($email) { global $lang, $db, $banned_info, $config; $stop = ""; if( empty( $email ) OR strlen( $email ) > 50 OR @count(explode("@", $email)) != 2 OR !preg_match( "|([a-z0-9_\.\-]{1,20})@([a-z0-9\.\-]{1,20})\.([a-z]{2,4})|is", $email)) $stop .= $lang['reg_err_6']; if( count( $banned_info['email'] ) ) { foreach ( $banned_info['email'] as $banned ) { $banned['email'] = str_replace( '\*', '.*', preg_quote( $banned['email'], "#" ) ); if( $banned['email'] and preg_match( "#^{$banned['email']}$#i", $email ) ) { if( $banned['descr'] ) { $lang['reg_err_23'] = str_replace( "{descr}", $lang['reg_err_22'], $lang['reg_err_23'] ); $lang['reg_err_23'] = str_replace( "{descr}", $banned['descr'], $lang['reg_err_23'] ); } else { $lang['reg_err_23'] = str_replace( "{descr}", "", $lang['reg_err_23'] ); } $stop .= $lang['reg_err_23']; } } } if( $stop == "" ) { $row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE email='" . $email . "'" ); if( $row['count'] ) $stop .= "Toks el. paštas jau užregistruotas!"; } return (!$stop) ? false : $stop; }


Surandame:
$name = $db->safesql(trim(htmlspecialchars($parse->process(convert_unicode($_POST['name'], $config['charset'])), ENT_QUOTES, $config['charset']))); $name = preg_replace('#\s+#i', ' ', $name); $allow = check_name($name); if (!$allow) $buffer = "".$lang['reg_ok_ajax'].""; else $buffer = "".$allow."";


Pakeičiame:
if( isset($_POST['name']) ) { $name = $db->safesql(trim(htmlspecialchars($parse->process(convert_unicode($_POST['name'], $config['charset'])), ENT_QUOTES, $config['charset']))); $name = preg_replace('#\s+#i', ' ', $name); $allow = check_name($name); $buffer = (!$allow) ? "" . $lang['reg_ok_ajax'] . "" : "" . $allow . ""; } elseif( isset($_POST['email']) ) { $email = $db->safesql(trim($_POST['email'])); $allow = check_email($email); $buffer = (!$allow) ? "El. paštas neužregistruotas" : "" . $allow . ""; }

Tinka: 10.0,10.1,10.2,10.3
Vertimas: Lietuvių kalba

Komentarai

Informacija

Mielas lankytojau. Tu čia esi kaip neregistruotas vartotojas.
Mes siūlome tau užsiregistruoti arba tiesiog prisijungti naudojant savo prisijungimo duomenis, tam, kad galėtum įkelti bei komentuoti norimas naujienas.

Susirašinėjimai