Jump to content

Recommended Posts

I am having a minor problem with my members area script. My members area is on the right hand side of my site and when you login it is suppose to show you different options depending on your user level. That part is working ok. However my problem is that if the user logins on the index.php and goes to the contact us page the login script is not getting showing the Members Area only no more. With that saying on my index.php I have included the login.php file. So once again the main problem is that when the user logs in it shows the content they are suppose to see however when the user navigate to another link it doesn't show the member area options.

This is my log in code. I know I am missing something or something is in the wrong place but I just don't know where that something goes.

Here is my code:

<?php
session_start();
?>

<?php
if(isset($_POST['user']))
{
//Include Config File For DB info..
include 'db.php';
//Connect TO The MySQL Server
$connect = mysql_connect($db_host,$db_username,$db_password)
  or die("MySQL Said:".mysql_error());
  
$database = mysql_select_db($db_database,$connect)
  or die("MySQl Said:".mysql_error());
  
$login = mysql_real_escape_string($_POST['user']);
$pwd = mysql_real_escape_string($_POST['pwd']);

$link = mysql_query("SELECT * FROM `pilots` where login='$login' and pwd='$pwd'")
  or die("MySQL Said:".mysql_error());
  
$count = mysql_num_rows($link);
$data = mysql_fetch_assoc($link);
$lname = $data["lname"];
$hub = $data["hub"];
$pwd = $data["pwd"];
$fname = $data["fname"];
$login= $data["login"];
$status= $data["status"];

$newp = mysql_query("SELECT * FROM `pilots` where status ='0'")
  or die("MySQL Said:".mysql_error());
  
  $newprow = mysql_num_rows($newp);
  $result = count($newp);
  


if($count == 1)
{




  if($data['status'] == 0)
   {
    echo '<center>Your Account Is Not Active.</center>';
   }
  else
  {
   if($data['status'] == 2)
    {
    echo '<center><FONT COLOR =ff001b>Your Account Has Been Suspended.</center></FONT COLOR>';?>
    <center><a href="logout.php">Log Out</a></br></center>
   
<?  }
   else
   {
     if($data['status'] == 3)
    {
    echo '<center>You Are Currently On L.O.A</center>';?>
     <a href="rfileloa.php?login=<? echo "{$data["login"]}"?>">Return From L.O.A</a></br><?
   }
   else
   {
   
   

$_SESSION['SESS_LOGGEDIN'] = TRUE;
$_SESSION['SESS_LNAME'] = $lname;
$_SESSION['SESS_HUB'] = $hub;
$_SESSION['SESS_FNAME'] = $fname;
$_SESSION['login'] = $login;
$_SESSION['status'] = $status;


?>
   <body link="#0066FF" vlink="#0066FF" alink="#0066FF">
   <center>Welcome Back <? echo"$fname"; ?> <? echo"$lname"; ?></center>
   <center>
   <h7><i><b>Pilots Panel</b></i></h7></br>
   <a href="?page=pirepform&lname=<? echo "{$data["lname"]}"?>">File Pirep</a></br>
   <a href="?page=fileloa&login=<? echo "{$data["login"]}"?>">File LOA</a></br>
   <a href="#">Signatures</a></br>
   <A HREF="?page=profile&login=<? echo "{$data["login"]}"?> ">My Profile</a></br>
   <a href="?page=editp&login=<? echo "{$data["login"]}"?>">Edit My Profile</a></br>
   <a href="?page=events">Events</a></br>
   <a href="?page=rosterphp">VIew Roster</a></br>
   <a href="#"><font color="#FF0000">Resignation Form</font Color></br>
   <a href="logout.php">Log Out</a></br>
   
   <br>
   <h7><i><b>Pilots Tools</b></i></h7></br>
   <a href="http://www.fspassengers.com/"> FS Passengers</a></br>
   </center>

    <?php
   if($data['hm'] == 1)
    {?>
     <center>
    <h7><i><b>Hub Manager Panel</b></i></h7></br>
     <a href="edithub.php?hub=<?php echo $data['hub']; ?>">Edit Hub Page</a></br>
     <a href="apppireps.php?hub=<?php echo $data['hub']; ?>">Approve Pireps</a></br>
     <a href="promote.php?hub=<?php echo $data['hub']; ?>">Promote Pilot</a></br>
     <a href="awards.php">Grant Award</a></br>
    </center>
    <?php
   }
   if($data['fm'] == 1)
    {?>
     <center>
    <h7><i><b>Fleet Manager Panel</b></i></h7></br>
     <a href="addaircraft.php">Add Aircraft</a></br>
     <a href="manageaircraft.php">Manage Aircraft</a>
     </center>
    <?php
   }
   if($data['ed'] == 1)
    {?>
   <center>
    <h7><i><b>Events Director Panel</b></i></h7></br>
    <a href="?page=addevent">Add Event</a></br>
    <a href="?page=manageevents">Manage Events</a></br>
    <a href="postnews.php">Post News</a></br>
   
   
</center>
    <?php
   }
   if($data['hr'] == 1)
    { ?>
    <center>
    <h7><i><b>Human Rescources Panel</b></i></h7></br>
    <a href="?page=newpilots">New Pilots</a></br>
    <a href="?page=editpilots">Edit Pilots</a></br>
    <a href="viewcomments.php">View Comments</a></br>
    <a href="viewsitecomments.php">View Site Comments</a></br>
   <a href="?page=addnews">Post News</a></br>
   <a href="?page=editnews">Edit News</a></br>

   <?php
   }
   if($data['bm'] == 1)
    {?>
    <center>
     <h7><i><b>Executive Staff Panel</b></i></h7></br>
     <a href="edithub.php?hub=<?php echo $data['hub']; ?>">Edit Hub Page</a></br>
     <a href="apppireps.php?hub=<?php echo $data['hub']; ?>">Approve Pireps</a></br>
     <a href="promote.php?hub=<?php echo $data['hub']; ?>">Promote Pilot</a></br>
     <a href="awards.php">Grant Award</a></br>
    <a href="addevent">Add Event</a></br>
     <a href="manageevents.php">Manage Events</a></br>
      <a href="?page=addnews">Post News</a></br>
   <a href="?page=editnews">Edit News</a></br>
    <a href="pilotrec.php">Pilot Records</a></br>
    <a href="?page=newpilots&staffid=<? echo "{$data["login"]}"?>">New Pilots</a>  <font color="#0066FF" size="3" face="Times New Roman, Times, serif"><b><? echo"$newprow"; ?></font></b></br>
     <a href="?page=editpilots">Edit Pilots</a></br>
     <a href="viewcomments.php">View Comments</a></br>
     <a href="viewsitecomments.php">View Site Comments</a></br>
   
   <?php
   }
  }
  } }
}
else
{?>
<script>javascript:alert("Log In Failed!")</script>
<?
  echo '<center><FONT COLOR =ff001b> Your <i>Pilot ID And/Or Password</i> is wrong!</center></FONT COLOR>';?>
<style type="text/css">
.idBox {
width:50px;
}
.passwordBox {
width:80px;
}
</style>

<table border="0" align="center">
<form action="<? $_SERVER['PHP_SELF']; ?>" method="post">
  <tr>
    <td align="center">ID:</td><td align="center">ASA<input type="text" name="user" class="idBox"></td>
  </tr>
  <tr>
    <td align="center">Password:</td><td align="center"><input type="password" name="pwd" class="passwordBox"></td>
  </tr>
  <tr>
    <td></td><td align="center"><p align="center">
      <input type="submit" name="login" value="Login">
    </p>
      <p align="center">        <a href="#">Forgot Password</a></p></td>
  </tr>
</table>
<?
}?>
<? } else {?>
<style type="text/css">
.idBox {
width:50px;
}
.passwordBox {
width:80px;
}
</style>

<table border="0" align="center">
<form action="<? $_SERVER['PHP_SELF']; ?>" method="post">
  <tr>
    <td align="center">ID:</td><td align="center">ASA<input type="text" name="user" class="idBox"></td>
  </tr>
  <tr>
    <td align="center">Password:</td><td align="center"><input type="password" name="pwd" class="passwordBox"></td>
  </tr>
  <tr>
    <td></td><td align="center"><p>
      <input type="submit" name="login" value="Login">
      </p>
      <p><a href="#">Forgot Password</a> </p></td>
  </tr>
</table>
<?php } ?>

