Jump to content

PHP Login


Recommended Posts

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Sorry about that, it says Login Worked if you look closely.

 

My script should work

 

<?php
$host="localhost"; // Host name 
$username="pacifij1_blue"; // Mysql username 
$password="8336994895"; // Mysql password 
$db_name="pacifij1_blue"; // Database name 


// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from signup form 
$callsign = $_POST['callsign']; 
$pwd = $_POST['pwd']; 
$first_name = $_POST['first_name']; 
$last_name = $_POST['last_name']; 


$sql="SELECT * FROM pilot WHERE callsign='$callsign' and pwd='$pwd'";
$result=mysql_query($sql) or die(mysql_error());

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count > 0){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("callsign");
session_register("pwd"); 
session_register("first_name"); 
session_register("last_name"); 
header("location:login_success.php");
echo 'Login Worked';
}
else {
mysql_error();
echo 'Login Didnt Work';
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Loading</title>
</head>

<body>
</body>
</html>
<?php mysql_close(); ?>

Link to comment
Share on other sites

OH YAY .. a new error

 

 

ok if you go back to that page www.blueskyair.org/index1.php and login with user BWA1001 password 833699.. try to login

 

it doesnt show your session info which is the first name last name etc..

 

here is the code for the pilot-overview.php

<?php $pagename = "Pilot Overview"; ?>
<?php
$host="localhost"; // Host name 
$username="pacifij1_blue"; // Mysql username 
$password="pass"; // Mysql password 
$db_name="pacifij1_bluewaves"; // 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'");
$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

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.