Jump to content

Cooper94

Members
  • Posts

    107
  • Joined

  • Last visited

    Never

Everything posted by Cooper94

  1. I have this problem were it is showing all the flights that the user booked but it wont seperate: http://www.republicv.org/site1/options.php?content=bid Code: <?php include 'includes/session.php'; include 'data.php'; ?> <form action="" method="post"> <table width=100% align=center> <tr align=center><td width=50%>Departure Airport</td><td align=left> <input name="dep" value=""> <tr align=center><td>Arrival Airport</td><td align=left> <input name="arr" value=""> <tr align=center><td>Aircraft</td><td align=left> <select name="aircraft"> <option value="Select Aircraft"></option> <option value="ERJ-170/175">ERJ-170/175</option> </select></td></tr> <tr align=center><td></td><td align=left><input type="submit" value="Search Timetable"></td></tr> </form> <?php $result = mysql_query("SELECT * FROM book WHERE username='{$_SESSION['username']}'"); $num = mysql_num_rows($result); ?> <tr><td colspan=2><hr height=1 width=100%></td></tr> <tr><td colspan=2 align=center> <table width=100%> <tr align=center> <td><b>Flight Number</b></td> <td><b>Departure Airport</b></td> <td><b>Arrival Airport</b></td> <td><b>Aircraft</b></td> <td><b></b></td></tr> <tr align=center> <?php while ($row = mysql_fetch_array($result)) { echo "<td>{$row['flightnum']}</td>"; echo "<td>{$row['dep_icao']}</td>"; echo "<td>{$row['arr_icao']}</td>"; echo "<td>{$row['aircraft']}</td>"; } ?> <td><a href=?content=dispatch&id=22443>Flight Info</a><br> <a href=?content=delete-flight&id=22443>Delete</a></td> </tr> </table> </td></tr> </table>
  2. Yes this works but say I have two flights booked it wont create an option for the second one it just puts both the flights in one option tag.
  3. It isnt showing all of the flights I have booked is there something I am doing wrong? <?php session_start(); include 'data.php'; $result = mysql_query("select * from book WHERE username = '{$_SESSION['username']}'"); $num = mysql_num_rows($result); $row = mysql_fetch_assoc($result); ?> <form action="http://www.republicv.org/site1/options.php?content=pirep" method="post"> <ul><li> If you would like to file a manual report please make sure the flight has been flown on vatsim or it will not be accepted. If you can not run our Acars System than you may contact the VP of Corparte Development at vp@republicv.org, and tell him the reason of this issue. Manual reports will be only accpeted as a last resort!</ul></li> <table width=100%> <tr><td colspan=2 align=center> <select name=flight onchange="window.open(this.options[this.selectedIndex].value,'_top')"> <option>No Booked Flights</option> <option><? echo $row['flightnum'] ?></option> </td></tr>
  4. I thought sessions were used when a member is logged in ??? I am not sure if you understand my question I would like to know how would it know what "callsign" to make it when someone REGISTERS with the site. Basicly istead of the admin chosing it when they accept them it is already chosen by the system. Say the last person was marked as RPA100 the next would be RPA101. Thank You
  5. If you can tell me how to do this that would be great! Thank You
  6. Ok I want it so when a person joins my website they will be assigned something called a callsign which is more or less like numbers and letters. I would like the system to automatilcy know what "callsign" is next on the line so say the last person who joined got the "callsign" RPA100 so the next person who joins is it possible for the system to know to set the next user who joins too RPA101? I hope I made this clear enough if not please say so and will answer them to the best of my ability. Thank You
  7. Is it possible say I want the system to update a table but the table dosnt exisits how would I display a error message that says such a thing? Thank You
  8. Would this be the best way to post or pull the data from the database? <? include 'db.php' ?> <? $result = mysql_query("select * from news ORDER BY id DESC LIMIT 4"); $num = mysql_num_rows($result); $i =0; ?> <? while($i < $num) { $date = mysql_result($result,$i,"date"); $headline = mysql_result($result,$i,"headline"); $sum = mysql_result($result,$i,"sum"); $id = mysql_result($result,$i,"id"); ?> <p align="justify"><?echo $date;?> : Notam : <?echo $headline; ?><br> <?echo $sum; ?><br> <a href="news.php?id=<?echo $id;?>" style="text-decoration: none; border-bottom: 1px dotted; color: #006699;">Read More</a> <? $i++;} ?>
  9. How would I get a form in an echo statment, is it even possible? if ( $_GET['content'] == "pirep" ) { echo "<form name="form3" action="pirep_process.php" method="post"> <table cellpadding="8" align="center" cellspacing="0" width="80%" style="font-size: 10pt"> <tr> <td align="left" valign="top"> </td> <td ><input name="username" type="hidden" id="username" value="RPA001"></td> </tr> <tr> <td align="left" valign="top">Booked Flights</td> <td > <select name="Manual" size="1" onchange="window.open(this.options[this.selectedIndex].value,'_top')"> <option>Booked Flights</option> <option value="book.php?id=" id=""></option> </td> </tr> <tr> <td align="left" valign="top">Date of Flight</td> <td><input name="date" type="text" id="date" value="2009-01-29"></td> </tr> <tr> <td align="left" valign="top">Departure Airport</td> <td><input name="icao_orig" type="text" id="icao_orig" value=""></td> </tr> <tr> <td align="left" valign="top">Destination Airport</td> <td><input name="icao_dest" type="text" id="icao_dest" value=""></td> </tr> <tr> <td align="left" valign="top">Type Aircraft</td> <td><select name="aircraft" type="text" id="aircraft"> <option value="ERJ-170">ERJ-170/175</option> </td> </tr> <tr> <td align="left" valign="top">Flight Number</td> <td><input name="routenum" type="text" id="routenum" value=""></td> </tr> <tr> <td align="left" valign="top">Flight Time</td> <td><input name="flthrs2" type="text" id="flthrs2" value=""></td> </tr> <tr> <td><input name="hub" type="hidden" id="hub" value="KPHL"></td> </tr> <tr> <td align="left" valign="top">Comments:</td> <td><input name="comments" type="text" id="comments" value=""></td> </tr> <tr> <td align="left" valign="top">Online:</td> <td><select name="online" type="text" id="online"> <option value="Yes">Yes</option> <option value="No">No</option> </td> </tr> <td align="left" valign="top"> </td> <td><input type="submit" name="Submit" value="File Pirep!"></td> </tr> </table> </form>"; } I am basicly trying to reduce the amount of files on my server and I dont know if this is possible, is it?
  10. I know I have been asking loads of questions about security and I was just wanted to know if this looked security tight. I do know that nothing will ever be 100% but it would help if it was close! Thank You Code: <li><ul> <center><font color="red"> <?php if(isset($_POST['submit'])) { // username and password sent from form $password=$_POST['password']; $password1=$_POST['password1']; $name=$_POST['name']; // To protect MySQL injection (more detail about MySQL injection) $password = stripslashes($password); $password = mysql_real_escape_string($password); $password1 = stripslashes($password1); $password1 = mysql_real_escape_string($password1); $name = stripslashes($name); $name = mysql_real_escape_string($name); $hours=$_POST['hours']; $hours = stripslashes($hours); $hours = mysql_real_escape_string($hours); $enc = md5($password); if ($password!=$password1){ echo "Password Does Not Match"; } elseif ($name==""){ echo "Invalid Name"; } elseif ($hours > "100"){ echo "We Do Not Accept Hours Over 100"; } else{ $sql=mysql_query("INSERT INTO pilots (name, hours, password) VALUES ('$name','$hours','$enc')"); } } ?> </center></font> <form name="form1" method="post" action="http://www.republicv.org/site1/job.php?content=app"> <table width="531" height="552" border="0"> <tr> Personal Information: </tr> <tr> <td colspan="2"><div align="left">Name:</div></td> <td colspan="2"><label> <input name="name" type="text" id="name2" value=""> </label></td> <td width="53">Email:</td> <td width="215"><label> <input name="email" type="text" id="email" value=""> </label></td> </tr> <tr> <td width="48"> </td> <td width="56"> </td> <td colspan="2"> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="2">Vatsim ID:</td> <td colspan="2"><label><input name="VATSIM_ID" type="text" id="VATSIM_ID" value=""></label></td> <td>Location:</td> <td><label> <select name="location"> <option value=Afghanistan>Afghanistan</option> (left out the rest) </select> </label></td> </tr> <tr> <td> </td> <td> </td> <td colspan="2"> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="6" bgcolor="#ffffff">Virtual Airline Experiance:</td> </tr> <tr> <td colspan="2">VA Experiance:</td> <td width="1"><label></label></td> <td width="108"><select name="experience"> <option value="Yes">Yes</option> <option value="No">No</option> </select></td> <td>Hours:</td> <td><label> <input type="text" name="hours" /> </label></td> </tr> <tr> <td> </td> <td rowspan="3"> </td> <td colspan="2" rowspan="3"> </td> <td rowspan="3"> </td> <td rowspan="3"> </td> </tr> <tr> <td>Resume:</td> </tr> <tr> <td> </td> </tr> <tr> <td colspan="6"><label> <textarea name="info" cols="40" rows="10" id="info">Include prior Virtual airlines, Talents and why you decided to join the VA</textarea> </label> <p> </p></td> </tr> <tr> <td colspan="6" bgcolor="#ffffff">Republic Virtual Information:</td> </tr> <tr> <td height="39" colspan="2">Desired Hub:</td> <td colspan="4"><label> <select name="hub"> <option value="KPHL">Philadelphia International Airport</option> <option value="KDCA">Ronald Reagon National Airport</option> <option value="KIND">Indianapolis International Airport</option> <option value="KPIT">Pittsburgh International Airport</option> </select> </label></td> </tr> <tr> <td height="18" colspan="2">Desired Password:</td> <td colspan="4"><label> <input name="password" type="password" id="password" value=""> </label></td> </tr> <tr> <td height="18" colspan="2">Validate Password:</td> <td colspan="4"><label> <input name="password1" type="password" id="password" value=""> </label></td> </tr> <tr> <td height="18" colspan="2">Age:</td> <td colspan="4"><label> <select name="age"> <option value="Below 13">-13</option> <option value="Above 13">+13</option> </select> </label></td> </tr> <tr> <td height="20" colspan="2"> </td> <td colspan="4"> </td> </tr> <tr> <td height="20" colspan="2"> </td> <td colspan="4"><label> <input type="submit" name="submit" title="Submit" id="btnLogin" value="Login" class="button" /> </label></td> </tr> </table> </form> </li></ul>
  11. I did all of this and still when I got to output the $_SESSION['name']; it still will not show anything. Here is my code: <?php session_start(); if (($_SESSION[username] != "") && ($_SESSION[password] != "")) { } else { header ('Location: index.php'); } ?> <center>Welcome to Republic Virtual Airways pirep system <? echo $_SESSION['name']; ?>!</center>
  12. Instead of checking the password like you said not too because I do have a area were I only want users so I do a session check. So should I save the user_id into a session and check it as I would as a password? Also I am trying to save the session so that it saves the users name. How would I go about doing this? Cause when I try it wont give out an input.
  13. Is there a way you could give me a code snippet as to include the online so I dont have to use the password or instead of the password should I make it check the user_id? Thank You
  14. I know nothing can be 100% secure but is this some what secure? <? session_start(); header("Cache_control: private"); include 'data.php'; // username and password sent from form $username=$_POST['username']; $password=$_POST['password']; // To protect MySQL injection (more detail about MySQL injection) $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $sql="SELECT * FROM pilots WHERE username='$username' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $username and $password, table row must be 1 row if($count==1){ // Register $username, $password and redirect to file "login_success.php" session_register("username"); session_register("password"); header("location:index.php"); } else { echo "Wrong Username or Password"; } ?> Thank You
  15. Ok I have this $currenttime = time(); $newtime = $signup_date; $timedifference = $newtime - $currenttime; $temptime = floor($timedifference/86400); But this just gives me -14245. I am trying to make it subtract the signup_date to the current date of today. I think this is correct any help would be great!
  16. I have it were when the user sign's up the date is also recorded in a database. How would I make it so that the system checks everyday or a script checks everyday if the userer has filled a "pirep" before 14 days. Say the user joins the 10th and he didnt press send on a form of some sort and it has been 14 days since he joined. How would I make it so it would email that person if he did press send on that form?*NOTE* I know I have been asking many questions over the course of the month and cant give anything back to the community. I am still new at this and I thank you so much!
  17. Now all its doing is subtracteing 5 from 44 everytime it is filed. I only want it when $icao_orig = $lastat. This is my code full: <?php include 'db.php'; $username = mysql_real_escape_string($_POST['username']); $date = mysql_real_escape_string($_POST['date']); $icao_orig = mysql_real_escape_string($_POST['icao_orig']); $icao_dest = mysql_real_escape_string($_POST['icao_dest']); $aircraft = mysql_real_escape_string($_POST['aircraft']); $routenum = mysql_real_escape_string($_POST['routenum']); $dep_time = mysql_real_escape_string($_POST['dep_time']); $flthrs2 = mysql_real_escape_string($_POST['flthrs2']); $comments = mysql_real_escape_string($_POST['comments']); $hub = mysql_real_escape_string($_POST['hub']); $online = mysql_real_escape_string($_POST['online']); $username = stripslashes($username); $date = stripslashes($date); $icao_orig = stripslashes($icao_orig); $icao_dest = stripslashes($icao_dest); $aircraft = stripslashes($aircraft); $routenum = stripslashes($routenum); $dep_time = stripslashes($dep_time); $flthrs2 = stripslashes($flthrs2); $comments = stripslashes($comments); $hub = stripslashes($hub); $online = stripslashes($online); //check for empty fields if((!$date) || (!$icao_orig) || (!$icao_dest) || (!$routenum) || (!$flthrs2)){ echo 'You did not submit a complete pirep! Please be sure all fields are completed. <br />'; // Show the form again! include 'pirep.php'; exit(); } //Double flight time if an event if ($routenum == 'EVT'){ $flthrs2 = $_POST['flthrs2'] * 2; } else {$flthrs2 == $_POST['flthrs2']; } //insert info into pirep table $comments2 = htmlspecialchars($comments); $sql = mysql_query ("INSERT INTO pirep (date, username, icao_orig, icao_dest, aircraft, routenum, dep_time, flthrs2, hub, online, last_pirep, comments) VALUES('$date','$username','$icao_orig','$icao_dest','$aircraft','$routenum','$dep_time','$flthrs2','$hub','$online','now()','$comments')") or die (mysql_error()); if(!$sql){ echo 'There has been an error processing your pirep. Please contact the webmaster.'; } $sql = "SELECT * FROM users WHERE username = '$username'"; $result = mysql_query($sql); $user_array = mysql_fetch_array($result); //add time to flight hours $flthrs = $user_array['flthrs']; $newflthrs = $flthrs + $flthrs2; mysql_query("UPDATE users SET flthrs = '$newflthrs' WHERE username = '$username'"); mysql_query("UPDATE users SET lastat = '$icao_dest' WHERE username = '$username'"); mysql_query("UPDATE users SET book = '' WHERE username = '$username'"); $newacct = $user_array['money'] + ($flthrs2 * 40); If (strcmp($lastat,$icao_orig) != 0) { $newacct -= 5; } mysql_query("UPDATE users SET money = '$newacct' WHERE username = '$username'"); mysql_close($connection); include 'login_success.php'; echo '<script language="JavaScript"> alert("Flight Approved"); </script>'; ?> Once again I know I am not to good at this and just still learning.
  18. Ok now another problem has come up. Now it just keeps subtracting 5 everytime I file a "pirep". Once again thank you for your time! $pay = $flthrs2 * 40; $money = $user_array['money']; $newacct = $money + $pay; mysql_query("UPDATE users SET money = '$newacct' WHERE username = '$username'"); If ($lastat != $icao_orig) { $sub = 5; $money = $user_array['money']; $newmoney = $money - $sub; mysql_query("UPDATE users SET money = '$newmoney' WHERE username = '$username'"); }
  19. Ok I have done this but when this happens it changes to -5 in the database. I dont want that I want it to subtract 5 from the exisiting number. I think this code is 100% correct could you clarify? If ($lastat != $icao_orig) { $sub = 5; $money = $user_array['money']; $newmoney = $money - $sub; mysql_query("UPDATE users SET money = '$newmoney' WHERE username = '$username'"); }
  20. I am trying to make it were if lastat equals the icao_orig than do nothing but if lastat dosnt equal icao_orig than - 5 from the money table. I thank you for your time. if ($lastat == $_POST['icao_orig']){ } if ($lastat == $_POST['NULL']){ $money - 5 } else { }
  21. It works but it shows the table twice is there anyway to make it not show twice?
  22. My code is: <? include 'db.php' ?> <?php // coonnect to database if (isset($_GET['id'])) { $sql = "SELECT date FROM pirep WHERE username='{$_GET['id']}' LIMIT 0,5"; if ($result = mysql_query($sql)) { $row = mysql_fetch_assoc($result); } else { echo "query failed ".mysql_error(); } } else { echo "No User Selected"; } ?> <br> <h1 align="center">Logged Flights</h1> <table border="0" cellpadding="5" cellspacing="0" align="center" style="font-size: 9pt; border: solid 1px"> <tr bgcolor="#b5d0e5"> <th bgcolor="#666666"><font color="#FFFFFF">Date</font></th> <th bgcolor="#006699"><font color="#FFFFFF">Departure</font></th> <th bgcolor="#666666"><font color="#FFFFFF">Arrival</font></th> <th bgcolor="#006699"><font color="#FFFFFF">Aircraft</font></th> <th bgcolor="#666666"><font color="#FFFFFF">Time</font></th> <th bgcolor="#006699"><font color="#FFFFFF">Comments</font></th> </tr> <tr> <td align="center"><?echo $row['date']; ?></td> <td align="center" height="11"><?echo $row['icao_orig']; ?></td> <td align="center" height="11"><?echo $icao_dest; ?></td> <td align="center" height="11"><?echo $aircraft; ?></td> <td align="center" height="11"><?echo $flthrs2; ?></td> <td align="center" height="11"><?echo $comments; ?></td> </tr> </table> But it only show's one not three, am I doing something wrong?
  23. Is there something like an AND OR statement. So say if only one part of the form was filled out than show the results of what was typed in. But if they enter both feilds in the form it will show the ony result. I am trying to make a search basicly so if they enter something it will show them were they could go. If you understand great if not Thank You
×
×
  • 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.