<font color="#0066FF" size="3">

 

Once again thanks in advanced!  ;D

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/
Share on other sites

affirm all my pages have session_start() but for some reason when the user goes to another page the login form box displays like the users is not logged in but the user is logged in because some pages of the site requires that you must be login. And with that saying if I can view that page that must means that the sessions are activated. I want it to have it set up so that every time you go to the page the login content will show on the right side not the login form (unless they are not logged in). Also on my home page I am using the get method for my pages so I don't have to do a lot of updating for instance the contact us link is 127.0.0.1/?page=contact_us.

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-760241
Share on other sites

when the user navigate to another link it doesn't show the member area options.
For anyone to be able to help, you would need to post the code for one of the pages that does not show the member area options.

 

And please give us some kind of clue (a starting line number in the code) about what part of the code is the code that shows the member area options.

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-760251
Share on other sites

You are apparently including the posted login code on your pages? Is it being included before any content is sent to the browser so that the session_start is actually working?

 

Are you developing and testing this code on a server with error_reporting set to E_ALL and display_errors set to ON so that you immediately see any php generated errors?

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-760317
Share on other sites

Since you did not post the requested code showing a page that exhibits the symptom, I'll assume that the posted login code IS the code you are expecting to display the member area options.

 

Your code has the following logic -

