Jump to content

Recommended Posts

I have re did my login script and now I am getting this error message:

 

Notice: Undefined index: login in C:\xampp\htdocs\blogin.php on line 14

 

Also instead of showing the login form for some reason it says my account is not active. How can it says that if the session is not registered becuase it get the id from the session. It should show the login form. Here is my code. Please help.

 

Thanks in advanced.

 

<?
session_start();
echo '<pre>'; print_r($_SESSION); echo '</pre>';
?>
<?
if($_SESSION['SESS_LOGGEDIN'] = TRUE){
include'db.php';
$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());

$slogin = $_SESSION['login'];
$elink = mysql_query("SELECT * FROM `pilots` where login='$slogin'")
  or die("MySQL Said:".mysql_error());

$edata = mysql_fetch_assoc($elink);
$lname = $edata["lname"];
$hub = $edata["hub"];
$pwd = $edata["pwd"];
$fname = $edata["fname"];
$login= $edata["login"];
$status= $edata["status"];
$enewp = mysql_query("SELECT * FROM `pilots` where status ='0'")
  or die("MySQL Said:".mysql_error());

  $enewprow = mysql_num_rows($enewp);
  $eresult = count($enewp);






  if($edata['status'] == 0)
   {
    echo '<center>Your Account Is Not Active.</center>';
   }
  elseif($edata['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>
   
<? }
   elseif($edata['status'] == 3)
    {
    echo '<center>You Are Currently On L.O.A</center>';?>
     <a href="rfileloa.php?login=<? echo "{$edata["login"]}"?>">Return From L.O.A</a></br><?
   }
   else
   {
   
   
?>
   <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 "{$edata["lname"]}"?>">File Pirep</a></br>
   <a href="?page=fileloa&login=<? echo "{$edata["login"]}"?>">File LOA</a></br>
   <a href="#">Signatures</a></br>
   <A HREF="?page=profile&login=<? echo "{$edata["login"]}"?> ">My Profile</a></br>
   <a href="?page=editp&login=<? echo "{$edata["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($edata['hm'] == 1)
    {?>
     <center>
    <h7><i><b>Hub Manager Panel</b></i></h7></br>
     <a href="edithub.php?hub=<?php echo $edata['hub']; ?>">Edit Hub Page</a></br>
     <a href="apppireps.php?hub=<?php echo $edata['hub']; ?>">Approve Pireps</a></br>
     <a href="promote.php?hub=<?php echo $edata['hub']; ?>">Promote Pilot</a></br>
     <a href="awards.php">Grant Award</a></br>
    </center>
    <?php
   }
   if($edata['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($edata['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($edata['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($edata['bm'] == 1)
    {?>
    <center>
     <h7><i><b>Executive Staff Panel</b></i></h7></br>
     <a href="edithub.php?hub=<?php echo $edata['hub']; ?>">Edit Hub Page</a></br>
     <a href="apppireps.php?hub=<?php echo $edata['hub']; ?>">Approve Pireps</a></br>
     <a href="promote.php?hub=<?php echo $edata['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 "{$edata["login"]}"?>">New Pilots</a>  <font color="#0066FF" size="3" face="Times New Roman, Times, serif"><b><? echo"$enewprow"; ?></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
   }
  }
   }elseif($_SESSION['SESS_LOGGEDIN'] =FALSE){
  
      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="?page=addnews_hub">Add News For Hubs</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
{
  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>

<?
}

}

?>

Link to comment
https://forums.phpfreaks.com/topic/145948-2-major-problems/
Share on other sites

Well you could do:

 

if(!$_SESSION['SESS_LOGGEDIN'] {

\\DO SOMETHING

}

 

 

OR you can do:

 

if($_SESSION['SESS_LOGGEDIN'] != "TRUE") {

\\DO SOMETHING

}

 

Also I tried to do that and nothing happens still recceving the same error message

 

Notice: Undefined index: login in C:\xampp\htdocs\blogin.php on line 14

Your Account Is Not Active.

 

 

this is line 14

 

$slogin = $_SESSION['login'];

 

Link to comment
https://forums.phpfreaks.com/topic/145948-2-major-problems/#findComment-766226
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.