Проверка E-Mail, при изменении его в профиле FIXED
Как Вы все знаете, проверка на валидность E-Mail в dle происходит, только при регистрации, но, что мешает пользователю сменить его после регистрации? Правильно, ничего. Поэтому предлагаю Вашему вниманию, хак который делает проверку E-Mail даже при редактировании его в профиле!
Установка хака валидности E-Mail:
Открываем engine/modules/profile.php
* Находим:
include_once ENGINE_DIR . '/classes/parse.class.php';
* Ниже вставляем:
if ( $doaction == 'validating' AND $is_logged )
{
$parse = new ParseFilter( );
$validating = ( isset( $_REQUEST['id'] ) ) ? strval( $_REQUEST['id'] ) : '';
$validating = explode( '||', @base64_decode( @rawurldecode( $validating ) ) );
if ( sizeof( $validating ) != 4 ) die( 'ID not valid!' );
$validating[0] = intval( $validating[0] );
$validating[1] = trim( $db->safesql( $parse->process( $validating[1] ) ) );
$validating[2] = trim( $db->safesql( $parse->process( $validating[2] ) ) );
if ( md5( md5( md5( $member_id['name'] . $validating[2] . DBHOST . DBNAME . $config['key'] ) ) ) != md5( $validating[3] ) ) die( 'ID not valid!' );
if ( $member_id['user_id'] == $validating[0] AND $validating[1] == $member_id['email'] )
{
$db->query( "UPDATE " . USERPREFIX . "_users set email='{$validating[2]}' WHERE user_id='{$member_id['user_id']}'" );
msgbox( $lang['all_info'], 'E-Mail Активирован!' );
} else die( 'data not valid!' );
}
{
$parse = new ParseFilter( );
$validating = ( isset( $_REQUEST['id'] ) ) ? strval( $_REQUEST['id'] ) : '';
$validating = explode( '||', @base64_decode( @rawurldecode( $validating ) ) );
if ( sizeof( $validating ) != 4 ) die( 'ID not valid!' );
$validating[0] = intval( $validating[0] );
$validating[1] = trim( $db->safesql( $parse->process( $validating[1] ) ) );
$validating[2] = trim( $db->safesql( $parse->process( $validating[2] ) ) );
if ( md5( md5( md5( $member_id['name'] . $validating[2] . DBHOST . DBNAME . $config['key'] ) ) ) != md5( $validating[3] ) ) die( 'ID not valid!' );
if ( $member_id['user_id'] == $validating[0] AND $validating[1] == $member_id['email'] )
{
$db->query( "UPDATE " . USERPREFIX . "_users set email='{$validating[2]}' WHERE user_id='{$member_id['user_id']}'" );
msgbox( $lang['all_info'], 'E-Mail Активирован!' );
} else die( 'data not valid!' );
}
* Находим:
$filecontents = '';
* Ниже вставляем:
if ( $email != $member_id['email'] AND $config['registration_type'] )
{
include_once ENGINE_DIR . '/classes/mail.class.php';
$mail = new dle_mail( $config );
$row = $db->super_query( "SELECT template FROM " . PREFIX . "_email where name='reg_mail' LIMIT 0,1" );
$row['template'] = stripslashes( $row['template'] );
$idlink = rawurlencode( base64_encode( $member_id['user_id'] . '||' . $member_id['email'] . '||' . $email . '||' . md5( md5( $member_id['name'] . $email . DBHOST . DBNAME . $config['key'] ) ) ) );
$row['template'] = str_replace( "{%username%}", $member_id['name'], $row['template'] );
$row['template'] = str_replace( "{%validationlink%}", $config['http_home_url'] . 'index.php?subaction=userinfo&user=' . urlencode( $member_id['name'] ) . '&doaction=validating&id=' . $idlink, $row['template'] );
$row['template'] = str_replace( "{%password%}", 'Засекречен', $row['template'] );
$mail->send( $email, $lang['reg_subj'], $row['template'] );
if ( $mail->send_error ) msgbox( $lang['all_info'], $mail->smtp_msg );
msgbox( $lang['all_info'], 'Что бы изменить E-Mail, его нужно подтвердить' );
$email = $member_id['email'];
}
{
include_once ENGINE_DIR . '/classes/mail.class.php';
$mail = new dle_mail( $config );
$row = $db->super_query( "SELECT template FROM " . PREFIX . "_email where name='reg_mail' LIMIT 0,1" );
$row['template'] = stripslashes( $row['template'] );
$idlink = rawurlencode( base64_encode( $member_id['user_id'] . '||' . $member_id['email'] . '||' . $email . '||' . md5( md5( $member_id['name'] . $email . DBHOST . DBNAME . $config['key'] ) ) ) );
$row['template'] = str_replace( "{%username%}", $member_id['name'], $row['template'] );
$row['template'] = str_replace( "{%validationlink%}", $config['http_home_url'] . 'index.php?subaction=userinfo&user=' . urlencode( $member_id['name'] ) . '&doaction=validating&id=' . $idlink, $row['template'] );
$row['template'] = str_replace( "{%password%}", 'Засекречен', $row['template'] );
$mail->send( $email, $lang['reg_subj'], $row['template'] );
if ( $mail->send_error ) msgbox( $lang['all_info'], $mail->smtp_msg );
msgbox( $lang['all_info'], 'Что бы изменить E-Mail, его нужно подтвердить' );
$email = $member_id['email'];
}