if(isset($_POST['user']))
{
   // check the user and password
   // display all the various links
} else {
  // display the login form
}

 

The only time the various links are displayed is when $_POST['user'] is set. You need to organize your logic so that the part that displays all the various links is outside of the if(isset($_POST['user'])) conditional statement. Put it in its own block of code and surround it with a conditional statement that tests which ever variable you have that says you are logged in.

 

You would also need to organize your logic so that the login form is only displayed if you are not logged in. It is currently displayed any time if(isset($_POST['user'])) is FALSE.

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-760428
Share on other sites

yeah the general idea is you have a login script, on some pages its fine, if your logged in it wont show the login box, but on others when your logged in it still shows it.

 

unless you give us the source code for a page which works correctly and the source for a page which doesnt we cant.

 

dont worry about the security or anything noone here is going to steal your work or anything like that ;)

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761074
Share on other sites

It doesn't work on any of the pages. And when you login it shows the information you are suppose to see if you are loged in but if you go to another page then it shows the login in box. Here is my currently login.php code.

 

<?
session_start();
?>

<?
if(isset($_POST['user']))
{
//Include Config File For DB info..
include 'db.php';
//Connect TO The MySQL Server
$connect = mysql_connect($db_host,$db_username,$db_password)
  or die("MySQL Said:".mysql_error());
  
$database = mysql_select_db($db_database,$connect)
  or die("MySQl Said:".mysql_error());
  
$login = mysql_real_escape_string($_POST['user']);
$pwd = mysql_real_escape_string($_POST['pwd']);

$link = mysql_query("SELECT * FROM `pilots` where login='$login' and pwd='$pwd'")
  or die("MySQL Said:".mysql_error());
  
$count = mysql_num_rows($link);
$data = mysql_fetch_assoc($link);
$lname = $data["lname"];
$hub = $data["hub"];
$pwd = $data["pwd"];
$fname = $data["fname"];
$login= $data["login"];
$status= $data["status"];

$newp = mysql_query("SELECT * FROM `pilots` where status ='0'")
  or die("MySQL Said:".mysql_error());
  
  $newprow = mysql_num_rows($newp);
  $result = count($newp);
  


if($count == 1)
{




  if($data['status'] == 0)
   {
    echo '<center>Your Account Is Not Active.</center>';
   }
  else
  {
   if($data['status'] == 2)
    {
    echo '<center><FONT COLOR =ff001b>Your Account Has Been Suspended.</center></FONT COLOR>';?>
    <center><a href="logout.php">Log Out</a></br></center>
   
<?  }
   else
   {
     if($data['status'] == 3)
    {
    echo '<center>You Are Currently On L.O.A</center>';?>
  <a href="rfileloa.php?login=<? echo "{$data["login"]}"?>">Return From L.O.A</a></br><?
   }
   else
   {



$_SESSION['SESS_LOGGEDIN'] = TRUE;
$_SESSION['SESS_LNAME'] = $lname;
$_SESSION['SESS_HUB'] = $hub;
$_SESSION['SESS_FNAME'] = $fname;
$_SESSION['login'] = $login;
$_SESSION['status'] = $status;


?>
   <body link="#0066FF" vlink="#0066FF" alink="#0066FF">
   <center>Welcome Back <? echo"$fname"; ?> <? echo"$lname"; ?></center>
   <center>
   <h7><i><b>Pilots Panel</b></i></h7></br>
   <a href="?page=pirepform&lname=<? echo "{$data["lname"]}"?>">File Pirep</a></br>
   <a href="?page=fileloa&login=<? echo "{$data["login"]}"?>">File LOA</a></br>
   <a href="#">Signatures</a></br>
   <A HREF="?page=profile&login=<? echo "{$data["login"]}"?> ">My Profile</a></br>
   <a href="?page=editp&login=<? echo "{$data["login"]}"?>">Edit My Profile</a></br>
   <a href="?page=events">Events</a></br>
   <a href="?page=rosterphp">VIew Roster</a></br>
   <a href="#"><font color="#FF0000">Resignation Form</font Color></br>
   <a href="logout.php">Log Out</a></br>
   
   <br>
   <h7><i><b>Pilots Tools</b></i></h7></br>
   <a href="http://www.fspassengers.com/"> FS Passengers</a></br>
   </center>
  
    <?php
   if($data['hm'] == 1)
    {?>
     <center>
    <h7><i><b>Hub Manager Panel</b></i></h7></br>
     <a href="?page=addnews_hub">Add News</a></br>
 <a href="?page=edithub">Edit Hub Page</a></br>
     <a href="apppireps.php?hub=<?php echo $data['hub']; ?>">Approve Pireps</a></br>
     <a href="promote.php?hub=<?php echo $data['hub']; ?>">Promote Pilot</a></br>
     <a href="awards.php">Grant Award</a></br>
    </center>
    <?php
   }
   if($data['fm'] == 1)
    {?>
     <center>
    <h7><i><b>Fleet Manager Panel</b></i></h7></br>
     <a href="addaircraft.php">Add Aircraft</a></br>
     <a href="manageaircraft.php">Manage Aircraft</a>
     </center>
    <?php
   }
   if($data['ed'] == 1)
    {?>
   <center>
    <h7><i><b>Events Director Panel</b></i></h7></br>
    <a href="?page=addevent">Add Event</a></br>
    <a href="?page=manageevents">Manage Events</a></br>
    <a href="postnews.php">Post News</a></br>


</center>
    <?php
   }
   if($data['hr'] == 1)
    { ?>
    <center>
    <h7><i><b>Human Rescources Panel</b></i></h7></br>
    <a href="?page=newpilots">New Pilots</a></br>
    <a href="?page=editpilots">Edit Pilots</a></br>
    <a href="viewcomments.php">View Comments</a></br>
    <a href="viewsitecomments.php">View Site Comments</a></br>
<a href="?page=addnews">Post News</a></br>
<a href="?page=editnews">Edit News</a></br>

   <?php
   }
   if($data['bm'] == 1)
    {?>
    <center>
     <h7><i><b>Executive Staff Panel</b></i></h7></br>
     <a href="?page=edithub">Edit Hub Page</a></br>
     <a href="apppireps.php?hub=<?php echo $data['hub']; ?>">Approve Pireps</a></br>
     <a href="promote.php?hub=<?php echo $data['hub']; ?>">Promote Pilot</a></br>
     <a href="awards.php">Grant Award</a></br>
    <a href="addevent">Add Event</a></br>
     <a href="manageevents.php">Manage Events</a></br>
   	<a href="?page=addnews">Post News</a></br>
<a href="?page=editnews">Edit News</a></br>
 <a href="pilotrec.php">Pilot Records</a></br>
    <a href="?page=newpilots&staffid=<? echo "{$data["login"]}"?>">New Pilots</a>  <font color="#0066FF" size="3" face="Times New Roman, Times, serif"><b><? echo"$newprow"; ?></font></b></br>
     <a href="?page=editpilots">Edit Pilots</a></br>
     <a href="viewcomments.php">View Comments</a></br>
     <a href="viewsitecomments.php">View Site Comments</a></br>
   
   <?php
   }
  }
  } }
}
else
{?>
<script>javascript:alert("Log In Failed!")</script>
<?
  echo '<center><FONT COLOR =ff001b> Your <i>Pilot ID And/Or Password</i> is wrong!</center></FONT COLOR>';?>
<style type="text/css">
.idBox {
width:50px;
}
.passwordBox {
width:80px;
}
</style>

<table border="0" align="center">
<form action="<? $_SERVER['PHP_SELF']; ?>" method="post">
  <tr>
    <td align="center">ID:</td><td align="center">ASA<input type="text" name="user" class="idBox"></td>
  </tr>
  <tr>
    <td align="center">Password:</td><td align="center"><input type="password" name="pwd" class="passwordBox"></td>
  </tr>
  <tr>
    <td></td><td align="center"><p align="center">
      <input type="submit" name="login" value="Login">
    </p>
      <p align="center">        <a href="#">Forgot Password</a></p></td>
  </tr>
</table>
<?
}?>
<? } else {?>
<style type="text/css">
.idBox {
width:50px;
}
.passwordBox {
width:80px;
}
</style>

<table border="0" align="center">
<form action="<? $_SERVER['PHP_SELF']; ?>" method="post"> 
  <tr>
    <td align="center">ID:</td><td align="center">ASA<input type="text" name="user" class="idBox"></td>
  </tr>
  <tr>
    <td align="center">Password:</td><td align="center"><input type="password" name="pwd" class="passwordBox"></td>
  </tr>
  <tr>
    <td></td><td align="center"><p>
      <input type="submit" name="login" value="Login">
      </p>
      <p><a href="#">Forgot Password</a> </p></td>
  </tr>
</table>
<?php } ?>

