derrick1123 Posted March 12, 2008 Share Posted March 12, 2008 phpSinsei got: echo 'Username DB: ' .$row['pwd']; echo 'Password DB: ' .$row['callsign'].' Backwords... echo 'Username DB: ' .$row['callsign']; echo 'Password DB: ' .$row['pwd'].'<br>'; But that shouldn't have anything to do with the error that is given. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted March 12, 2008 Share Posted March 12, 2008 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(); ?> Quote Link to comment Share on other sites More sharing options...
vasoftwaresolutions Posted March 12, 2008 Author Share Posted March 12, 2008 ok it works now.. thanks to all you guys,,, expecally phpSensei !! see you guys layter Quote Link to comment Share on other sites More sharing options...
phpSensei Posted March 12, 2008 Share Posted March 12, 2008 edit: Yup, I was going to say it worked. Np Glad we can help you Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted March 12, 2008 Share Posted March 12, 2008 ^.^ Quote Link to comment Share on other sites More sharing options...
vasoftwaresolutions Posted March 12, 2008 Author Share Posted March 12, 2008 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> Quote Link to comment Share on other sites More sharing options...
vasoftwaresolutions Posted March 12, 2008 Author Share Posted March 12, 2008 sorry wrong link... http://bluewavesvirtual.com/index1.php Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted March 12, 2008 Share Posted March 12, 2008 session_start() MUST be the FIRST line of code... Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted March 12, 2008 Share Posted March 12, 2008 also, jw, why are you randomly turning PHP on and off don't do "?>" until you are done with the php or until you have to insert some other sort of code in there in between. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.