login box shows up again after logging in 2nd login works
Posted on
16th Feb 2014 07:03 pm by
admin
Hello,
I am having trouble on my site Lockerz.rack111.com where when you login the login box when you hit submit clears and then when you type your info in again then the login box works.
here is the code:
Code: <?php
if(isset($_SESSION['username'])) {
$username = $_SESSION['username'];
$query = mysql_query("SELECT id FROM `members` WHERE `username` = '$username'") or die(mysql_error());
$results = mysql_num_rows($query);
$id = $results['id'];
echo "welcome <font color='lightblue'>$username</font>,
<a href='./profile.php?id=$userID '>Profile</a> - <a href='./logout.php'>Logout</a>";
} else {
$final_report = "-";
if(isset($_POST['login'])){
$username= trim($_POST['username']);
$password = trim($_POST['password']);
if($username == NULL OR $password == NULL){
$final_report = "Please complete all the fields below..";
}else{
$check_user_data = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
if(mysql_num_rows($check_user_data) == 0){
$final_report = "This username does not exist..";
}else{
$get_user_data = mysql_fetch_array($check_user_data);
if($get_user_data['password'] == $password){
$start_idsess = $_SESSION['username'] = "".$get_user_data['username']."";
$start_passsess = $_SESSION['password'] = "".$get_user_data['password']."";
?>
<?php
}}}}
?>
<font color="white">
<form action="" method="post">
<table width="312" align="center">
<tr>
<?php echo "<font color='white' size='1'>$final_report </font>"; ?><td width="120"><font color="white">Username:</font></td>
<td width="180"><input type="text" name="username" size="30" maxlength="25" STYLE="font-size: xx-small;"></td>
</tr>
<tr>
<td><font color="white">Password:</font></td>
<td><input type="password" name="password" size="30" maxlength="25" STYLE="font-size: xx-small;"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="login" value="Login" STYLE="font-size: xx-small;"></td>
</tr>
</table>
</font>
</form>
<?php
}
?>
No comments posted yet
Your Answer:
Login to answer
144
50
Other forums
Libraries in C++
Hi all,
I have two libraries. one is based targeted on linux platform and uses another li
Procedure with variable number of columns
Hi, I have a procedure that looks like this:
PROCEDURE PROC(p_cursor OUT sys_refcurso
Question about GD library
I am trying to make an image that shows a random quote from my database.
However I want t
string to currency format
Hi guys...
Actually I chunk out some data from txtfile and one of the data contains amount va
Date Format
Hi there,
I have a date format like this right now:
Sat, 17 Oct 2009 17:04:00
I ne
php mysql query from input textbox
Hi,
I have a text box, in that i have given the mysql query. I can able to get the query in v
MySQL issue
I am taking sentences through a form on page. Then checking some condition and trying to insert them
Preserving user-entered linebreaks
Hi, I'm building a web 2.0 thingy from scratch and I wanna display text which users input. It's all
Simple Scraper... Weird Output
Okay, maybe I just need a Blue Monster and some sleep, but....
I'm scraping a ringtone site
Displaying image from database
Hi,
I've got a site where that's got a database behind it. Currently it has loads of items in