<font color="#0066FF" size="3">

 

Is their anyway I can fix this problem?

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761085
Share on other sites

Wow, that's some hard to read code, especially since I have no clue what most of it does (i.e. $data['hm'], $data['fm']...)

 

One thing, find:

$_SESSION['status'] = $status;

Add the line below:

print_r($_SESSION);

 

Make sure the other pages have the session_start(); at the top, and always use long tags (<?php) not short tags (<?)

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761089
Share on other sites

Wow, that's some hard to read code, especially since I have no clue what most of it does (i.e. $data['hm'], $data['fm']...)

 

One thing, find:

$_SESSION['status'] = $status;

Add the line below:

print_r($_SESSION);

 

Make sure the other pages have the session_start(); at the top, and always use long tags (<?php) not short tags (<?)

I did that and when I loged in I recceive something like this:

 

 

Array ( [sESS_LOGGEDIN] => 1 [sESS_LNAME] => <secure_name> [sESS_HUB] => PANC [sESS_FNAME] => <secure_name> [login] => 2000 [status] => 1 )

 

Secure name is a name in the database nothing big I put that their so the real name wont be revel. And yes all of my pages have the session_start(); and  it still show the login form.

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761091
Share on other sites

Read my last post above, it tells you what is wrong with your code that is causing the symptom. Your code only displays the links when the login form processing code is executed when $_POST['user'] is set. Your code does not display the links and the login form based on just being logged in or not.

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761093
Share on other sites

