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
New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understan
Developing Ajax-enabled ASP.Net applications for the iPhone
I would like to develop Ajax web applications using Visual Studio that are optimized for the iPhone.
cURL proxy
Okay here is the thing... i know how to add proxys
Code: curl_setopt($ch, CURLOPT_PROXYTYPE,
remove innitial and
tags
i am using tiny_mce as a text editor for my CMS.
buy now the problem is it add <p>
Impact of movement type 412 E on MAP
Hi
Usage of movement type 412 E is causing huge change in MAP .
Is there any r
Saving PHP output as a file
I wondered if anyone knows how to save the rendered output of a PHP script as a file?
I have
need a script for 3 pages
I have a customer who wants me to set up a site with a number of pages with the following requiremen
if statements problems
Hi. I'm trying to make a web form, but I kind of hit a dead end trying to figure out why it doesn't
Storing the referrer in session... problems with tabs
Hello All
I am currently working on an ERP project based on the MVC methodology, when a user
help with insert
Hi there,
I am trying to insert some data into a database, but for some reason, it is not ins