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>,
&nbsp; &nbsp; &nbsp;<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>&nbsp;</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 Like 50 Dislike
Previous forums Next forums
Other forums

Problem with PHP code- simple contact form
Hi Folks,
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a co

styling a RadioButtonList
HiI need to have a radio button and close to it, its lable, then a space then another set of those.

using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto

Problem with Subscreen
Dear Experts ,
I am facing a problem with the subscreens. My senario is as follows :

IP Based Cron Jobs
I run cronjobs on my website. After one of my visitors got curious and tinkered around he realized h

Different payment methods with different cross company requirements in F110
We are implementing SAP in a company in the shipping industry. They have the following requirement:<

Help with simple query
Hi,

I'm trying to do a Query with a Union where I want to print the number of rows $tc conta

Memory Allocation
Hi folks,
see this ex:

int v=5;
v=v+10;

then what will do the compiler before th

filesize problem
i use ubuntu 9.10 and i have mountet a folder from an windows

/mount/FOLDER
/mount/FOLDER/

Please help with SMTP Authenticated PHP Email Form
Hello, I'm creating a PHP email form, and for this particular server, I have to use SMTP Authenticat

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash