Nohtreya
-
Posts
1 -
Joined
-
Last visited
Never
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
1 Login Bug :S
in Microsoft SQL - MSSQL
Posted
I have an Login script dat works with Sessions and Mysql!
But I have one problem:
If you enter the username RIGHT but the password WRONG it shows a blank page :S
But if I enter another input it shows the right Error text :S
Here is my script:
[code]
<?php
session_start();
if ($_SESSION['login'] == 1){
echo "
:: Logged: <b>$naam</b>
<hr>
:: <a href='index.php?page=regist'>Register a customer</a><br>
:: <a href='index.php?page=list_klachten'>View list</a><br>
:: <a href='index.php?page=logout'>Logout</a><br>
";
}else{
if($_POST['submit']) {
$query = mysql_query("SELECT * FROM helpdesk_login WHERE gebruikersnaam = '".$_POST['username']."'") or die (mysql_error());
$result = mysql_fetch_object($query);
$naam = $result->gebruikersnaam;
$wachtwoord = $result->wachtwoord;
$session_id = $result->type;
if(!$_POST['username'] == "$naam" || !$_POST['password'] == "$wachtwoord") {
echo "The data are not correctly!<br><br><a href='javascript:history.back(1)'><u>Return</u></a><br><br>";
echo "<br />";
} elseif($session_id == 0) {
print "You're account isn't activated yet.<br><br><a href='javascript:history.back(1)'><u>Return</u></a><br><br>";
} else {
if($_POST['username'] == "$naam" && $_POST['password'] == "$wachtwoord") {
$_SESSION['username'] = $naam;
if ($session_id == '1'){
$_SESSION['login'] = "1";
}
$_SESSION['naam'] = $naam;
echo "Now logged in as: <b>$naam</b><br><br>Click <a href='index.php'>here</a> to continue.";
}
}
} else {
?>
<form name="form1" method="post" action="">
Username:<br>
<input name="username" type="text" /><br>
<br>
Password:<br>
<input name="password" type="password" /><br>
<br>
<input type="submit" name="submit" value="Login" />
</form>
<?
}
}
?>
[/code]
Thanks in advance ;D