Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Register system

Parašė MaFetas· 2012 Vas. 11 17:02:48
#2


<?php
 
 
 
include ("connect.php");
 
 
 
//tikrinima ar ivydyta forma
 
if(isset($_POST['username']))
 
{
 
//priskiariami kintamieji
 
$user = $_POST['username'];
 
$pass = $_POST['password'];
 
$pass2 = $_POST['password2'];
}
 
//tikrinama ar nera tusciu lauki
 
if($user<>"" AND $pass<>"" AND $pass2<>'')
 
 
{
 
// tikrinama ar vinodi spaltazodziai
 
if($pass==$pass2)
 
{
 
 
 
if(strlen($pass)>=4)
 
{
 
 
 
if(!$connect)
 
{
 
die("counld not connect:". mysql_error());
 
}
 
mysql_select_db("real", $connection);
 
 
 
$pass = md5($pass);
 
if(mysql_num_rows(mysql_query("select * from users where username = '$user'")))
 
{
 
echo "vartotojas uzimtas";
 
}else{
 
 
 
mysql_query("insert into users (uid, username, password) VALUES ('', '$user', '$pass')");
 
echo "Sekmingai uzsiregistravote.";
 
 
 
 
 
}
 
 
 
}else{
 
echo "Slaptazodis per trumpas";
 
}
 
 
 
 
 
}else{
 
 
 
echo "Slaptazodziai nesutampa";
 
 
 
}
 
 
 
 
 
}else{
 
 
 
echo "Ne visi laikai uzpildyti";
 
}
 
 
 
?>
 
 
 
<form method='POST'>
 
username <input type='text' name='username'><br>
 
password <input type='password' name='password'><br>
 
passwordx2 <input type='password' name='password2'><br>
 
 
 
<input type='submit' value='Register'>
 
</form>