Parašė WebDraw· 2010 Rugp. 24 21:08:53
#5
pirma rasta klaida:
loginCode.php:
<?php
if ($_POST['sub'])
{
//
echo '<td class="juosta3">';
//
$inputnick = $_POST['nick'];
$inputpass = $_POST['pass'];
$mdpass = md5($inputpass);
$getdata = mysql_query("SELECT * FROM users WHERE nick = '$inputnick' AND pass = '$inputpass' LIMIT 1 ");
if ($inputnick == "" || $inputpass == "")
{
echo "Laukeliai tusti";
}
if (!mysql_num_rows($getdata))
{
echo "Slapyvardis arba Slaptazodis blogi";
}
else
{
$_SESSION['loged'] = $inputnick;
print 'Prisijungei';
echo '<META HTTP-EQUIV="refresh" CONTENT="1">';
}
//
echo '</td>';
//
}
?>
regCode.php:
<?php
if ($_POST['sub'])
{
//
echo '<td class="juosta3">';
//
$inputnick = $_POST['nick'];
$inputpass = $_POST['pass'];
$inputrepass = $_POST['repass'];
$inputemail = $_POST['email'];
$inputskype = $_POST['skype'];
$mdpass = md5($inputpass);
$getdata = mysql_query("SELECT * FROM users WHERE nick = '$inputnick' limit 1 ");
$getdata2 = mysql_query("SELECT * FROM users WHERE email = '$inputemail' limit 1 ");
if ($inputnick == "" || $inputpass == "" || $inputrepass == "" || $inputemail == "" || $inputskype == "")
{
echo "Laukeliai tusti";
}
elseif (mysql_num_rows($getdata))
{
echo "Slapyvardis yra uzimtas. Susigalvokite kita";
}
elseif (mysql_num_rows($getdata2))
{
echo "Vartotojas su tokiu E-MAIL Adresu jau uzsiregistraves. <br> Nesukciauk ;]";
}
elseif ($inputpass != $inputrepass)
{
echo "Slaptazodziai nesutampa";
}
else
{
mysql_query("INSERT INTO users VALUES('','$inputnick','$mdpass','$inputemail','$inputskype')");
while($rows = mysql_fetch_assoc($getdata))
{
$dataid = $rows['id'];
$datanick = $rows['nick'];
$datapass = $rows['pass'];
$dataemail = $rows['email'];
$dataskype = $rows['skype'];
}
echo "Tu sekmingai uzsiregistavai. Jus esate <b>".$dataid++."</b> narys <br> <a href='index.php'>Grizti</a>";
}
//
echo '</td>';
//
}
?>
Taipat
mysql duomenu bazeje per pma uzdek ant nick atributa 'unikalus'.
Dar pasiskaityk sita:
http://www.tizag.com/mysqlTutori...ection.php
Istaisiau keleta klaidu, gal pats suprasi kaip reik daryt