Read my last post above, it tells you what is wrong with your code that is causing the symptom. Your code only displays the links when the login form processing code is executed when $_POST['user'] is set. Your code does not display the links and the login form based on just being logged in or not.

 

Thanks I think we are getting closer I am confused where do I put that at and also what should I do now for when it is the user first time logging in?

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761095
Share on other sites

And I'll give you all a hint on what your logic needs to be -

 

<?php
session_start();
if(isset($_POST['user']))
{
   // check the user and password and do the logic to set the session variables
}

if(isset($_SESSION['SESS_LOGGEDIN']) && $_SESSION['SESS_LOGGEDIN'] == TRUE))
{
   // display all the various links
} else {
  // display the login form
}
?>

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761096
Share on other sites

I have modified my code to look like this

<?
session_start();
?>

<?
if(isset($_POST['user']))
{
//Include Config File For DB info..
include 'db.php';
//Connect TO The MySQL Server
$connect = mysql_connect($db_host,$db_username,$db_password)
  or die("MySQL Said:".mysql_error());
  
$database = mysql_select_db($db_database,$connect)
  or die("MySQl Said:".mysql_error());
  
$login = mysql_real_escape_string($_POST['user']);
$pwd = mysql_real_escape_string($_POST['pwd']);

$link = mysql_query("SELECT * FROM `pilots` where login='$login' and pwd='$pwd'")
  or die("MySQL Said:".mysql_error());
  
$count = mysql_num_rows($link);
$data = mysql_fetch_assoc($link);
$lname = $data["lname"];
$hub = $data["hub"];
$pwd = $data["pwd"];
$fname = $data["fname"];
$login= $data["login"];
$status= $data["status"];
}
if((isset($_SESSION['SESS_LOGGEDIN']) && $_SESSION['SESS_LOGGEDIN'] == TRUE))
{
   

$newp = mysql_query("SELECT * FROM `pilots` where status ='0'")
  or die("MySQL Said:".mysql_error());
  
  $newprow = mysql_num_rows($newp);
  $result = count($newp);
  


if($count == 1)
{




  if($data['status'] == 0)
   {
    echo '<center>Your Account Is Not Active.</center>';
   }
  else
  {
   if($data['status'] == 2)
    {
    echo '<center><FONT COLOR =ff001b>Your Account Has Been Suspended.</center></FONT COLOR>';?>
    <center><a href="logout.php">Log Out</a></br></center>
   
<?  }
   else
   {
     if($data['status'] == 3)
    {
    echo '<center>You Are Currently On L.O.A</center>';?>
  <a href="rfileloa.php?login=<? echo "{$data["login"]}"?>">Return From L.O.A</a></br><?
   }
   else
   {



$_SESSION['SESS_LOGGEDIN'] = TRUE;
$_SESSION['SESS_LNAME'] = $lname;
$_SESSION['SESS_HUB'] = $hub;
$_SESSION['SESS_FNAME'] = $fname;
$_SESSION['login'] = $login;
$_SESSION['status'] = $status;

?>
   <body link="#0066FF" vlink="#0066FF" alink="#0066FF">
   <center>Welcome Back <? echo"$fname"; ?> <? echo"$lname"; ?></center>
   <center>
   <h7><i><b>Pilots Panel</b></i></h7></br>
   <a href="?page=pirepform&lname=<? echo "{$data["lname"]}"?>">File Pirep</a></br>
   <a href="?page=fileloa&login=<? echo "{$data["login"]}"?>">File LOA</a></br>
   <a href="#">Signatures</a></br>
   <A HREF="?page=profile&login=<? echo "{$data["login"]}"?> ">My Profile</a></br>
   <a href="?page=editp&login=<? echo "{$data["login"]}"?>">Edit My Profile</a></br>
   <a href="?page=events">Events</a></br>
   <a href="?page=rosterphp">VIew Roster</a></br>
   <a href="#"><font color="#FF0000">Resignation Form</font Color></br>
   <a href="logout.php">Log Out</a></br>
   
   <br>
   <h7><i><b>Pilots Tools</b></i></h7></br>
   <a href="http://www.fspassengers.com/"> FS Passengers</a></br>
   </center>
  
    <?php
   if($data['hm'] == 1)
    {?>
     <center>
    <h7><i><b>Hub Manager Panel</b></i></h7></br>
     <a href="?page=addnews_hub">Add News</a></br>
 <a href="?page=edithub">Edit Hub Page</a></br>
     <a href="apppireps.php?hub=<?php echo $data['hub']; ?>">Approve Pireps</a></br>
     <a href="promote.php?hub=<?php echo $data['hub']; ?>">Promote Pilot</a></br>
     <a href="awards.php">Grant Award</a></br>
    </center>
    <?php
   }
   if($data['fm'] == 1)
    {?>
     <center>
    <h7><i><b>Fleet Manager Panel</b></i></h7></br>
     <a href="addaircraft.php">Add Aircraft</a></br>
     <a href="manageaircraft.php">Manage Aircraft</a>
     </center>
    <?php
   }
   if($data['ed'] == 1)
    {?>
   <center>
    <h7><i><b>Events Director Panel</b></i></h7></br>
    <a href="?page=addevent">Add Event</a></br>
    <a href="?page=manageevents">Manage Events</a></br>
    <a href="postnews.php">Post News</a></br>


</center>
    <?php
   }
   if($data['hr'] == 1)
    { ?>
    <center>
    <h7><i><b>Human Rescources Panel</b></i></h7></br>
    <a href="?page=newpilots">New Pilots</a></br>
    <a href="?page=editpilots">Edit Pilots</a></br>
    <a href="viewcomments.php">View Comments</a></br>
    <a href="viewsitecomments.php">View Site Comments</a></br>
<a href="?page=addnews">Post News</a></br>
<a href="?page=editnews">Edit News</a></br>

   <?php
   }
   if($data['bm'] == 1)
    {?>
    <center>
     <h7><i><b>Executive Staff Panel</b></i></h7></br>
     <a href="?page=edithub">Edit Hub Page</a></br>
     <a href="apppireps.php?hub=<?php echo $data['hub']; ?>">Approve Pireps</a></br>
     <a href="promote.php?hub=<?php echo $data['hub']; ?>">Promote Pilot</a></br>
     <a href="awards.php">Grant Award</a></br>
    <a href="addevent">Add Event</a></br>
     <a href="manageevents.php">Manage Events</a></br>
   	<a href="?page=addnews">Post News</a></br>
<a href="?page=editnews">Edit News</a></br>
 <a href="pilotrec.php">Pilot Records</a></br>
    <a href="?page=newpilots&staffid=<? echo "{$data["login"]}"?>">New Pilots</a>  <font color="#0066FF" size="3" face="Times New Roman, Times, serif"><b><? echo"$newprow"; ?></font></b></br>
     <a href="?page=editpilots">Edit Pilots</a></br>
     <a href="viewcomments.php">View Comments</a></br>
     <a href="viewsitecomments.php">View Site Comments</a></br>
   
   <?php
   }
  }
  } }
}
else
{?>
<script>javascript:alert("Log In Failed!")</script>
<?
  echo '<center><FONT COLOR =ff001b> Your <i>Pilot ID And/Or Password</i> is wrong!</center></FONT COLOR>';?>
<style type="text/css">
.idBox {
width:50px;
}
.passwordBox {
width:80px;
}
</style>

<table border="0" align="center">
<form action="<? $_SERVER['PHP_SELF']; ?>" method="post">
  <tr>
    <td align="center">ID:</td><td align="center">ASA<input type="text" name="user" class="idBox"></td>
  </tr>
  <tr>
    <td align="center">Password:</td><td align="center"><input type="password" name="pwd" class="passwordBox"></td>
  </tr>
  <tr>
    <td></td><td align="center"><p align="center">
      <input type="submit" name="login" value="Login">
    </p>
      <p align="center">        <a href="#">Forgot Password</a></p></td>
  </tr>
</table>
<?
}?>
<? } else {?>
<style type="text/css">
.idBox {
width:50px;
}
.passwordBox {
width:80px;
}
</style>

<table border="0" align="center">
<form action="<? $_SERVER['PHP_SELF']; ?>" method="post"> 
  <tr>
    <td align="center">ID:</td><td align="center">ASA<input type="text" name="user" class="idBox"></td>
  </tr>
  <tr>
    <td align="center">Password:</td><td align="center"><input type="password" name="pwd" class="passwordBox"></td>
  </tr>
  <tr>
    <td></td><td align="center"><p>
      <input type="submit" name="login" value="Login">
      </p>
      <p><a href="#">Forgot Password</a> </p></td>
  </tr>
</table>
<?php } ?>

 

And now when I try to log in nothing happens.

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761101
Share on other sites

Are you sure you wrote that code?

 

You need to identify and separate the logic into the parts that are responsible for -

  • check the user and password and do the logic to set the session variables
  • display all the various links
  • display the login form

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761117
Share on other sites

Are you sure you wrote that code?

 

yes slightly strange that it has mixed opening tags...

 

which imo is worse than even using just <? yes?

Are you sure you wrote that code?

 

You need to identify and separate the logic into the parts that are responsible for -

  • check the user and password and do the logic to set the session variables
  • display all the various links
  • display the login form

 

What should go first if the session is exists or check password or display all the login links.

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761329
Share on other sites

And I'll give you all a hint on what your logic needs to be -

 

<?php
session_start();
if(isset($_POST['user']))
{
   // check the user and password and do the logic to set the session variables
}

if(isset($_SESSION['SESS_LOGGEDIN']) && $_SESSION['SESS_LOGGEDIN'] == TRUE))
{
   // display all the various links
} else {
  // display the login form
}
?>

Link to comment
https://forums.phpfreaks.com/topic/144868-user-login-problems/#findComment-761335
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.