Создаем файлик register.php PHP: <?php/*** STRESS WEB* @author S.T.R.E.S.S.* @copyright 2008 - 2011 STRESS WEB* @version 12* @web http://stressweb.ru*/if ( !defined("STRESSWEB") )die( "Access denied..." );if ( $l2cfg["reg"]["enable"] ) {$_do = ( isset($_REQUEST["do"]) && $_REQUEST["do"] == "activate" ) ? "activate":"reg";/*************************** Account Activation**************************/if ( $_do == "activate" and $l2cfg["reg"]["activate"] ) { $hash = ( isset($_REQUEST["hash"]) ) ? urldecode( $_REQUEST["hash"] ):""; if ( empty($hash) ) { $_do = 'reg'; } else { $hash = explode( '|', base64_decode($hash) ); if ( md5($hash[0].$hash[1].$hash[2].$hash[3].$l2cfg['salt']) != $hash[4] ) { $tpl->result['content'] = "<div class='error'>incorrect hash</div>"; } elseif ( $sid != $hash[3] ) { $tpl->result['content'] = "<div class='error'>incorrect server id</div>"; } else { $db->ldb( $lid ); if ( $ldb[$lid]->NumRows($ldb[$lid]->Query("SELECT login FROM accounts WHERE login='".$ldb[$lid]->Safe($hash[0])."' LIMIT 1")) ) { $tpl->result["content"] = "<div class='error'>Аккаунт уже существует</div>"; } else { $ldb[$lid]->SuperQuery( $qList[$vls]["insAccount"], array("login" => $hash[0], "pass" => $user->PassEncode($hash[1], $l2cfg["ls"][$lid]["encode"]), "l2email" => $hash[2]) ); if ( $ldb[$lid]->affectedrows() > 0 ) $tpl->result["content"] = "<div class='noerror'>{$lang["validate_err_1"]}</div>"; else $tpl->result["content"] = "<div class='error'>{$lang["err_db"]}</div>"; } } }}/*************************** Account Registration**************************/if ( $_do == "reg" ) { if ( isset($_POST["register"]) ) { if ( $l2cfg["captcha"]["reg"] ) { $_l2code_post = strtoupper( $_POST["l2sec_code"] ); $_l2code_sess = $_SESSION["seccode"]; } else { $_l2code_post = 1; $_l2code_sess = 1; } $_l2login = $db->Safe( htmlspecialchars(trim($_POST['l2prefix'].$_POST["l2account"])) ); $_l2pass1 = $db->Safe( $_POST["l2password1"] ); $_l2pass2 = $db->Safe( $_POST["l2password2"] ); $_l2email = $db->Safe( $_POST["l2email"] ); if ( empty($_l2login) or empty($_l2pass1) or empty($_l2pass2) or empty($_l2email) ) $user->errorMsg( $lang["error"], $lang["reg_err_1"] ); elseif ( !$_l2code_sess or $_l2code_post != $_l2code_sess ) $user->errorMsg( $lang["error"], $lang["err_code"] ); elseif ( $_l2pass1 != $_l2pass2 ) $user->errorMsg( $lang["error"], $lang["reg_err_2"] ); elseif ( strlen($_l2login) < 4 || strlen($_l2login) > 14 ) $user->errorMsg( $lang["error"], $lang["reg_err_3_1"] ); elseif ( strlen($_l2pass1) < 6 || strlen($_l2pass1) > 16 ) $user->errorMsg( $lang["error"], $lang["reg_err_3_2"] ); elseif ( preg_match("/[\||\'|\<|\>|\[|\]|\"|\!|\?|\$|\@|\/|\\\|\&\~\*\{\+]/", $_l2login) ) $user->errorMsg( $lang["error"], $lang["reg_err_4"] ); elseif ( !$user->CheckEmail($_l2email) ) $user->errorMsg( $lang["error"], $lang["err_mail"] ); else { $db->ldb( $lid ); if ( $ldb[$lid]->NumRows($ldb[$lid]->Query("SELECT * FROM accounts WHERE login='{$_l2login}' LIMIT 1")) ) $user->errorMsg( $lang["error"], $lang["reg_err_6"] ); elseif ( !$l2cfg["reg"]["multi"] and $ldb[$lid]->NumRows($ldb[$lid]->Query("SELECT * FROM accounts WHERE l2email='{$_l2email}' LIMIT 1")) ) $user->errorMsg( $lang["error"], $lang["reg_err_7"] ); else { $_login = strtolower( $_l2login ); $_pass = $user->PassEncode( $ldb[$lid]->Safe($_l2pass1), $l2cfg["ls"][$lid]["encode"]); if ( !$l2cfg["reg"]["activate"] ) { $ldb[$lid]->SuperQuery( $qList[$vls]["insAccount"], array("login" => $_login, "pass" => $_pass, "l2email" => $_l2email) ); if ( $ldb[$lid]->AffectedRows() == 1 ) $user->errorMsg( $lang["message"], $lang["reg_err_8"], "no" ); else $user->errorMsg( $lang["error"], $lang["err_db"] ); } else { $hash = urlencode( base64_encode($_login.'|'.$_l2pass1.'|'.$_l2email.'|'.$sid.'|'.md5($_login.$_l2pass1.$_l2email.$sid.$l2cfg['salt'])) ); $mail_subject = $lang["reg_err_11"]; $tpl->LoadTemplate( "email_register.tpl" ); $tpl->SetVar( '{login}', $_login ); $tpl->SetVar( '{password}', $_l2pass1 ); $tpl->SetVar( '{host}', HTTP_HOME_URL ); $tpl->SetVar( '{link}', HTTP_HOME_URL."index.php?f=register&do=activate&sid={$sid}&hash={$hash}" ); $tpl->SetVar( "{THEME}", TPL_DIR ); $tpl->build( "mail_message" ); $mail_message = $tpl->result["mail_message"]; $tpl->clear(); if ( $l2cfg["mail"]["method"] == "mail" ) { $mail = $user->SendMail( $_l2email, $_login, "{$l2cfg["reg"]["email"]}", $mail_subject, $mail_message ); if ( $mail ) $user->errorMsg( $lang["message"], $lang["reg_err_9"], "no" ); else $user->errorMsg( $lang["error"], $lang["reg_err_10"] ); } else { $mail = new PHPMailer( true ); $mail->IsSMTP(); try { $mail->CharSet = "{$l2cfg["mail"]["smtp"]["charset"]}"; $mail->SMTPAuth = $l2cfg["mail"]["smtp"]["auth"]; $mail->SMTPSecure = "{$l2cfg["mail"]["smtp"]["secure"]}"; $mail->Host = "{$l2cfg["mail"]["smtp"]["host"]}"; $mail->Port = $l2cfg["mail"]["smtp"]["port"]; $mail->Username = "{$l2cfg["mail"]["smtp"]["user"]}"; $mail->Password = "{$l2cfg["mail"]["smtp"]["pass"]}"; $mail->AddReplyTo( "{$l2cfg["mail"]["smtp"]["mail"]}", "{$l2cfg["mail"]["smtp"]["name"]}" ); $mail->AddAddress( "{$_l2email}", "{$_login}" ); $mail->SetFrom( "{$l2cfg["mail"]["smtp"]["mail"]}", "{$l2cfg["mail"]["smtp"]["name"]}" ); $mail->Subject = "{$mail_subject}"; $mail->MsgHTML( "{$mail_message}" ); $mail->Send(); $user->errorMsg( $lang["message"], $lang["reg_err_9"], "no" ); } catch ( phpmailerException$e ) { $user->errorMsg( $lang["error"], $e->errorMessage() ); } catch ( exception $e ) { $user->errorMsg( $lang["error"], $e->getMessage() ); } } } } } } function GenPref( $length ) { $letters = array( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'k', 'm', 'n', 'p', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ); for ( $i = 0; $i < $length; $i++ ) { $char = $letters[rand( 0, sizeof($letters) - 1 )]; $key[] = $char; } return implode( '', $key ); } $tpl->LoadTemplate( "register.tpl" ); if ( $l2cfg["captcha"]["reg"] ) { $tpl->template = '<script type="text/javascript">//<![CDATA[function reload () { var rndval = new Date().getTime(); document.getElementById(\'sw-captcha\').innerHTML = \'<a onclick="reload(); return false;" href="#"><img src="'.HTTP_HOME_URL.'module/antibot.php?rndval=\' + rndval + \'" border="0"></a>\';};//]]></script>'.$tpl->template; $tpl->SetBlock( "'\\[captcha\\](.*?)\\[/captcha\\]'si", "\\1" ); $tpl->SetVar( '{l2sec_code}', "<div id=\"sw-captcha\" class='captcha'><a onclick=\"reload(); return false;\" href=\"#\"><img src=\"".HTTP_HOME_URL."module/antibot.php\" alt=\"Код безопасности\" border=\"0\" /></a></div>" ); } else { $tpl->SetVar( '{l2sec_code}', "" ); $tpl->SetBlock( "'\\[captcha\\](.*?)\\[/captcha\\]'si", "" ); } if ( $l2cfg["ls"]["count"] > 1 ) { $l2servers = ""; for ( $i = 0; $i < $l2cfg["gs"]["count"]; $i++ ) { if ( $l2cfg["gs"][$i]["on"] ) { $l2servers .= "<option value='{$i}'>{$l2cfg["gs"][$i]["title"]}</option>"; } } $tpl->SetBlock( "'\\[servers\\](.*?)\\[/servers\\]'si", "\\1" ); $tpl->SetVar( "{servers}", $l2servers ); } else $tpl->SetBlock( "'\\[servers\\](.*?)\\[/servers\\]'si", "" ); $prefix_opt = ''; for ( $i = 0; $i < 5; $i++ ) { $prefix = GenPref( 2 ).rand( 1, 9 ); $prefix_opt .= "<option value='{$prefix}'>{$prefix}</option>"; } $tpl->SetVar( "{prefix}", $prefix_opt ); $tpl->SetVar( "{THEME}", TPL_DIR ); $tpl->build( "content" ); $tpl->clear();}} else$tpl->result["content"] = "<div class='error'>{$lang["reg_err_0"]}</div>";?> кидаем в папку module\ Идем в register.tpl Пишем: Код: <div id="color"> <div align='center'> <form name="form" method="post" action="" onsubmit="return checkform1(this)"> <table cellpadding="0" cellspacing="0" class="regForm"> <tr> <td colspan="2" align="center"><p>Регистрация аккаунта</p></td> </tr> [servers] <tr> <td class="tdLeft">Сервер:</td> <td class="tdRight"><select style="width: 100%;" name="sid">{servers}</select></td> </tr> [/servers] <tr> <td class="tdLeft">Префикс:<br><span class="description">(Будет добавлен в начало вашего логина)</span></td> <td class="tdRight"><select name="l2prefix" style="width: 100px;">{prefix}</select></td> </tr> <tr> <td class="tdLeft">Логин:<br><span class="description">(От 4 до 14 символов)</span></td> <td class="tdRight"><input type="text" name="l2account" maxlength="14" class="input"></td> </tr> <tr> <td class="tdLeft">Пароль:<br><span class="description">(От 6 до 16 символов)</span></td> <td class="tdRight"><input type="password" name="l2password1" maxlength="16" class="input"></td> </tr> <tr> <td class="tdLeft">Повторите пароль:</td> <td class="tdRight"><input type="password" name="l2password2" maxlength="16" class="input"></td> </tr> <tr> <td class="tdLeft">Email:<br><span class="description">(Введите действующий e-mail адрес)</span></td> <td class="tdRight"><input type="text" name="l2email" maxlength="64" class="input"></td> </tr> [captcha] <tr> <td class="tdLeft">{l2sec_code}</td> <td class="tdRight"><input type="text" name="l2sec_code" maxlength="10" class="input"></td> </tr> [/captcha] <tr> <td colspan="2" style="text-align: center;"><input type="submit" name="register" value="Регистрация" class="regbutton" /></td> </tr> </table> </div> </div> Модуль для восстановления: