Jump to content

Session Info


Recommended Posts

hello again guys,

 

I am trying to echo the users info so they can see where they stand... it is suppost to display there first name, last name, etc. here is the login info to test it out.... http://bluewavesvirtual.com/index1.php user=BWA1001 password=833699

 

any help is apprecheated

also here is my code

<?php $pagename = "Pilot Overview"; ?>
<?php
$host="localhost"; // Host name 
$username="pacifij1_blue"; // Mysql username 
$password="8336994895"; // Mysql password 
$db_name="pacifij1_blue"; // Database name 
$tbl_name="pilot"; // Table name 



session_start();


if(!session_is_registered('callsign') AND !session_is_registered('pwd') AND !session_is_registered('first_name') AND !session_is_registered('last_name')){ 

header( 'Location: http://bluewavesvirtual.com/');

exit();

}


?>
<?php

$hostname = "localhost";   
$database = "pacifij1_blue"; 
$username = "pacifij1_blue"; 
$password = "8336994895"; 
$vrbo = mysql_connect($hostname, $username, $password) or die(mysql_error()); 

mysql_select_db($database, $vrbo);
$query_Session_Info = ("SELECT * FROM pilot WHERE callsign = '$callsign' and last_name = '$last_name'");
$Session_Info = mysql_query($query_Session_Info, $vrbo) or die(mysql_error());
$row_Session_Info = mysql_fetch_assoc($Session_Info);
$totalRows_Session_Info = mysql_num_rows($Session_Info);



?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Blue Waves Virtual Airlines :: <?php echo $pagename; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {color: #808080}
-->
</style>
</head>

<body>
<div align="center">
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td><img src="images/toplayer.jpg" width="800" height="20"></td>
    </tr>
  </table>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><img src="banners/banners.jpg" width="800" height="150"></td>
    </tr>
  </table>
<?php include("includes/mainmenu.php"); ?>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="144"><p> </p>
        <p><?php include("includes/pilotmenu.php"); ?></p>
      <p> </p></td>
      <td width="556"><p><img src="images/careerimg.jpg" alt="Carrer Image" width="288" height="193"></p>
        <p>Hello And Welcome To Your Pilot Overview</p>
        <p>First Name: <?php echo $row_Session_Info['first_name']; ?></p>
        <p>Last Name: <?php echo $row_Session_Info['last_name']; ?></p>
      <p>City: <?php echo $row_Session_Info['city']; ?></p>
      <p>State: <?php echo $row_Session_Info['state']; ?></p>
      <p>Country: <?php echo $row_Session_Info['country']; ?></p>
      <p>About: <?php echo $row_Session_Info['about']; ?></p>
      <p>Hours: <?php
		  
		  $last_name = $row_pilots['last_name']; 

		  

		mysql_select_db($database, $vrbo);
$tt = 0;
$midnight = strtotime(date('Y-m-d') . ' 00:00:00');



mysql_select_db($database, $vrbo);
$query_h = "SELECT duration FROM pireps WHERE last_name = '$last_name' and approved = '1'";
$h = mysql_query($query_h, $vrbo) or die(mysql_error());


while($r = mysql_fetch_assoc($h))
$tt += strtotime($r['duration']) - $midnight;
$hours = floor($tt/3600);
$x = $tt - floor($tt/3600)*3600;
$mins = floor($x/60);
$secs = $x - floor($x/60) * 60;
echo  $hours . ':' . $mins;
?><br>
          </p></td>
      <td width="100">Hello <?php echo $callsign; ?>,  Welcome</p>
      <p><a href="logout.php" class="linkblue">Logout</a></td>
    </tr>
  </table>
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><div align="center"><font color="#808080">©2008 Blue Waves Virtual 
          Airlines. Logos And Slogans And All Other Property 
          Are Part Of Blue Waves Virtual Airlines And May Never Be Redestributed. 
      All Rights Reserved.</font></div></td>
    </tr>
    <tr>
      <td><img src="images/bottomlayer.jpg" width="800" height="50"></td>
    </tr>
  </table>
  <p> </p>
  <p>  </p>
</div>
</body>
</html>

Link to comment
Share on other sites

For a start, remove your mysql authorisation data from the variables.

 

Change:

if(!session_is_registered('callsign') AND !session_is_registered('pwd') AND !session_is_registered('first_name') AND !session_is_registered('last_name')){

to

if(!$_SESSION['callsign']) && !$_SESSION['pwd'] && $_SESSION['first_name'] && $_SESSION['last_name']){ 

 

Remove the first set of mysql data, since you've already set it at the pint where you're actually connecting. Why are you connecting to your databases so often? You need to do it once.

 

Also, if you've already stored the sessions, then you can echo the sessions:

<?=$_SESSION['callsign']; ?>

The <?= is a short way of saying echo.

 

Off topic, is the callsign the username, but a radio callsign?

Link to comment
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.