if($psl == "reg")
{
echo "
<h2>Registracija</h2>
<form action='index.php?psl=reg2' method='post'>
Slapyvardis: <input type='text' name='nick' maxlength='40'/><br>
Slaptazodis: <input type='password' name='pass' maxlength='40' /><br>
El. pastas: <input type='text' name='email' maxlength='40' /><br>
<input type='submit' value='Registruotis' name='registruotis'>
</form>
";
}
if($psl == "reg2")
{
@extract($_POST);
if(isset($registruotis)){
$row = mysql_fetch_assoc(mysql_query("SELECT * FROM nariai WHERE nick='$nick' or email='$email'"));
if($nick == "") { $er = "Klaida, butina ivesti slapyvardi!"; }
elseif (strlen($pass) < 4 ) { $er = "Klaida, slaptazodis per trumpas."; }
elseif ($email == "") { $er = "Klaida, butina ivesti el. pasto adresa"; }
elseif(strtolower($row['nick']) == strtolower($nick)) { $er = "Klaida toks slapyvardis jau uzregistruotas!"; }
elseif(strtolower($row['email']) == strtolower($email)) { $er = "Klaida toks el.pasto adresas jau uzregistruotas!"; }
else
{
$er = "Registracija sekminga, dabar galite prisijungti!";
mysql_query("INSERT INTO nariai
(nick,pass,email,grupe) VALUES
('$nick','$pass','$email','1')
") or die("MySQL Klaida".mysql_error());
}
echo "
<h2>Registracijos ataskaita</h2>
$er
";
}
}