- Регистрация
- 30 Дек 2007
- Сообщения
- 14
- Реакции
- 0
- Заблокирован
- #21
Pomoqite, ochen proshu
Zdrastvuyte, ya novicok na php i mnoqoe eshe ne znayu. Ya napisal takoy kod
----------------------------------------------------------------------------------------<?php
<?php
$pass[]="123456";
$pass[]="12356";
$pass[]="1234567";
$pass[]="23456";
$pass[]="12z3456";
function showForm()
{
echo "<form method=\"post\" action=\"\"><input type=\"text\" name=\"password\"><input type=\"submit\" name=\"doLogin\" value=\"Vxod\"></form>";
}
if (isset($_POST['doLogin']) && isset($_POST['password']))
{
$_POST['password']=trim($_POST['password']);
if ($_POST['password']!="")
{
if(in_array($_POST['password'],$pass))
{
echo "Privet";
exit();
}
else
{
echo "Oshibka";
showForm();
}
}
else
{
echo "Parol ne mojet bit s probelom!";
showForm();
}
}
else
{
showForm();
}
?>
------------------------------------------------------------------------------------------
Eto dlya toqo chtobi koqda polzovatel otkroet index, ot neqo trebuyutsa parol kotorie lejitsa na array. Esli on napishit verniy parol, to on mojet vxodit v sayt, esli net, to ne mojet. Sejchas mne nujen sdelat tak chtobi dlya kajiy parol bil 2 popitka. Esli polzovotel napishit odinakoviy parol 3 raz, to stranicha vidal oshibka. To est posle vtorova popitka parol na array bil udalen.
POMOQİTE POJALUSTA,MNE ETOT KOD OCHEN NUJEN
Zdrastvuyte, ya novicok na php i mnoqoe eshe ne znayu. Ya napisal takoy kod
----------------------------------------------------------------------------------------<?php
<?php
$pass[]="123456";
$pass[]="12356";
$pass[]="1234567";
$pass[]="23456";
$pass[]="12z3456";
function showForm()
{
echo "<form method=\"post\" action=\"\"><input type=\"text\" name=\"password\"><input type=\"submit\" name=\"doLogin\" value=\"Vxod\"></form>";
}
if (isset($_POST['doLogin']) && isset($_POST['password']))
{
$_POST['password']=trim($_POST['password']);
if ($_POST['password']!="")
{
if(in_array($_POST['password'],$pass))
{
echo "Privet";
exit();
}
else
{
echo "Oshibka";
showForm();
}
}
else
{
echo "Parol ne mojet bit s probelom!";
showForm();
}
}
else
{
showForm();
}
?>
------------------------------------------------------------------------------------------
Eto dlya toqo chtobi koqda polzovatel otkroet index, ot neqo trebuyutsa parol kotorie lejitsa na array. Esli on napishit verniy parol, to on mojet vxodit v sayt, esli net, to ne mojet. Sejchas mne nujen sdelat tak chtobi dlya kajiy parol bil 2 popitka. Esli polzovotel napishit odinakoviy parol 3 raz, to stranicha vidal oshibka. To est posle vtorova popitka parol na array bil udalen.
POMOQİTE POJALUSTA,MNE ETOT KOD OCHEN NUJEN