Parašė scdogas321· 2012 Lap. 12 22:11:41
#1
<?php
$form = "<form action='./login.php' method='post'>
<table>
<tr>
<td>Slapyvardis:</td>
<td><input type='text' name='user' /></td>
</tr>
<tr>
<td>Slaptazodis:</td>
<td><input type='password' name='password' /></td>
</tr>
<tr>
<td></td>
<td><input type='submit' name='loginbtn' value='login' alt='asa' /></td>
</tr>
</table>
</form>";
$var = "<a href='html.php'>ss</a>";
if ($_POST['loginbtn']) {
$user = $_POST['user'];
$password = $_POST['password'];
if ($user){
if ($password){
require("cocektas.php");
$password = md5($password);
// isitikink kad prisijungimo info teisinga
$query = "SELECT * FROM users WHERE username='$user'";
$result = mysql_query($query);
if ($result !== false) {
$numrows = mysql_num_rows($result);
if ($numrows == 1){
$row = mysql_fetch_assoc($result);
$dbid = $row['id'];
$dbuser = $row['username'];
$dbpass = $row['password'];
$dbactive = $row['active'];
if ($password == $dbpass){
if ($dbactive == 1){
// set session info
$_SESSION['userid'] = $dbid;
$_SESSION['username'] = $dbuser;
echo "Jus esate prijungtas $dbuser";
}
else
echo "<center>Jus turite aktivuoti savo paskyra pries prisijungdamas.</center><br /> $form";
}
else
echo "<center>Jusu ivestas slaptazodis neteisingas.</center><br /> $form";
}
else
echo "<center>Slapyvardis kuri jus irasete nerastas.</center><br /> $form";
} else
echo "<center>Slapyvardis kuri jus irasete nerastas.</center><br /> $form";
mysql_close();
}
else
echo "<center>Turite irasyti slaptazodi.</center><br /> $form";
}
else
echo "<center>Turite irasyti savo slapyvardi.</center><br /> $form";
}
else
echo $form;
?>
<?php
if ($username && $userid) {
echo "<a href='./aaa.php'></a><a href='./logout'>Atsijungti</a>";
}
else
echo "Prašome įvesti duomenis norint prisijungti. $form";
?>
Taigi mane tomina si vieta
$dbid = $row['id'];
$dbuser = $row['username'];
$dbpass = $row['password'];
$dbactive = $row['active'];
if ($password == $dbpass){
if ($dbactive == 1){
// set session info
$_SESSION['userid'] = $dbid;
$_SESSION['username'] = $dbuser;
echo "Jus esate prijungtas $dbuser";
ar galima padaryti taip kad jei zmogaus duomenys atitinka db duomenis kai jis prisijungia nemestu teksto (echo "Jus esate prijungtas $dbuser";) o automatiskai imestu prisijungusi i members.php be jokiu paspaudimu ir t.t. tik turi atitikt duomeni.
Prasau padekit :(