Commit 71111947 by Ryo

Uploaded php_files folder

parent a702f4a6
<?php
#echo "Insert new user";
// connect to the database
//$con = mysqli_connect(localhost,root, root, Airline_Booking, 8889);
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//$data = mysqli_query($con, "SELECT Passenger_Id FROM Passenger_Profile WHERE First_Name = '$First_Name' AND Last_Name = '$Last_Name' AND Flight_Number = '$Flight_Number'");
$data = mysqli_query($con, "SELECT Profile_Id FROM Passenger_Profile WHERE First_Name = '$First_Name' AND Last_Name = '$Last_Name'");
//And display the results
while($row = mysqli_fetch_array( $data )) {
// echo "$row[0]". " ";
// echo "<br>";
$Profile_Id = $row[0];
echo $Profile_Id;
}
$data2 = mysqli_query($con, "SELECT Flight_Id FROM FlightData WHERE Flight_Number = '$Flight_Number'");
while($row2 = mysqli_fetch_array( $data2 )) {
// echo "$row[0]". " ";
// echo "<br>";
$Flight_Id = $row2[0];
echo $Flight_Id;
}
//And display the results
// while($row = mysqli_fetch_array( $data )) {
// echo "$row[0]". " ";
// echo "<br>";
//
// }
//This counts the number or results. If there aren't any, it gives the user a "no match" message
$anymatches=mysqli_num_rows($data);
if ($anymatches == 0) {
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
//And reminds the user what they searched for
// echo "<b>Searched For:</b> " . "$find";
// }
//break;
//
// if (isset($_GET['Passenger_Id#
// '])) {
//
// $Passenger_Id = $_GET['Passenger_Id'];
// echo $Passenger_Id;
// }
echo "Your input:::::::::<br>";
echo "".$First_Name. "<br>";
echo "".$Last_Name. "<br>";
echo "".$Flight_Number. "<br>";
$data4 = mysqli_query($con, "DELETE FROM Ticket_Info WHERE Profile_Id = '$Profile_Id' AND Flight_Id = '$Flight_Id'");
if (mysqli_query($con, $data4)) {
echo "Record deleted successfully";
}
else {
echo "Error deleting record: " . mysqli_error($con);
}
//sql to delete a record
$data3 = mysqli_query($con, "DELETE FROM Passenger_Profile WHERE Profile_Id = '$Profile_Id'");
if (mysqli_query($con, $data3)) {
echo "Record deleted successfully";
}
else {
echo "Error deleting record: " . mysqli_error($con);
}
// mysqli_query($con, "DELETE FROM Ticket_Info WHERE Passenger_fk = $row[0]");
// printf("Affected rows (DELETE): %d\n", mysqli_affected_rows($con));
// if (mysqli_query($con, $data)) {
// echo "Record deleted successfully";
// } else {
// echo "Error deleting record: " . mysqli_error($con);
// }
mysqli_close($con);
?>
<?php
#echo "Insert new user";
// connect to the database
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$Departure = strtoupper($_POST['Departure']);
$Arrival = strtoupper($_POST['Arrival']);
$data = mysqli_query($con, "INSERT INTO FlightData (Airline, Flight_Number, Departure, Arrival,
Departure_Time, Arrival_Time, Flight_Time, Morning_AfterNoon_Night, Price)
VALUES ('$Airline', '$Flight_Number', '$Departure', '$Arrival', '$Departure_Time', '$Arrival_Time',
'$Flight_Time', '$Morning_AfterNoon_Night', '$Price')");
mysqli_close($con);
?>
<?php
//This is only displayed if the user submitted the form
if (isset($_POST['flight_search'])){
echo "<h2>Results</h2><p>";
//If the user did not enter a search term, they receive an error
if ($_POST['departure'] and $_POST['arrival']== ""){
echo "<p>Please enter a search term";
exit;
}
// Otherwise we connect to the database
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$departure = ($_POST["departure"]);
$arrival = ($_POST["arrival"]);
$date_going = ($_POST["trip_going"]);
$date_back = ($_POST["trip_back"]);
}
//echo "$departure";
//echo "$arrival";
//Now we search for our search term, in the field the user specified
//if Morning_AfterNoon_Night = Morning
//$data = mysqli_query($con, "SELECT * FROM FlightData WHERE departure = '$departure' AND arrival = '$arrival'");
$int = 0;
foreach ($_POST['check_list'] as $select){
if ($int > 0){
$filter = $filter . " or Morning_AfterNoon_Night ='" . $select . "'" ;
}
else {
$filter = " and Morning_AfterNoon_Night ='" . $select . "'" ;
}
$int = $int + 1;
}
//$a = $a . ")";
if(isset($_POST['radio'])){
echo "You have selected :".$_POST['radio'];
}
if ($_POST['radio'] === 'htolcost'){
$order = " ORDER BY Price DESC" ;
}
else {
$order = " ORDER BY Price" ;
}
//echo "SELECT * FROM FlightData WHERE departure = '$departure' AND arrival = '$arrival' " . "$a";
//$data = mysqli_query($con, "SELECT * FROM FlightData WHERE departure = '$departure' AND arrival = '$arrival'");
$data = mysqli_query($con, "SELECT * FROM FlightData WHERE departure = '$departure' AND arrival = '$arrival' " . "$filter" . "$order");
//And display the results
while($row = mysqli_fetch_array( $data )){
echo "$row[1]". " " ."$row[2]". " " . "$row[3]". " " . "$row[4]". " " . "$row[5]". " " . "$row[6]". " " . "$row[7]". " " . "$row[8]". " " . "$row[9]" . " " . "$date_going". " " . "$date_back". " " ."<a href='loginform2.php?Flight_Id=$row[0]' >". "SELECT" ."</a>";
echo "<br>";
}
//This counts the number or results. If there aren't any, it gives the user a "no match" message
$anymatches=mysqli_num_rows($data);
if ($anymatches == 0){
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
//And reminds the user what they searched for
echo "<b>Searched For:</b> " . "$find";
}
//break;
if (isset($_GET['Flight_Id#'])) {
$Flight_Id = $_GET['Flight_Id'];
echo $Flight_Id;
}
?>
<?php
if(isset($_POST['submit'])){
$selected_val = $_POST['Subject']; // Storing Selected Value In Variable
echo "You have selected :" .$selected_val; // Displaying Selected Value
}
?>
<?php
// connect to the database
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$data = mysqli_query($con, "INSERT INTO Contact (Contact_Name, Email, Subject, Message)
VALUES ('$Contact_Name', '$Email', '$Subject', '$Message')");
mysqli_close($con);
echo "Your input:::::::::<br>";
echo "".$Contact_Name. "<br>";
echo "".$Email. "<br>";
echo "".$Subject. "<br>";
echo "".$Message. "<br>";
?>
<?php
session_start(); // Starting Session
$error=''; // Variable To Store Error Message
if (isset($_POST['submit'])) {
if (empty($_POST['username']) || empty($_POST['password'])) {
$error = "username or password is invalid";
}
else
{
// Define $username and $password
$username=$_POST['username'];
$password=$_POST['password'];
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// To protect MySQL injection for Security purpose
$username = stripslashes($username);
$password = stripslashes($password);
//$username = mysqli_real_escape_string($username);
//$password = mysqli_real_escape_string($password);
// Selecting Database
$db = mysqli_select_db($con, "Airline_Booking");
// SQL query to fetch information of registerd users and finds user match.
$query = mysqli_query($con, "SELECT username and password FROM User_register WHERE username='$username' AND password='$password'");
$rows = mysqli_num_rows($query);
if ($rows == 1) {
$_SESSION['login_user']=$username; // Initializing Session
header("location: payment1.php"); // Redirecting To Other Page
} else {
$error = ":::username or password is invalid";
}
mysqli_close($con); // Closing Connection
}
}
?>
<?php
session_start(); // Starting Session
$error=''; // Variable To Store Error Message
if (isset($_POST['submit'])) {
if (empty($_POST['username']) || empty($_POST['password'])) {
$error = "username or password is invalid";
}
else
{
// Define $username and $password
$username=$_POST['username'];
$password=$_POST['password'];
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// To protect MySQL injection for Security purpose
$username = stripslashes($username);
$password = stripslashes($password);
//$username = mysqli_real_escape_string($username);
//$password = mysqli_real_escape_string($password);
// Selecting Database
$db = mysqli_select_db($con, "Airline_Booking");
// SQL query to fetch information of registerd users and finds user match.
$query = mysqli_query($con, "SELECT username and password FROM Admin WHERE username='$username' AND password='$password'");
$rows = mysqli_num_rows($query);
if ($rows == 1) {
$_SESSION['login_user']=$username; // Initializing Session
header("location: admin_place.php"); // Redirecting To Other Page
} else {
$error = ":::username or password is invalid";
}
mysqli_close($con); // Closing Connection
}
}
?>
<?php
// $con = mysqli_connect(localhost,root, root, Airline_Booking, 8889);
//
// // Check connection
// if (mysqli_connect_errno()){
// echo "Failed to connect to MySQL: " . mysqli_connect_error();
// }
//
// if ($_SERVER["REQUEST_METHOD"] == "POST") {
// $username = ($_POST["username"]);
// $password = ($_POST["password"]);
// }
//
// $data = mysqli_query($con, "SELECT MemberID FROM User_register WHERE username = '$username' AND password = '$password' ");
// MemberID = $row[0]
// if (isset($_GET['MemberID'])) {
// $MemberID = $_GET['MemberID'];
// echo $MemberID;
// }
// session_start();
// if (isset($_GET['MemberID'])) {
// $MemberID = $_GET['MemberID'];
// $_SESSION['MemberID'] = $MemberID;
// }
session_start();
if (isset($_POST['username'])) {
$username_value = $_POST['username'];
$_SESSION['username'] = $username_value;
}
session_start();
if (isset($_POST['password'])) {
$password_value = $_POST['password'];
$_SESSION['password'] = $password_value;
}
$var_value = $_GET['Flight_Id'];
echo "Your flight ID is ".$var_value."." ;
session_start();
if (isset($_GET['Flight_Id'])) {
$Flight_Id = $_GET['Flight_Id'];
$_SESSION['Flight_Id'] = $Flight_Id;
}
?>
<?php
// Otherwise we connect to the database
$con1 = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$flight_data = mysqli_query($con1, "SELECT * FROM FlightData WHERE Flight_Id = '$Flight_Id' ");
//And display the results
while($row = mysqli_fetch_array( $flight_data )) {
echo "$row[1]". " | " ."$row[2]". " | " . "$row[3]". " | " . "$row[4]". " | " . "$row[5]". " | " . "$row[6]". " | " . "$row[7]". " | " . "$row[8]". " | " . "$row[9]" . " ";
echo "<br>";
}
$anymatches=mysqli_num_rows($flight_data);
if ($anymatches == 0){
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
mysqli_close($con1);
?>
<br>
<input type="submit" name="submit" value="Submit" />
</form>
<?php
#echo "Insert new user";
// connect to the database
// mysql_connect('localhost', 'root', 'root') or die(mysql_error());
// mysql_select_db("Airline_Booking") or die(mysql_error());
//
// $data1 = mysql_query("INSERT INTO Passenger_Profile (First_Name, Last_Name, Email_Address, Card_Type, Card_Number, Security_Code, Expiration_Month_Year,
// Passport_Number, Phone_Number, Home_Address)
// VALUES ('$First_Name', '$Last_Name', '$Email_Address', '$Card_Type', '$Card_Number', '$Security_Code','$Expiration_Month_Year', '$Passport_Number', '$Phone_Number', '$Home_Address')");
// $data2 = mysql_query("INSERT INTO Payment_Details (First_Name, Last_Name, Card_Type, Card_Number, Security_Code, Expiration_Month_Year)
// VALUES ('$First_Name', '$Last_Name', '$Card_Type', '$Card_Number', '$Security_Code','$Expiration_Month_Year')");
//mysql_query($sql1, $con);
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// $Departure = strtoupper($_POST['Departure']);
// $Arrival = strtoupper($_POST['Arrival']);
// $data = mysqli_query($con, "INSERT INTO Passenger_Profile (First_Name, Last_Name, Email_Address, Card_Type, Card_Number, Security_Code, Expiration_Month_Year, Passport_Number, Phone_Number, Home_Address) VALUES ('$First_Name', '$Last_Name', '$Email_Address', '$Card_Type', '$Card_Number', '$Security_Code', '$Expiration_Month_Year', '$Passport_Number', '$Phone_Number', '$Home_Address')");
//Returning the id that was inserted
// $last_id = mysqli_insert_id($con);
// $data_2 = mysqli_query($con, "INSERT INTO Ticket_Info (Profile_Id, Flight_Id, First_Name, Last_Name)
// VALUES ('$last_id', '$Flight_Id', '$First_Name', '$Last_Name', '$Email_Address')");
$data1 = mysqli_query($con, "INSERT INTO Passenger_Profile (First_Name, Last_Name, Email_Address, Card_Type,
Card_Number, Security_Code, Expiration_Month_Year, Passport_Number, Phone_Number, Home_Address)
VALUES ('$First_Name', '$Last_Name', '$Email_Address', '$Card_Type', '$Card_Number', '$Security_Code',
'$Expiration_Month_Year', '$Passport_Number', '$Phone_Number', '$Home_Address')");
// $data3 = mysqli_query($con, "INSERT INTO Ticket_Info (Flight_Number, Date_Going, Date_Back)
// VALUES ('$Flight_Number', '$Date_Going', '$Date_Back')");
//Returning the id that was inserted
$last_id = mysqli_insert_id($con);
$data2 = mysqli_query($con, "INSERT INTO Ticket_Info (Profile_Id, Flight_Id, First_Name, Last_Name)
VALUES ('$last_id', '$Flight_Id', '$First_Name', '$Last_Name')");
echo $last_id;
mysqli_close($con);
echo "Your input:::::::::<br>";
echo "".$First_Name. "<br>";
echo "".$Last_Name. "<br>";
echo "".$Email_Address. "<br>";
echo "".$Card_Type. "<br>";
echo "".$Card_Number. "<br>";
echo "".$Security_Code. "<br>";
echo "::::".$Expiration_Month_Year. "<br>";
echo "".$Passport_Number. "<br>";
echo "".$Phone_Number. "<br>";
echo "".$Home_Address. "<br>";
echo "".$last_id. "<br>";
?>
<?php
//This is only displayed if the user submitted the form
if (isset($_POST['flight_search'])){
echo "<h2>Results</h2><p>";
//If the user did not enter a search term, they receive an error
if ($_POST['Subject'] == ""){
echo "<p>Please select a subject";
exit;
}
// Otherwise we connect to the database
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$Subject = ($_POST["Subject"]);
}
$data = mysqli_query($con, "SELECT * FROM Contact WHERE Subject = '$Subject'");
//And display the results
while($row = mysqli_fetch_array( $data )) {
echo "$row[1]". " " ."$row[2]". " " . "$row[3]". " " . "$row[4]". " ";
echo "<br>";
}
//This counts the number or results. If there aren't any, it gives the user a "no match" message
$anymatches=mysqli_num_rows($data);
if ($anymatches == 0) {
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
//And reminds the user what they searched for
echo "<b>Searched For:</b> " . "$find";
}
//break;
if (isset($_GET['Flight_Id#'])) {
$Flight_Id = $_GET['Flight_Id'];
echo $Flight_Id;
}
?>
<?php
#echo "Insert new user";
// connect to the database
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$data = mysqli_query($con, "INSERT INTO User_register (First_Name, Last_Name, username, Password)
VALUES ('$First_Name', '$Last_Name', '$username', '$Password')");
//mysql_query($sql1, $con);
mysqli_close($con);
echo "Your input:::::::::<br>";
echo "".$First_Name. "<br>";
echo "".$Last_Name. "<br>";
echo "".$username. "<br>";
echo "".$Password. "<br>";
?>
<?php
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$firstName = ($_POST["firstName"]);
$lastName = ($_POST["lastName"]);
$email = ($_POST["email"]);
}
$data = mysqli_query($con, "SELECT * FROM Passenger_Profile WHERE First_Name = '$firstName' AND Last_Name = '$lastName' AND Email_Address = '$email' ");
$record = array();
//And display the results
while ($row = mysqli_fetch_array( $data )) {
//echo "$row[1]". " " ."$row[2]". " " . "$row[3]". " " . "$row[4]". " ";
$record[] = $row;
foreach ($record as $rec) {
//echo $rec['Profile_Id'];
$data1 = mysqli_query($con, "SELECT * FROM Ticket_Info WHERE Profile_Id = '$rec[Profile_Id]'");
$record1 = array();
while ($row1 = mysqli_fetch_array( $data1 )) {
//echo $row1[Flight_Id];
$record1[] = $row1;
foreach ($record1 as $rec1) {
//echo $rec[Flight_Id]."<br>";
$data2 = mysqli_query($con, "SELECT * FROM FlightData WHERE Flight_Id = '$rec1[Flight_Id]'");
$record2 = array();
while ($row2 = mysqli_fetch_array( $data2 )) {
$record2[] = $row2;
foreach ($record2 as $rec2) {
//echo $rec2[Airline];
echo $rec2['Airline'] . " | " . $rec2['Flight_Number'] . " | " . $rec2['Departure'] . " | " . $rec2['Arrival'] . " | " . $rec2['Departure_Time'] . " | " . $rec2['Arrival_Time'];
echo "<br>";
}
}
}
}
}
}
//$data1 = mysqli_query($con, "SELECT * FROM Ticket_Info WHERE Profile_Id = '$ID'");
// while($row1 = mysqli_fetch_array( $data1 )) {
//echo "$row[1]". " " ."$row[2]". " " . "$row[3]". " " . "$row[4]". " ";
// $ID1 = $row1[2];
// $data2 = mysqli_query($con, "SELECT * FROM FlightData WHERE Flight_Id = '$ID1'");
// if($row2 = mysqli_fetch_array( $data2 )) {
//echo "$row[1]". " " ."$row[2]". " " . "$row[3]". " " . "$row[4]". " ";
//$data1 = mysqli_query($con, "SELECT * FROM Ticket_Info WHERE Profile_Id = '$ID'");
// while($row1 = mysqli_fetch_array( $data1 )) {
// //echo "$row[1]". " " ."$row[2]". " " . "$row[3]". " " . "$row[4]". " ";
// $ID1 = $row1[2];
//
// $data2 = mysqli_query($con, "SELECT * FROM FlightData WHERE Flight_Id = '$ID1'");
// if($row2 = mysqli_fetch_array( $data2 )) {
// echo "$row[1]". " " ."$row[2]". " " . "$row[3]". " " . "$row[4]". " ";
// }
//This counts the number or results. If there aren't any, it gives the user a "no match" message
$anymatches=mysqli_num_rows($data);
if ($anymatches == 0) {
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
//And reminds the user what they searched for
echo "<b>Searched For:</b> " . "$find";
?>
<?php
#echo "Insert new user";
// connect to the database
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$con = mysqli_connect("anysql.itcollege.ee", "WT16", "iLtQlUerkT", "WT16");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$data = mysqli_query($con, "INSERT INTO User_register (First_Name, Last_Name, username, Password)
VALUES ('$First_Name', '$Last_Name', '$username', '$Password')");
//mysql_query($sql1, $con);
mysqli_close($con);
echo "Your input:::::::::<br>";
echo "".$First_Name. "<br>";
echo "".$Last_Name. "<br>";
echo "".$username. "<br>";
echo "".$Password. "<br>";
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment