Frezi2005

TicketGenerator

May 2nd, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. <html>
  2. <head>
  3. <link href="style.css" rel="stylesheet">
  4. <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  5. </head>
  6. </html>
  7.  
  8. <?php
  9. // require the Faker autoloader
  10. require_once 'vendor/fzaninotto/faker/src/autoload.php';
  11. // alternatively, use another PSR-4 compliant autoloader
  12.  
  13. // use the factory to create a Faker\Generator instance
  14. $faker = Faker\Factory::create();
  15. $date = new DateTime('now');
  16. $now = $date->format('Y-m-d H:i:s');
  17. $departure = $faker->date;
  18. //$arrival = $departure + 6;
  19. $price = rand(100, 4000);
  20. //$flightTime = $faker->dateTimeBetween($startDate = '$departure', $endDate = '$arrival', $timezone = null);
  21. $list = file_get_contents("airports.json");
  22. $airportsList = json_decode($list, true);
  23. $randCity = rand(0, count($airportsList) - 1);
  24. var_dump($airportsList[$randCity]);
  25.  
  26. function planeTicketGenerator($faker, $now, $price) {
  27. echo <<<END
  28. <table>
  29. <tr style="background-color: #a8d8ff">
  30. <td colspan="3" style="text-align:left;">TICKETS IN REAL PRICE</td>
  31. </tr>
  32. <tr>
  33. <td style="width:200px;"></td>
  34. <td><img src="BoeingLogo.png" alt="BoeingLogo" style="width:200px;"/></td>
  35. <td><img src="AirPlaneLogo.png" alt="AirPlaneLogo" style="width:200px;"/></td>
  36. </tr>
  37. <tr style="height:50px;background-color: #93cfff;">
  38. <td>From: $faker->city</td>
  39. <td>To: $faker->city</td>
  40. <td></td>
  41. </tr>
  42. <tr style="background-color: #93cfff;">
  43. <td>XXX</td>
  44. <td>XXX</td>
  45. <td>XXX</td>
  46. </tr>
  47. <tr style="background-color: #93cfff;">
  48. <td colspan="2">Departure: $faker->date</td>
  49. <td>Price: $price $faker->currencyCode</td>
  50. </tr>
  51. <tr>
  52. <td>Flight with the airline: Ryanair</td>
  53. <td colspan="2">Passenger surname: $faker->firstName $faker->lastName</td>
  54. </tr>
  55. </table>
  56. END;
  57. }
  58.  
  59. planeTicketGenerator($faker, $now, $price);
  60.  
  61. // $now
  62. // <br />
  63. // From: $faker->city To: $faker->city
  64. // <br />
  65. // Departure: $faker->date Arrival: $faker->date
  66. // <br />
  67. // Name: $faker->firstName Surname: $faker->lastName
  68. // <br />
  69. // Adress: $faker->streetAddress
  70. // <br />
  71. // Price: $price
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment