Вход Регистрация
Файл: modules/signup/index.php
Строк: 80
<?php

if (is_auth())
{
    
redirect(HTTPHOME);
}

switch (
$act) {
    default:
        
$username = isset($_POST['username']) ? check($_POST['username']) : FALSE;
        
$password = isset($_POST['password']) ? check($_POST['password']) : FALSE;
        
$password2 = isset($_POST['password2']) ? check($_POST['password2']) : FALSE;
        
$email = isset($_POST['email']) ? check($_POST['email']) : FALSE;
        
$keystring = isset($_POST['keystring']) ? check($_POST['keystring']) : FALSE;
        
        if (
$keystring)
        {
            if (isset(
$_SESSION['captcha_keystring']) && $_SESSION['captcha_keystring'] === $keystring)
            {
                
$usernameStrlen mb_strlen($username'utf-8');
                if (
preg_match('|^[a-z0-9-]+$|i'$username) && $usernameStrlen && $usernameStrlen 16)
                {
                    
$passwordStrlen mb_strlen($password'utf-8');
                    if (
preg_match('|^[a-z0-9-]+$|i'$password) && $passwordStrlen && $passwordStrlen 21)
                    {
                        if (
$password === $password2)
                        {
                             if (
preg_match('/[0-9a-z_-]+@[0-9a-z_-^.]+.[a-z]{2,6}/i'$email))
                             {
                                 
$checkEmail DB::run()->querySingle("select count(`id`) from `users` where `email` = ? limit 1;", array($email));
                                if (!
$checkEmail)
                                {
                                     
$checkUsername DB::run()->querySingle("select count(`id`) from `users` where `username` = ? limit 1;", array($username));
                                    if (!
$checkUsername)
                                    {
                                        
DB::run()->query("insert into `users` set 
                                        `username` = ?, 
                                        `password` = ?, 
                                        `email` = ?, 
                                        `regtime` = ?,
                                        `lastseen` = ?,
                                        `verified` = ?,
                                        `theme` = ?,
                                        `ipp` = ?,
                                        `language` = ?;
                                        "
, array(
                                        
$username,
                                        
hash('sha512'md5(md5($password))),
                                        
$email,
                                        
TIME,
                                        
TIME,
                                        
1,
                                        
$config['theme'],
                                        
$config['ipp'],
                                        
$config['language']
                                        ));
                                        
                                        
$signedup 1;
                                        unset(
$_SESSION['captcha_keystring']);
                                    }
                                    else
                                    {
                                        
$_SESSION['note'] = $lang['Someone_already_has_that_username_Try_another'];
                                    }
                                }
                                else
                                {
                                    
$_SESSION['note'] = $lang['This_email_is_already_in_use_Try_recovery_process'];
                                }
                            }
                            else
                            {
                                
$_SESSION['note'] = $lang['The_email_is_incorrect'];
                            }
                        }
                        else
                        {
                            
$_SESSION['note'] = $lang['The_password_does_not_match_the_confirm_password'];
                        }
                    }
                    else
                    {
                        
$_SESSION['note'] = $lang['The_password_is_incorrect'];
                    }
                }
                else
                {
                    
$_SESSION['note'] = $lang['The_username_is_incorrect'];
                }
            }
            else
            {
                
$_SESSION['note'] = $lang['The_verification_code_is_incorrect'];
            }
        }
        
        
$config['newtitle'] = $lang['Sign_Up'];
        
$tpl['file'] = 'signup';
        require_once 
'core/header.php';
    break;
    
}
Онлайн: 1
Реклама