Я использовал скрипт для PTC, и я изменил шаблон на другой, созданный с помощью начальной загрузки, в любом случае, эта форма входа не работает, она показывает форму, но не перенаправляет на какую-либо страницу или показывает ошибки, если пользователь или парольнеправильно.Извините за мой английский
Я новичок в PHP, HTML и т. Д. Я думаю, что проблема в SmartyClass
Это файл login.tpl:
{include file="header.tpl"}
<div class="site_title">{$lang.txt.loginacc}</div>
<body>
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Form Elements</h3>
</div>
<div class="title_right">
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="site_title">{$lang.txt.loginacc}</div>
<div class="site_content">
<div style="width:600px; margin:0 auto">
<div class="widget-title">{$lang.txt.loginacc}</div>
<form id="loginform" method="post" onsubmit="return submitform(this.id);">
<input type="hidden" name="token" value="{getToken('login')}" />
<input type="hidden" name="a" value="submit" />
<table width="100%" class="widget-tbl">
<tr>
<td align="right" width="200">{$lang.txt.username}:</td>
<td><input type="text" name="username" size="40" /></td>
</tr>
<tr>
<td align="right">{$lang.txt.password}:</td>
<td><input type="password" name="password" size="40" /></td>
</tr>
<tr>
{if $settings.captcha_login == 'yes'}
{if $settings.captcha_type == 1}
<tr>
<td></td>
<td>{$captcha_login}</td>
</tr>
<tr>
<td></td>
<td><input type="text" name="captcha" id="captcha_login" size="40" /></td>
</tr>
{else}
<tr>
<td colspan="2" align="center">{$captcha}
</td>
</tr>
{/if}
{/if}
<tr>
<td></td>
<td><input type="submit" name="login" value="{$lang.txt.login}" /></td>
</tr>
<tr>
<td colspan="2" align="center">
<a href="./?view=forgot">{$lang.txt.forgotpassword}</a>
{if $settings.register_activation == 'yes'}
• <a href="./?view=forgot&page=resend_activation">{$lang.txt.resendactivation}</a>
{/if}
</td>
</tr>
</table>
</form>
</div>
{literal}
<script type="text/javascript">
$(function(){
loginkeyboard();
});</script>
{/literal}
</div>
<!-- End Content -->
<h2>Form Design <small>different form elements</small></h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Settings 1</a>
</li>
<li><a href="#">Settings 2</a>
</li>
</ul>
</li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<div class="ln_solid"></div>
<div class="form-group">
{if $settings.captcha_login == 'yes'}
{if $settings.captcha_type == 1}
<tr>
<td></td>
<td>{$captcha_login}</td>
</tr>
<tr>
<td></td>
<td><input type="text" name="captcha" id="captcha_login" size="40" /></td>
</tr>
{else}
<tr>
<td colspan="2" align="center">{$captcha}
</td>
</tr>
{/if}
{/if}
<td colspan="2" align="center">
<a href="./?view=forgot">{$lang.txt.forgotpassword}</a>
{if $settings.register_activation == 'yes'}
• <a href="./?view=forgot&page=resend_activation">{$lang.txt.resendactivation}</a>
{/if}
</td>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="x_content">
</body>
и вот файл login.php
<?php
if (!defined("EvolutionScript")) {
exit("Hacking attempt...");
}
require SMARTYLOADER;
if ($settings['captcha_login'] == "yes") {
if ($settings['captcha_type'] == "1") {
$captcha_login_html .= "<div style=\"padding:5px 0px\"><a href=\"javascript:void(0);\" onclick=\"captchareload2();\"><img src=\"modules/captcha/captcha.php?r=login\" id=\"captchaimglogin\" border=\"0\" /></a></div>
";
$captcha_login_html .= "<script>function captchareload2(){
";
$captcha_login_html .= "$(\"#captchaimglogin\").attr('src','modules/captcha/captcha.php?r=login&x=34&y=75&z=119&?newtime=' + (new Date()).getTime());
";
$captcha_login_html .= "}</script>";
require_once "modules/captcha/getcaptcha_login.php";
}
else {
if ($settings['captcha_type'] == "2") {
require_once "modules/reCAPTCHA/recaptcha.php";
}
else {
if ($settings['captcha_type'] == "3") {
require_once "modules/solvemedia/solvemedia.php";
}
}
}
}
if ($input->p['a'] == "submit") {
verifyajax();
if (empty($input->p['username']) || empty($input->p['password'])) {
serveranswer(0, $lang['txt']['invalidlogindetails']);
}
if (verifyToken("login", $input->p['token']) !== true) {
serveranswer(0, $lang['txt']['invalidtoken']);
}
$captcha = strtoupper($input->pc['captcha']);
if ($settings['captcha_login'] == "yes") {
if ($settings['captcha_type'] == "1") {
$verify = validate_captcha_login($captcha, "");
}
else {
if ($settings['captcha_type'] == "2") {
$resp = validate_captcha($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
}
else {
if ($settings['captcha_type'] == "3") {
$resp = validate_captcha();
}
}
}
}
$username = $db->real_escape_string($input->pc['username']);
$password = $input->p['password'];
$country = ip2country($_SERVER['REMOTE_ADDR']);
$ip_user = $_SERVER['REMOTE_ADDR'];
$sect = explode(".", $ip_user);
$reip = $sect[0] . "." . $sect[1] . "." . $sect[2] . "." . $sect[3];
$reipa = $sect[0] . "." . $sect[1] . "." . $sect[2] . ".*";
$reipb = $sect[0] . "." . $sect[1] . ".*.*";
$reipc = $sect[0] . ".*.*.*";
$verifyusername = $db->fetchOne("SELECT COUNT(*) AS NUM FROM blacklist WHERE type='username' AND criteria='" . $username . "'");
$ipban1 = $db->fetchOne("SELECT COUNT(*) AS NUM FROM blacklist WHERE type='ip' AND criteria='" . $reip . "'");
$ipban2 = $db->fetchOne("SELECT COUNT(*) AS NUM FROM blacklist WHERE type='ip' AND criteria='" . $reipa . "'");
$ipban3 = $db->fetchOne("SELECT COUNT(*) AS NUM FROM blacklist WHERE type='ip' AND criteria='" . $reipb . "'");
$ipban4 = $db->fetchOne("SELECT COUNT(*) AS NUM FROM blacklist WHERE type='ip' AND criteria='" . $reipc . "'");
$countryban = $db->fetchOne("SELECT COUNT(*) AS NUM FROM blacklist WHERE type='country' AND criteria='" . $country . "'");
if ($verifyusername != 0) {
serveranswer(0, $lang['txt']['usernameblocked']);
}
else {
if ($ipban1 != 0 || $ipban2 != 0 || $ipban3 != 0 || $ipban4 != 0) {
serveranswer(0, $lang['txt']['ipblocked']);
}
else {
if ($countryban != 0) {
serveranswer(0, $lang['txt']['countryblocked']);
}
}
}
$verifyuser = $db->fetchOne("SELECT COUNT(*) AS NUM FROM members WHERE username='" . $username . "'");
if ($verifyuser == 0) {
serveranswer(0, $lang['txt']['invalidlogindetails']);
}
$user_info = $db->fetchRow("SELECT id, username, password, status, country FROM members WHERE username='" . $username . "'");
if ($user_info['password'] != md5($password)) {
$bid = array("user_id" => $user_info['id'], "ip" => $ip_user, "status" => "Failed", "password" => $password, "date" => TIMENOW, "agent" => (!empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : $_ENV['HTTP_USER_AGENT']));
$upd = $db->insert("login_history", $bid);
serveranswer(0, $lang['txt']['invalidlogindetails']);
}
if ($settings['multi_login'] == "yes") {
$checkip = $db->fetchOne("SELECT COUNT(*) AS NUM FROM members WHERE last_ip='" . $ip_user . "' AND id!=" . $user_info['id']);
if ($checkip != 0) {
$showip_error = "yes";
}
if ($showip_error == "yes") {
serveranswer(0, $lang['txt']['multipleaccountsdetected']);
}
}
if ($settings['multi_country'] == "yes") {
if ($country != $user_info['country'] && $country != "-") {
serveranswer(0, $lang['txt']['multiplecountrydetected']);
}
}
if ($user_info['status'] == "Un-verified") {
serveranswer(0, $lang['txt']['accountinactive']);
}
else {
if ($user_info['status'] == "Suspended") {
serveranswer(0, $lang['txt']['accountissuspended']);
}
}
$cookie_id = strtoupper(md5(TIMENOW . $ip_user . $_SERVER['HTTP_USER_AGENT']));
$set = array("last_ip" => $ip_user, "last_login" => TIMENOW, "status" => "Active", "cookie_id" => $cookie_id);
$upd = $db->update("members", $set, "id=" . $user_info['id']);
if (empty($user_info['computer_id'])) {
include "includes/encrypt.php";
$computerid = ascii2hex(substr(md5($user_info['username'] . $user_info['signup']), 0, 10));
$upd = $db->query("UPDATE members SET computer_id='" . $computerid . "' WHERE id=" . $user_info['id']);
}
$bid = array("user_id" => $user_info['id'], "ip" => $ip_user, "date" => TIMENOW, "agent" => (!empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : $_ENV['HTTP_USER_AGENT']));
$upd = $db->insert("login_history", $bid);
$_SESSION['user_id'] = $user_info['id'];
$_SESSION['password'] = $user_info['password'];
$_SESSION['cookie_id'] = $cookie_id;
setcookie("user_id", $user_info['id'], time() + 86400);
setcookie("password", $user_info['password'], time() + 86400);
setcookie("cookie_id", $cookie_id, time() + 86400);
if ($verifyforum != 0) {
$forum = $db->fetchOne("SELECT forum FROM forums WHERE status='Active' LIMIT 1");
$forum_action = "login";
include "modules/forums/functions/" . $forum . ".php";
}
serveranswer(1, "location.href='index.php?view=login&a=y';");
exit();
}
if ($input->g['a'] == "y") {
$smarty->assign("loginout_process", "login");
$smarty->display("loginoutprocess.tpl");
$db->close();
exit();
return 1;
}
if ($_SESSION['logged'] == "yes") {
header("location: index.php");
$db->close();
exit();
}
$smarty->assign("captcha_login", $captcha_login_html);
$smarty->assign("login_class", "current");
$smarty->display("login.tpl");
$db->close();
exit();
?>