Parašė avice· 2012 Vas. 17 21:02:00
#2
Mazai ka pakeiciau bet turetu parodyt klaida del ko neprijungia.
<?php
include ("connect.php");
if(isset($_POST['user']))
{
$user = $_POST['user'];
$pass = md5($_POST['pass']);
if(!$connect) {die('Could not connect: '. mysql_error());}
mysql_select_db("real", $connect);
$result= mysql_query("SELECT * FROM users where username = '$user' AND password = '$pass' LIMIT 1") or die(mysql_error());
if(mysql_num_rows($result) == 1)
{
while($row = mysql_fetch_array($results))
{
$expire=time()+60*60*24*30;// 1menesi
setcookie("uid", $row['uid'], $expire);
echo "Prisijungete sekmingai<b>".$row['username']."</b><br>";
}
}else{
//blogas pw or name
echo "<b> neteisingas vartotojo vardas arba pass</b><br><br>";
}
mysql_close($connect);
}
echo "<form method='post' action='login.php'>
Vartotojo vardas <input type='text' name='user'><br>
Slaptazodis <input type='password' name='pass'><br>
<input type='submit' value='Prisijungti'>
</form>
";
?>