Parašė And2s· 2010 Bal. 30 16:04:46
#4
<?
if($logged_in == 1) {
die("<meta http-equiv='refresh' content='0;URL=manage.php'>");
}
//Kodo pradžia
require_once 'securimage.php';
$image = new Securimage();
$image->show();
// Code Validation
$image = new Securimage();
if(isset($_POST['code']) && isset($_POST['code']) && isset($_POST['uname']) && isset($_POST['passwd'])) {
if ($image->check($_POST['code']) == true) {
//Kodo pabaiga
if($_POST["uname"] == ""){
return resultpage("Nick registracija","Užmirsai įvesti nick.");
}
if($_POST["passwd"] == ""){
return resultpage("Nick registracija","Užmirsai įvesti slaptažodi.");
}
// authenticate.
if (!get_magic_quotes_gpc()) {
$_POST['uname'] = addslashes($_POST['uname']);
}
$qry = mysql_query("SELECT nick, password FROM $db_table WHERE nick = '".$_POST['uname']."'");
if (mysql_num_rows($qry) == 0) {
resultpage("<a href='login.php'>Prisijungimas</a>","Tokio slapyvardžio nėra mūsų duomenų bazėje.");
}
$info = mysql_fetch_array($qry);
// check passwords match
$_POST['passwd'] = stripslashes($_POST['passwd']);
$info['password'] = stripslashes($info['password']);
if ($_POST['passwd'] != $info['password']) {
resultpage("<a href='login.php'>Prisijungimas</a>","Neteisingas slaptažodis.");
}
// if we get here username and password are correct,
//register session variables.
$update_login = mysql_query($qry);
$_POST['uname'] = stripslashes($_POST['uname']);
$_SESSION['gzn_username'] = $_POST['uname'];
$_SESSION['gzn_password'] = $_POST['passwd'];
die("<meta http-equiv='refresh' content='0;URL=manage.php'>");
?>
</p>
<?php
} else {
return resultpage("Prisijungimas","Neteisingas patvirtinimo kodas.");
}
} else { // if form hasn't been submitted
?>
<div style="height: 50px"></div>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0" cellspacing="0" cellpadding="3" style="background: #fafafa; border:1px #A198B8 solid; width: 200px; font-size: 11px;" align="center">
<tr>
<td colspan="6" align="center" class="input-title" style="width: 100%;">Prisijungimas</td>
</tr>
<tr>
<td>
<table border="0">
<tr>
<td>Nick:</td>
<td><input type="text" name="uname" maxlength="15" size="15" value="" autocomplete="off"></td>
</tr>
<tr>
<td>Slaptažodis:</td>
<td><input type="password" name="passwd" maxlength="15" size="15" value="" autocomplete="off"></td>
</tr>
<tr>
//Kodo pradžia
<td>Patvirtinimo kodas*:</td>
<td><img src="securimage_show.php?sid=<?php echo md5(uniqid(time())); ?>"><br />
<input type="text" name="code" /></td>
//Kodo pabaiga
</tr>
</table>
<td>
</tr>
<tr>
<td>
<table border="0" align="center">
<tr>
<td>
<input type="submit" name="submit" class="button" value="Prisijungti »">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
Neturi sąskaitos? <a href='register.php'>Registruokis!</a><br />
Pamišai slaptažodį? <a href='remind.php'>Prisiminti.</a>
</td>
</tr>
</table>
</form>
<center><? echo $copyright ?></center>
<?php
}
?>
</body>
</html>