[момощь] скрипт для МВ, капча? E-mail
4 replies161 viewsCurrently viewing: 1
· 04/13/2009, 08:37 PM
В общем кто поможет сделать под этот скрипт капчу и что бы при смене паса нужно было вводить еще e-mail
Раскрывающийся текст
<center><h4>АККАУНТ</H4><hr>
| <a href="index.php?id=registred">Регистрация</a>
| <a href="index.php?id=changepassword">Сменить пароль</a>
| <a href="index.php?id=repass1">Востановить пароль</a>
| <a href=index.php?id=msg>Написать GMу</a>|<br><hr>
</center><ul> <ul>
<H4>Смена пароля</h4>
<br><BR><ul>
<LI> Аккаунт и пароль не могут быть пустыми.<BR>
<LI> Аккаунт и пароль не могут содержать менее 4 знаков
и больее 20 знаков.<BR>
<LI>Аккаунт и пароль пишутся латинскими буквами или цифрами.<BR>
<BR><BR>
</ul>
<script type="text/javascript">//<![CDATA[
function isAlphaNumeric(value)
{
if (value.match(/^[a-zA-Z0-9_]+$/))
return true;
return false;
}
function checkform(f)
{
if (f.account.value=="")
{
alert("Введите аккаунт");
return false;
}
if (!isAlphaNumeric(f.account.value))
{
alert("Аккаунт должен состоять из английских букв и/или цифр!");
return false;
}
if (f.oldpassword.value=="")
{
alert("Введите старый пароль");
return false;
}
if (f.newpassword.value=="")
{
alert("Введите новый пароль");
return false;
}
if (!isAlphaNumeric(f.newpassword.value))
{
alert("Пароль должен состоять из английских букв и/или цифр!");
return false;
}
if (f.newpassword2.value=="")
{
alert("Введите новый пароль повторно");
return false;
}
if (f.newpassword.value!=f.newpassword2.value)
{
alert("Пароль и повтор пароля не совпадают!");
return false;
}
return true;
}
//]]></script>
</head>
<body>
<form method="post" action="index.php?id=changepassword" onsubmit="return checkform(this)">
<table>
<?php
$input[]=Array("text" , "account" , 20);
$input[]=Array("password", "oldpassword" , 20);
$input[]=Array("password", "newpassword" , 20);
$input[]=Array("password", "newpassword2", 20);
for ($i=0; $i<count($input); $i++)
{
$Lang["accounts_account"]="Аккаунт";
$Lang["accounts_email"]="E-mail";
$Lang["accounts_password"]="Пароль";
$Lang["accounts_newpassword"]="Новый пароль";
$Lang["accounts_oldpassword"]="Старый пароль";
$Lang["accounts_newpassword2"]="Повторите новый пароль";
$Lang["accounts_accountnotalphanumeric"]="Аккаунт должен состоять из английских букв и/или цифр!";
$Lang["error_error"]='Ошибка: ';
$Lang["accounts_passwordnotalphanumeric"]="Пароль должен состоять из английских букв и/или цифр!";
$Lang["accounts_notemail"]="Это не e-mail!";
$Lang["accounts_registered"]="<b>Аккаунт успешно зарегистрирован !<br><br>Обязательно запомните эти данные.<br><br></b>";
$Lang["accounts_email_error"]="Ошибка при отправке e-mail'а";
$Lang["accounts_alreadyexist"]="Такой аккаунт уже существует";
$Lang["accounts_passwordchanged"]="<b>Пароль изменен !</b>";
$Lang["accounts_missingloginorpassword"]="Неправильные логин или пароль";
print '<tr>
<td>'.$Lang["accounts_".$input[$i][1]].'</td>
<td><input type="'.$input[$i][0].'" name="'.$input[$i][1].'" maxlength="'.$input[$i][2].'" value="'.@$_POST[$input[$i][1]].'" /></td>
</tr>
';
}
?>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="Сменить пароль" /></td>
</tr>
</table>
</form>
<?php
if ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['oldpassword'] && $_POST['newpassword'] && $_POST['newpassword']==$_POST['newpassword2'])
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
$result=mysql_query("SELECT count(*) FROM accounts WHERE login='".$_POST['account']."' AND password='".base64_encode(pack('H*', sha1(utf8_encode($_POST['oldpassword']))))."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_result($result,0,0) == 1)
{
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1(utf8_encode($_POST['newpassword']))))."' WHERE login='".$_POST['account']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
print "<p style=\"font-weight: bold;\">".$Lang["accounts_passwordchanged"]."</p>";
}
else
print "<p class=\"error\">".$Lang["accounts_missingloginorpassword"]."</p>";
}
?>
</body>
</html>
| <a href="index.php?id=registred">Регистрация</a>
| <a href="index.php?id=changepassword">Сменить пароль</a>
| <a href="index.php?id=repass1">Востановить пароль</a>
| <a href=index.php?id=msg>Написать GMу</a>|<br><hr>
</center><ul> <ul>
<H4>Смена пароля</h4>
<br><BR><ul>
<LI> Аккаунт и пароль не могут быть пустыми.<BR>
<LI> Аккаунт и пароль не могут содержать менее 4 знаков
и больее 20 знаков.<BR>
<LI>Аккаунт и пароль пишутся латинскими буквами или цифрами.<BR>
<BR><BR>
</ul>
<script type="text/javascript">//<![CDATA[
function isAlphaNumeric(value)
{
if (value.match(/^[a-zA-Z0-9_]+$/))
return true;
return false;
}
function checkform(f)
{
if (f.account.value=="")
{
alert("Введите аккаунт");
return false;
}
if (!isAlphaNumeric(f.account.value))
{
alert("Аккаунт должен состоять из английских букв и/или цифр!");
return false;
}
if (f.oldpassword.value=="")
{
alert("Введите старый пароль");
return false;
}
if (f.newpassword.value=="")
{
alert("Введите новый пароль");
return false;
}
if (!isAlphaNumeric(f.newpassword.value))
{
alert("Пароль должен состоять из английских букв и/или цифр!");
return false;
}
if (f.newpassword2.value=="")
{
alert("Введите новый пароль повторно");
return false;
}
if (f.newpassword.value!=f.newpassword2.value)
{
alert("Пароль и повтор пароля не совпадают!");
return false;
}
return true;
}
//]]></script>
</head>
<body>
<form method="post" action="index.php?id=changepassword" onsubmit="return checkform(this)">
<table>
<?php
$input[]=Array("text" , "account" , 20);
$input[]=Array("password", "oldpassword" , 20);
$input[]=Array("password", "newpassword" , 20);
$input[]=Array("password", "newpassword2", 20);
for ($i=0; $i<count($input); $i++)
{
$Lang["accounts_account"]="Аккаунт";
$Lang["accounts_email"]="E-mail";
$Lang["accounts_password"]="Пароль";
$Lang["accounts_newpassword"]="Новый пароль";
$Lang["accounts_oldpassword"]="Старый пароль";
$Lang["accounts_newpassword2"]="Повторите новый пароль";
$Lang["accounts_accountnotalphanumeric"]="Аккаунт должен состоять из английских букв и/или цифр!";
$Lang["error_error"]='Ошибка: ';
$Lang["accounts_passwordnotalphanumeric"]="Пароль должен состоять из английских букв и/или цифр!";
$Lang["accounts_notemail"]="Это не e-mail!";
$Lang["accounts_registered"]="<b>Аккаунт успешно зарегистрирован !<br><br>Обязательно запомните эти данные.<br><br></b>";
$Lang["accounts_email_error"]="Ошибка при отправке e-mail'а";
$Lang["accounts_alreadyexist"]="Такой аккаунт уже существует";
$Lang["accounts_passwordchanged"]="<b>Пароль изменен !</b>";
$Lang["accounts_missingloginorpassword"]="Неправильные логин или пароль";
print '<tr>
<td>'.$Lang["accounts_".$input[$i][1]].'</td>
<td><input type="'.$input[$i][0].'" name="'.$input[$i][1].'" maxlength="'.$input[$i][2].'" value="'.@$_POST[$input[$i][1]].'" /></td>
</tr>
';
}
?>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="Сменить пароль" /></td>
</tr>
</table>
</form>
<?php
if ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['oldpassword'] && $_POST['newpassword'] && $_POST['newpassword']==$_POST['newpassword2'])
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
$result=mysql_query("SELECT count(*) FROM accounts WHERE login='".$_POST['account']."' AND password='".base64_encode(pack('H*', sha1(utf8_encode($_POST['oldpassword']))))."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_result($result,0,0) == 1)
{
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1(utf8_encode($_POST['newpassword']))))."' WHERE login='".$_POST['account']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
print "<p style=\"font-weight: bold;\">".$Lang["accounts_passwordchanged"]."</p>";
}
else
print "<p class=\"error\">".$Lang["accounts_missingloginorpassword"]."</p>";
}
?>
</body>
</html>
И вот еще сюда впихнуть капчу это на восстановление ака
Раскрывающийся текст
<center><h4>АККАУНТ</H4><hr>
| <a href="index.php?id=registred">Регистрация</a>
| <a href="index.php?id=changepassword">Сменить пароль</a>
| <a href="index.php?id=repass1">Востановить пароль</a>
| <a href=index.php?id=msg>Написать GMу</a>|<br><hr>
</center><ul> <ul>
<H4>Востановление пароля</h4>
<br><BR><ul>
<script type="text/javascript">//<![CDATA[
function checkform1(f)
{
if (f.account.value=="")
{
alert("Введите аккаунт");
return false;
}
if (!f.account.value.match(/^[a-zA-Z0-9_]+$/))
{
alert("Аккаунт должен состоять из английских букв и/или цифр!");
return false;
}
if (f.email.value=="")
{
alert("Введите E-mail");
return false;
}
if (!f.email.value.match(/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/))
{
alert("Это не e-mail!");
return false;
}
return true;
}
function checkform2(f)
{
if (f.answer1.value=="")
{
alert("Введите Секретный ответ №1");
return false;
}
if (f.answer2.value=="")
{
alert("Введите Секретный ответ №2");
return false;
}
return true;
}
//]]></script>
</head>
<body>
<?php
$Lang["error_error"]='Ошибка: ';
$Lang["accounts_accountnotalphanumeric"]="Аккаунт должен состоять из английских букв и/или цифр!";
$Lang["accounts_notemail"]="Это не e-mail!";
$Lang["accounts_account"]="Аккаунт";
$Lang["accounts_email"]="E-mail";
$Lang["accounts_password"]="Пароль";
$Lang["accounts_password2"]="Повторите пароль";
$Lang["accounts_question1"]="Секретный вопрос №1";
$Lang["accounts_question2"]="Секретный вопрос №2";
$Lang["accounts_answer1"]="Секретный ответ №1";
$Lang["accounts_answer2"]="Секретный ответ №2";
$Lang["accounts_resetbutton"]="Сбросить пароль";
$Lang["accounts_missingloginoremail"]="Неправильные логин или e-mail";
$Lang["accounts_passwordresetted"]="Пароль сброшен";
$Lang["accounts_email_subject_resetted"]="Lineage II: Ваш пароль сброшен";
$Lang["accounts_email_from"]="Server Support"; // something like "Server Support <[email protected]>"
$Lang["accounts_email_ok"]="E-mail с новым паролем отправлен";
$Lang["accounts_email_error"]="Ошибка при отправке e-mail'а";
$Lang["accounts_newpassword"]="Новый пароль";
$Lang["accounts_wronganswers"]="Неверные Секретные ответы";
$Lang["accounts_nextbutton"]="Далее >>>";
if ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['email'] && strlen($_POST['email'])<=20)
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
if (!eregi("^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+", $_POST['email']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_notemail"] . "</p>");
$result=mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."' AND email='".$_POST['email']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_num_rows($result)==1)
{
$row=mysql_fetch_array($result);
print '<form method="post" action="index.php?id=repass2" onsubmit="return checkform2(this)">
<table>
<tr>
<td>'.$Lang["accounts_account"].'</td>
<td>'.$row['login'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_email"].'</td>
<td>'.$row['email'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_question1"].'</td>
<td>'.$row['question1'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_answer1"].'</td>
<td><input type="text" name="answer1" maxlength="40" /></td>
</tr>
<tr>
<td>'.$Lang["accounts_question2"].'</td>
<td>'.$row['question2'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_answer2"].'</td>
<td><input type="text" name="answer2" maxlength="40" /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="'.$Lang["accounts_resetbutton"].'" /></td>
</tr>
</table>
<input type="hidden" name="account" maxlength="20" value="'.$_POST['account'].'" />
</form>
';
}
else
print "<p class=\"error\">".$Lang["accounts_missingloginoremail"]."</p>";
}
elseif ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['answer1'] && strlen($_POST['answer1'])<=40 && $_POST['answer2'] && strlen($_POST['answer2'])<=40)
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $L2JBS_lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
$banwords=Array("'", "\"", ",", ";", "--", "#");
$_POST['answer1']=str_replace($banwords, '', $_POST['answer1']);
$_POST['answer2']=str_replace($banwords, '', $_POST['answer2']);
$result=mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."' AND answer1='".$_POST['answer1']."' AND answer2='".$_POST['answer2']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_num_rows($result)==1)
{
$row=mysql_fetch_array($result);
$newpass=substr(preg_replace("/[0-9]/", "", md5(time())), 0, 6);
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1(utf8_encode($newpass))))."' WHERE login='".$row['login']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
print "<p style=\"font-weight: bold;\">".$Lang["accounts_passwordresetted"]."</p>\n";
$ok=1;
if ($L2JBS_config["mail_enable"] && $ok=mail($row['email'], $Lang["accounts_email_subject_resetted"], $L2JBS_lang["accounts_newpassword"].": ".$newpass, "From: ".$Lang["accounts_email_from"]))
print "<p>".$Lang["accounts_email_ok"]."</p>";
else
{
if (!$ok)
print '<p class="error">'.$Lang["accounts_email_error"].'</p>';
print "<p>".$Lang["accounts_newpassword"].": ".$newpass."</p>";
}
}
else
print "<p class=\"error\">".$Lang["accounts_wronganswers"]."</p>";
}
else
{
print '<form method="post" action="index.php?id=repass1" onsubmit="return checkform1(this)">
<table>
<tr>
<td>'.$Lang["accounts_account"].'</td>
<td><input type="text" name="account" maxlength="20" /></td>
</tr>
<tr>
<td>'.$Lang["accounts_email"].'</td>
<td><input type="text" name="email" maxlength="20" /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="'.$Lang["accounts_nextbutton"].'" /></td>
</tr>
</table>
</form>
';
}
?>
</body>
</html>
| <a href="index.php?id=registred">Регистрация</a>
| <a href="index.php?id=changepassword">Сменить пароль</a>
| <a href="index.php?id=repass1">Востановить пароль</a>
| <a href=index.php?id=msg>Написать GMу</a>|<br><hr>
</center><ul> <ul>
<H4>Востановление пароля</h4>
<br><BR><ul>
<script type="text/javascript">//<![CDATA[
function checkform1(f)
{
if (f.account.value=="")
{
alert("Введите аккаунт");
return false;
}
if (!f.account.value.match(/^[a-zA-Z0-9_]+$/))
{
alert("Аккаунт должен состоять из английских букв и/или цифр!");
return false;
}
if (f.email.value=="")
{
alert("Введите E-mail");
return false;
}
if (!f.email.value.match(/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/))
{
alert("Это не e-mail!");
return false;
}
return true;
}
function checkform2(f)
{
if (f.answer1.value=="")
{
alert("Введите Секретный ответ №1");
return false;
}
if (f.answer2.value=="")
{
alert("Введите Секретный ответ №2");
return false;
}
return true;
}
//]]></script>
</head>
<body>
<?php
$Lang["error_error"]='Ошибка: ';
$Lang["accounts_accountnotalphanumeric"]="Аккаунт должен состоять из английских букв и/или цифр!";
$Lang["accounts_notemail"]="Это не e-mail!";
$Lang["accounts_account"]="Аккаунт";
$Lang["accounts_email"]="E-mail";
$Lang["accounts_password"]="Пароль";
$Lang["accounts_password2"]="Повторите пароль";
$Lang["accounts_question1"]="Секретный вопрос №1";
$Lang["accounts_question2"]="Секретный вопрос №2";
$Lang["accounts_answer1"]="Секретный ответ №1";
$Lang["accounts_answer2"]="Секретный ответ №2";
$Lang["accounts_resetbutton"]="Сбросить пароль";
$Lang["accounts_missingloginoremail"]="Неправильные логин или e-mail";
$Lang["accounts_passwordresetted"]="Пароль сброшен";
$Lang["accounts_email_subject_resetted"]="Lineage II: Ваш пароль сброшен";
$Lang["accounts_email_from"]="Server Support"; // something like "Server Support <[email protected]>"
$Lang["accounts_email_ok"]="E-mail с новым паролем отправлен";
$Lang["accounts_email_error"]="Ошибка при отправке e-mail'а";
$Lang["accounts_newpassword"]="Новый пароль";
$Lang["accounts_wronganswers"]="Неверные Секретные ответы";
$Lang["accounts_nextbutton"]="Далее >>>";
if ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['email'] && strlen($_POST['email'])<=20)
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
if (!eregi("^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+", $_POST['email']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_notemail"] . "</p>");
$result=mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."' AND email='".$_POST['email']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_num_rows($result)==1)
{
$row=mysql_fetch_array($result);
print '<form method="post" action="index.php?id=repass2" onsubmit="return checkform2(this)">
<table>
<tr>
<td>'.$Lang["accounts_account"].'</td>
<td>'.$row['login'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_email"].'</td>
<td>'.$row['email'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_question1"].'</td>
<td>'.$row['question1'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_answer1"].'</td>
<td><input type="text" name="answer1" maxlength="40" /></td>
</tr>
<tr>
<td>'.$Lang["accounts_question2"].'</td>
<td>'.$row['question2'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_answer2"].'</td>
<td><input type="text" name="answer2" maxlength="40" /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="'.$Lang["accounts_resetbutton"].'" /></td>
</tr>
</table>
<input type="hidden" name="account" maxlength="20" value="'.$_POST['account'].'" />
</form>
';
}
else
print "<p class=\"error\">".$Lang["accounts_missingloginoremail"]."</p>";
}
elseif ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['answer1'] && strlen($_POST['answer1'])<=40 && $_POST['answer2'] && strlen($_POST['answer2'])<=40)
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $L2JBS_lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
$banwords=Array("'", "\"", ",", ";", "--", "#");
$_POST['answer1']=str_replace($banwords, '', $_POST['answer1']);
$_POST['answer2']=str_replace($banwords, '', $_POST['answer2']);
$result=mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."' AND answer1='".$_POST['answer1']."' AND answer2='".$_POST['answer2']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_num_rows($result)==1)
{
$row=mysql_fetch_array($result);
$newpass=substr(preg_replace("/[0-9]/", "", md5(time())), 0, 6);
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1(utf8_encode($newpass))))."' WHERE login='".$row['login']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
print "<p style=\"font-weight: bold;\">".$Lang["accounts_passwordresetted"]."</p>\n";
$ok=1;
if ($L2JBS_config["mail_enable"] && $ok=mail($row['email'], $Lang["accounts_email_subject_resetted"], $L2JBS_lang["accounts_newpassword"].": ".$newpass, "From: ".$Lang["accounts_email_from"]))
print "<p>".$Lang["accounts_email_ok"]."</p>";
else
{
if (!$ok)
print '<p class="error">'.$Lang["accounts_email_error"].'</p>';
print "<p>".$Lang["accounts_newpassword"].": ".$newpass."</p>";
}
}
else
print "<p class=\"error\">".$Lang["accounts_wronganswers"]."</p>";
}
else
{
print '<form method="post" action="index.php?id=repass1" onsubmit="return checkform1(this)">
<table>
<tr>
<td>'.$Lang["accounts_account"].'</td>
<td><input type="text" name="account" maxlength="20" /></td>
</tr>
<tr>
<td>'.$Lang["accounts_email"].'</td>
<td><input type="text" name="email" maxlength="20" /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="'.$Lang["accounts_nextbutton"].'" /></td>
</tr>
</table>
</form>
';
}
?>
</body>
</html>
— 10
0
· 04/13/2009, 08:43 PM
zlob: В общем кто поможет сделать под этот скрипт капчу и что бы при смене паса нужно было вводить еще e-mail
И вот еще сюда впихнуть капчу это на восстановление ака
Обращайся завтра с утра в Асю - помогу.
На Форуме я тоже Radar!
Я везде Radar!
0
· 04/14/2009, 07:26 AM
Вот держи готовое:
1. Смена пароля (добавлен e-mail и вставлена kcaptcha)
Код
<?php session_start();?>
<center><h4>АККАУНТ</H4><hr>
| <a href="index.php?id=registred">Регистрация</a>
| <a href="index.php?id=changepassword">Сменить пароль</a>
| <a href="index.php?id=repass1">Востановить пароль</a>
| <a href=index.php?id=msg>Написать GMу</a>|<br><hr>
</center><ul> <ul>
<H4>Смена пароля</h4>
<br><BR><ul>
<LI> Аккаунт и пароль не могут быть пустыми.<BR>
<LI> Аккаунт и пароль не могут содержать менее 4 знаков
и больее 20 знаков.<BR>
<LI>Аккаунт и пароль пишутся латинскими буквами или цифрами.<BR>
<BR><BR>
</ul>
<script type="text/javascript">//<![CDATA[
function isAlphaNumeric(value)
{
if (value.match(/^[a-zA-Z0-9_]+$/))
return true;
return false;
}
function checkform(f)
{
if (f.account.value=="")
{
alert("Введите аккаунт");
return false;
}
if (!isAlphaNumeric(f.account.value))
{
alert("Аккаунт должен состоять из английских букв и/или цифр!");
return false;
}
if (f.email.value=="")
{
alert("Введите Ваш E-mail");
return false;
}
if (f.oldpassword.value=="")
{
alert("Введите старый пароль");
return false;
}
if (f.newpassword.value=="")
{
alert("Введите новый пароль");
return false;
}
if (!isAlphaNumeric(f.newpassword.value))
{
alert("Пароль должен состоять из английских букв и/или цифр!");
return false;
}
if (f.newpassword2.value=="")
{
alert("Введите новый пароль повторно");
return false;
}
if (f.newpassword.value!=f.newpassword2.value)
{
alert("Пароль и повтор пароля не совпадают!");
return false;
}
return true;
}
//]]></script>
</head>
<body>
<form method="post" action="index.php?id=changepassword" onsubmit="return checkform(this)">
<table>
<?php
$input[]=Array("text" , "account" , 20);
$input[]=Array("email", "email" , 40);
$input[]=Array("password", "oldpassword" , 20);
$input[]=Array("password", "newpassword" , 20);
$input[]=Array("password", "newpassword2", 20);
for ($i=0; $i<count($input); $i++)
{
$Lang["accounts_account"]="Аккаунт";
$Lang["accounts_email"]="E-mail";
$Lang["accounts_password"]="Пароль";
$Lang["accounts_newpassword"]="Новый пароль";
$Lang["accounts_oldpassword"]="Старый пароль";
$Lang["accounts_newpassword2"]="Повторите новый пароль";
$Lang["accounts_antibot"]="Антибот";
$Lang["accounts_accountnotalphanumeric"]="Аккаунт должен состоять из английских букв и/или цифр!";
$Lang["error_error"]='Ошибка: ';
$Lang["accounts_passwordnotalphanumeric"]="Пароль должен состоять из английских букв и/или цифр!";
$Lang["accounts_notemail"]="Это не e-mail!";
$Lang["accounts_registered"]="<b>Аккаунт успешно зарегистрирован !<br><br>Обязательно запомните эти данные.<br><br></b>";
$Lang["accounts_email_error"]="Ошибка при отправке e-mail'а";
$Lang["accounts_alreadyexist"]="Такой аккаунт уже существует";
$Lang["accounts_passwordchanged"]="<b>Пароль изменен !</b>";
$Lang["accounts_missingloginorpassword"]="Неправильные логин или пароль";
print '<tr>
<td>'.$Lang["accounts_".$input[$i][1]].'</td>
<td><input type="'.$input[$i][0].'" name="'.$input[$i][1].'" maxlength="'.$input[$i][2].'" value="'.@$_POST[$input[$i][1]].'" /></td>
</tr>
';
}
print '
<tr>
<td>'.$Lang["accounts_antibot"].'</td>
<td>
<p> <img src="kcaptcha/index.php?<?php echo session_name()?>=<?php echo session_id()?>">
<br> <input type="text" name="keystring"></p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="Сменить пароль" /></td>
</tr>
</table>
</form>
';
if ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['email'] && $_POST['oldpassword'] && $_POST['newpassword'] && $_POST['newpassword']==$_POST['newpassword2'])
{
if(isset($_SESSION['captcha_keystring'])&&
$_SESSION['captcha_keystring']==$_POST['keystring'])
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
$result=mysql_query("SELECT count(*) FROM accounts WHERE login='".$_POST['account']."' AND email='".$_POST['email']."' AND password='".base64_encode(pack('H*', sha1(utf8_encode($_POST['oldpassword']))))."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_result($result,0,0) == 1)
{
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1(utf8_encode($_POST['newpassword']))))."' WHERE login='".$_POST['account']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
print "<p style=\"font-weight: bold;\">".$Lang["accounts_passwordchanged"]."</p>";
}else
print "<p class=\"error\">".$Lang["accounts_missingloginorpassword"]."</p>";
}else{
echo ("<font color='red'>Вы ввели не верный код с картинки</font><br>");
}
unset($_SESSION['captcha_keystring']);
}
?>
<center><h4>АККАУНТ</H4><hr>
| <a href="index.php?id=registred">Регистрация</a>
| <a href="index.php?id=changepassword">Сменить пароль</a>
| <a href="index.php?id=repass1">Востановить пароль</a>
| <a href=index.php?id=msg>Написать GMу</a>|<br><hr>
</center><ul> <ul>
<H4>Смена пароля</h4>
<br><BR><ul>
<LI> Аккаунт и пароль не могут быть пустыми.<BR>
<LI> Аккаунт и пароль не могут содержать менее 4 знаков
и больее 20 знаков.<BR>
<LI>Аккаунт и пароль пишутся латинскими буквами или цифрами.<BR>
<BR><BR>
</ul>
<script type="text/javascript">//<![CDATA[
function isAlphaNumeric(value)
{
if (value.match(/^[a-zA-Z0-9_]+$/))
return true;
return false;
}
function checkform(f)
{
if (f.account.value=="")
{
alert("Введите аккаунт");
return false;
}
if (!isAlphaNumeric(f.account.value))
{
alert("Аккаунт должен состоять из английских букв и/или цифр!");
return false;
}
if (f.email.value=="")
{
alert("Введите Ваш E-mail");
return false;
}
if (f.oldpassword.value=="")
{
alert("Введите старый пароль");
return false;
}
if (f.newpassword.value=="")
{
alert("Введите новый пароль");
return false;
}
if (!isAlphaNumeric(f.newpassword.value))
{
alert("Пароль должен состоять из английских букв и/или цифр!");
return false;
}
if (f.newpassword2.value=="")
{
alert("Введите новый пароль повторно");
return false;
}
if (f.newpassword.value!=f.newpassword2.value)
{
alert("Пароль и повтор пароля не совпадают!");
return false;
}
return true;
}
//]]></script>
</head>
<body>
<form method="post" action="index.php?id=changepassword" onsubmit="return checkform(this)">
<table>
<?php
$input[]=Array("text" , "account" , 20);
$input[]=Array("email", "email" , 40);
$input[]=Array("password", "oldpassword" , 20);
$input[]=Array("password", "newpassword" , 20);
$input[]=Array("password", "newpassword2", 20);
for ($i=0; $i<count($input); $i++)
{
$Lang["accounts_account"]="Аккаунт";
$Lang["accounts_email"]="E-mail";
$Lang["accounts_password"]="Пароль";
$Lang["accounts_newpassword"]="Новый пароль";
$Lang["accounts_oldpassword"]="Старый пароль";
$Lang["accounts_newpassword2"]="Повторите новый пароль";
$Lang["accounts_antibot"]="Антибот";
$Lang["accounts_accountnotalphanumeric"]="Аккаунт должен состоять из английских букв и/или цифр!";
$Lang["error_error"]='Ошибка: ';
$Lang["accounts_passwordnotalphanumeric"]="Пароль должен состоять из английских букв и/или цифр!";
$Lang["accounts_notemail"]="Это не e-mail!";
$Lang["accounts_registered"]="<b>Аккаунт успешно зарегистрирован !<br><br>Обязательно запомните эти данные.<br><br></b>";
$Lang["accounts_email_error"]="Ошибка при отправке e-mail'а";
$Lang["accounts_alreadyexist"]="Такой аккаунт уже существует";
$Lang["accounts_passwordchanged"]="<b>Пароль изменен !</b>";
$Lang["accounts_missingloginorpassword"]="Неправильные логин или пароль";
print '<tr>
<td>'.$Lang["accounts_".$input[$i][1]].'</td>
<td><input type="'.$input[$i][0].'" name="'.$input[$i][1].'" maxlength="'.$input[$i][2].'" value="'.@$_POST[$input[$i][1]].'" /></td>
</tr>
';
}
print '
<tr>
<td>'.$Lang["accounts_antibot"].'</td>
<td>
<p> <img src="kcaptcha/index.php?<?php echo session_name()?>=<?php echo session_id()?>">
<br> <input type="text" name="keystring"></p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="Сменить пароль" /></td>
</tr>
</table>
</form>
';
if ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['email'] && $_POST['oldpassword'] && $_POST['newpassword'] && $_POST['newpassword']==$_POST['newpassword2'])
{
if(isset($_SESSION['captcha_keystring'])&&
$_SESSION['captcha_keystring']==$_POST['keystring'])
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
$result=mysql_query("SELECT count(*) FROM accounts WHERE login='".$_POST['account']."' AND email='".$_POST['email']."' AND password='".base64_encode(pack('H*', sha1(utf8_encode($_POST['oldpassword']))))."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_result($result,0,0) == 1)
{
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1(utf8_encode($_POST['newpassword']))))."' WHERE login='".$_POST['account']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
print "<p style=\"font-weight: bold;\">".$Lang["accounts_passwordchanged"]."</p>";
}else
print "<p class=\"error\">".$Lang["accounts_missingloginorpassword"]."</p>";
}else{
echo ("<font color='red'>Вы ввели не верный код с картинки</font><br>");
}
unset($_SESSION['captcha_keystring']);
}
?>
2. Восстановление пароля (вставлена kcaptcha)
Код
<?php session_start();?>
<center><h4>АККАУНТ</H4><hr>
| <a href="index.php?id=registred">Регистрация</a>
| <a href="index.php?id=changepassword">Сменить пароль</a>
| <a href="index.php?id=repass1">Востановить пароль</a>
| <a href=index.php?id=msg>Написать GMу</a>|<br><hr>
</center><ul> <ul>
<H4>Востановление пароля</h4>
<br><BR><ul>
<script type="text/javascript">//<![CDATA[
function checkform1(f)
{
if (f.account.value=="")
{
alert("Введите аккаунт");
return false;
}
if (!f.account.value.match(/^[a-zA-Z0-9_]+$/))
{
alert("Аккаунт должен состоять из английских букв и/или цифр!");
return false;
}
if (f.email.value=="")
{
alert("Введите E-mail");
return false;
}
if (!f.email.value.match(/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/))
{
alert("Это не e-mail!");
return false;
}
return true;
}
function checkform2(f)
{
if (f.answer1.value=="")
{
alert("Введите Секретный ответ №1");
return false;
}
if (f.answer2.value=="")
{
alert("Введите Секретный ответ №2");
return false;
}
return true;
}
//]]></script>
</head>
<body>
<?php
$Lang["error_error"]='Ошибка: ';
$Lang["accounts_accountnotalphanumeric"]="Аккаунт должен состоять из английских букв и/или цифр!";
$Lang["accounts_notemail"]="Это не e-mail!";
$Lang["accounts_account"]="Аккаунт";
$Lang["accounts_email"]="E-mail";
$Lang["accounts_password"]="Пароль";
$Lang["accounts_password2"]="Повторите пароль";
$Lang["accounts_question1"]="Секретный вопрос №1";
$Lang["accounts_question2"]="Секретный вопрос №2";
$Lang["accounts_answer1"]="Секретный ответ №1";
$Lang["accounts_answer2"]="Секретный ответ №2";
$Lang["accounts_antibot"]="Антибот";
$Lang["accounts_resetbutton"]="Сбросить пароль";
$Lang["accounts_missingloginoremail"]="Неправильные логин или e-mail";
$Lang["accounts_passwordresetted"]="Пароль сброшен";
$Lang["accounts_email_subject_resetted"]="Lineage II: Ваш пароль сброшен";
$Lang["accounts_email_from"]="Server Support"; // something like "Server Support <[email protected]>"
$Lang["accounts_email_ok"]="E-mail с новым паролем отправлен";
$Lang["accounts_email_error"]="Ошибка при отправке e-mail'а";
$Lang["accounts_newpassword"]="Новый пароль";
$Lang["accounts_wronganswers"]="Неверные Секретные ответы";
$Lang["accounts_nextbutton"]="Далее >>>";
if ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['email'] && strlen($_POST['email'])<=20)
{
if(isset($_SESSION['captcha_keystring'])&&
$_SESSION['captcha_keystring']==$_POST['keystring'])
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
if (!eregi("^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+", $_POST['email']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_notemail"] . "</p>");
$result=mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."' AND email='".$_POST['email']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_num_rows($result)==1)
{
$row=mysql_fetch_array($result);
print '<form method="post" action="index.php?id=repass2" onsubmit="return checkform2(this)">
<table>
<tr>
<td>'.$Lang["accounts_account"].'</td>
<td>'.$row['login'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_email"].'</td>
<td>'.$row['email'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_question1"].'</td>
<td>'.$row['question1'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_answer1"].'</td>
<td><input type="text" name="answer1" maxlength="40" /></td>
</tr>
<tr>
<td>'.$Lang["accounts_question2"].'</td>
<td>'.$row['question2'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_answer2"].'</td>
<td><input type="text" name="answer2" maxlength="40" /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="'.$Lang["accounts_resetbutton"].'" /></td>
</tr>
</table>
<input type="hidden" name="account" maxlength="20" value="'.$_POST['account'].'" />
</form>
';
}
else
print "<p class=\"error\">".$Lang["accounts_missingloginoremail"]."</p>";
}else{
echo ("<font color='red'>Вы ввели не верный код с картинки</font><br>");
}
unset($_SESSION['captcha_keystring']);
}
elseif ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['answer1'] && strlen($_POST['answer1'])<=40 && $_POST['answer2'] && strlen($_POST['answer2'])<=40)
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $L2JBS_lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
$banwords=Array("'", "\"", ",", ";", "--", "#");
$_POST['answer1']=str_replace($banwords, '', $_POST['answer1']);
$_POST['answer2']=str_replace($banwords, '', $_POST['answer2']);
$result=mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."' AND answer1='".$_POST['answer1']."' AND answer2='".$_POST['answer2']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_num_rows($result)==1)
{
$row=mysql_fetch_array($result);
$newpass=substr(preg_replace("/[0-9]/", "", md5(time())), 0, 6);
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1(utf8_encode($newpass))))."' WHERE login='".$row['login']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
print "<p style=\"font-weight: bold;\">".$Lang["accounts_passwordresetted"]."</p>\n";
$ok=1;
if ($L2JBS_config["mail_enable"] && $ok=mail($row['email'], $Lang["accounts_email_subject_resetted"], $L2JBS_lang["accounts_newpassword"].": ".$newpass, "From: ".$Lang["accounts_email_from"]))
print "<p>".$Lang["accounts_email_ok"]."</p>";
else
{
if (!$ok)
print '<p class="error">'.$Lang["accounts_email_error"].'</p>';
print "<p>".$Lang["accounts_newpassword"].": ".$newpass."</p>";
}
}
else
print "<p class=\"error\">".$Lang["accounts_wronganswers"]."</p>";
}
else
{
print '<form method="post" action="index.php?id=repass1" onsubmit="return checkform1(this)">
<table>
<tr>
<td>'.$Lang["accounts_account"].'</td>
<td><input type="text" name="account" maxlength="20" /></td>
</tr>
<tr>
<td>'.$Lang["accounts_email"].'</td>
<td><input type="text" name="email" maxlength="20" /></td>
</tr>
<tr>
<td align="right">'.$Lang["accounts_antibot"].'</td>
<td align="left">
<p> <img src="kcaptcha/index.php?<?php echo session_name()?>=<?php echo session_id()?>">
<br> <input type="text" name="keystring"></p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="'.$Lang["accounts_nextbutton"].'" /></td>
</tr>
</table>
</form>
';
}
?>
<center><h4>АККАУНТ</H4><hr>
| <a href="index.php?id=registred">Регистрация</a>
| <a href="index.php?id=changepassword">Сменить пароль</a>
| <a href="index.php?id=repass1">Востановить пароль</a>
| <a href=index.php?id=msg>Написать GMу</a>|<br><hr>
</center><ul> <ul>
<H4>Востановление пароля</h4>
<br><BR><ul>
<script type="text/javascript">//<![CDATA[
function checkform1(f)
{
if (f.account.value=="")
{
alert("Введите аккаунт");
return false;
}
if (!f.account.value.match(/^[a-zA-Z0-9_]+$/))
{
alert("Аккаунт должен состоять из английских букв и/или цифр!");
return false;
}
if (f.email.value=="")
{
alert("Введите E-mail");
return false;
}
if (!f.email.value.match(/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/))
{
alert("Это не e-mail!");
return false;
}
return true;
}
function checkform2(f)
{
if (f.answer1.value=="")
{
alert("Введите Секретный ответ №1");
return false;
}
if (f.answer2.value=="")
{
alert("Введите Секретный ответ №2");
return false;
}
return true;
}
//]]></script>
</head>
<body>
<?php
$Lang["error_error"]='Ошибка: ';
$Lang["accounts_accountnotalphanumeric"]="Аккаунт должен состоять из английских букв и/или цифр!";
$Lang["accounts_notemail"]="Это не e-mail!";
$Lang["accounts_account"]="Аккаунт";
$Lang["accounts_email"]="E-mail";
$Lang["accounts_password"]="Пароль";
$Lang["accounts_password2"]="Повторите пароль";
$Lang["accounts_question1"]="Секретный вопрос №1";
$Lang["accounts_question2"]="Секретный вопрос №2";
$Lang["accounts_answer1"]="Секретный ответ №1";
$Lang["accounts_answer2"]="Секретный ответ №2";
$Lang["accounts_antibot"]="Антибот";
$Lang["accounts_resetbutton"]="Сбросить пароль";
$Lang["accounts_missingloginoremail"]="Неправильные логин или e-mail";
$Lang["accounts_passwordresetted"]="Пароль сброшен";
$Lang["accounts_email_subject_resetted"]="Lineage II: Ваш пароль сброшен";
$Lang["accounts_email_from"]="Server Support"; // something like "Server Support <[email protected]>"
$Lang["accounts_email_ok"]="E-mail с новым паролем отправлен";
$Lang["accounts_email_error"]="Ошибка при отправке e-mail'а";
$Lang["accounts_newpassword"]="Новый пароль";
$Lang["accounts_wronganswers"]="Неверные Секретные ответы";
$Lang["accounts_nextbutton"]="Далее >>>";
if ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['email'] && strlen($_POST['email'])<=20)
{
if(isset($_SESSION['captcha_keystring'])&&
$_SESSION['captcha_keystring']==$_POST['keystring'])
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
if (!eregi("^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+", $_POST['email']))
die ("<p class=\"error\">" . $Lang["error_error"] . $Lang["accounts_notemail"] . "</p>");
$result=mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."' AND email='".$_POST['email']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_num_rows($result)==1)
{
$row=mysql_fetch_array($result);
print '<form method="post" action="index.php?id=repass2" onsubmit="return checkform2(this)">
<table>
<tr>
<td>'.$Lang["accounts_account"].'</td>
<td>'.$row['login'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_email"].'</td>
<td>'.$row['email'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_question1"].'</td>
<td>'.$row['question1'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_answer1"].'</td>
<td><input type="text" name="answer1" maxlength="40" /></td>
</tr>
<tr>
<td>'.$Lang["accounts_question2"].'</td>
<td>'.$row['question2'].'</td>
</tr>
<tr>
<td>'.$Lang["accounts_answer2"].'</td>
<td><input type="text" name="answer2" maxlength="40" /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="'.$Lang["accounts_resetbutton"].'" /></td>
</tr>
</table>
<input type="hidden" name="account" maxlength="20" value="'.$_POST['account'].'" />
</form>
';
}
else
print "<p class=\"error\">".$Lang["accounts_missingloginoremail"]."</p>";
}else{
echo ("<font color='red'>Вы ввели не верный код с картинки</font><br>");
}
unset($_SESSION['captcha_keystring']);
}
elseif ($page="index.php" && @$_POST['account'] && strlen($_POST['account'])<=20 && $_POST['answer1'] && strlen($_POST['answer1'])<=40 && $_POST['answer2'] && strlen($_POST['answer2'])<=40)
{
if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))
die ("<p class=\"error\">" . $L2JBS_lang["error_error"] . $Lang["accounts_accountnotalphanumeric"] . "</p>");
$banwords=Array("'", "\"", ",", ";", "--", "#");
$_POST['answer1']=str_replace($banwords, '', $_POST['answer1']);
$_POST['answer2']=str_replace($banwords, '', $_POST['answer2']);
$result=mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."' AND answer1='".$_POST['answer1']."' AND answer2='".$_POST['answer2']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
if (mysql_num_rows($result)==1)
{
$row=mysql_fetch_array($result);
$newpass=substr(preg_replace("/[0-9]/", "", md5(time())), 0, 6);
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1(utf8_encode($newpass))))."' WHERE login='".$row['login']."'", $link)
or die ('Error '.mysql_errno().': '.mysql_error());
print "<p style=\"font-weight: bold;\">".$Lang["accounts_passwordresetted"]."</p>\n";
$ok=1;
if ($L2JBS_config["mail_enable"] && $ok=mail($row['email'], $Lang["accounts_email_subject_resetted"], $L2JBS_lang["accounts_newpassword"].": ".$newpass, "From: ".$Lang["accounts_email_from"]))
print "<p>".$Lang["accounts_email_ok"]."</p>";
else
{
if (!$ok)
print '<p class="error">'.$Lang["accounts_email_error"].'</p>';
print "<p>".$Lang["accounts_newpassword"].": ".$newpass."</p>";
}
}
else
print "<p class=\"error\">".$Lang["accounts_wronganswers"]."</p>";
}
else
{
print '<form method="post" action="index.php?id=repass1" onsubmit="return checkform1(this)">
<table>
<tr>
<td>'.$Lang["accounts_account"].'</td>
<td><input type="text" name="account" maxlength="20" /></td>
</tr>
<tr>
<td>'.$Lang["accounts_email"].'</td>
<td><input type="text" name="email" maxlength="20" /></td>
</tr>
<tr>
<td align="right">'.$Lang["accounts_antibot"].'</td>
<td align="left">
<p> <img src="kcaptcha/index.php?<?php echo session_name()?>=<?php echo session_id()?>">
<br> <input type="text" name="keystring"></p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><br /><input type="submit" name="submit" value="'.$Lang["accounts_nextbutton"].'" /></td>
</tr>
</table>
</form>
';
}
?>
Спасибками не отделаешься
На Форуме я тоже Radar!
Я везде Radar!
0
Topic is closed for replies



