Menu

#4 Travel.php done and done

open-accepted
nobody
None
1
2015-01-27
2003-10-06
No

I have made the complete travel.php, a very complex
file. It has many options. Just read through the script,
the are a couple database add-ons such as tickets and
whatnot. As well it is my file, so things like jail.php do
not apply to you, or the subscriber option. Edit what
you don't want :) And have fun.

<?php $title="Travel Agency"; include("header.php"); ?>
<?php include("jail.php"); ?>
<?php $ticket = mysql_fetch_array(mysql_query("select
* from travel where id='1'")); ?>
<?php print "Welcome to the travel agency, here you
are able to purchase flight tickets to travel to Imperium
city. The flight ticket prices change constantly, so
knowing when to buy them is a key factor."; ?>
<?php if ($stat[sub] <=0) {
print "<br><br>Unfortunatly, you must be a <a
href=sub.php>subscriber</a> to use the terminal.";
include("footer.php");
exit;
} ?>
<?php print "<br><br>You look around the travel
terminal, really confused...then again, you don't even
know where you are.<ul>
<li><a href=travel.php?
help=scalpers>Scalpers</a>
<li><a href=travel.php?help=ticket>Sales
office</a>
<li><a href=travel.php?help=board>Board
Ship</a>
<li><a href=travel.php?help=man>Old
man</a></ul>";
if ($help == man) {
print "-Back in the day when I was a young
feller, we used to hop on top of the ships, and catch a
free ride. Nowadays, you've got to pay for
everything.<br><br>-Orion is totally under-funded...The
sales office only has 5 tickets available per day. And the
scalpers, well they charge way to much.<br><br>-Listen
here son, if you want to travel a lot, I suggest going to
the university of Orion and studying <a
href=un.php>Forgery</a>. The art of printing fake
tickets will certainly make you a wealthy man, that is if
you've got the devotion to learn the skill.";
} elseif ($help == ticket) {
print "Welcome to the sales office sir. We
currently have $ticket[tickets] tickets left for today,
and each one costing $ticket[cost] credits per round
trip fare. Would you like to <a href=travel.php?
help=buy1>buy</a> one?";
} elseif ($help == buy1) {
if ($stat[credits] < $ticket[cost]) {
print "<br><br>I'm
sorry sir, but you do not have enough credits to
purchase a ticket.";
include("footer.php");
exit;
}
if ($ticket[tickets] == 0) {

print "<br><br>Sorry sir, but we're all sold out
of tickets. Try again tommorow.";
include("footer.php");
exit;
}
print "You purchased 1 round trip fare to Imperium for
$ticket[cost].";
mysql_query("update players set credits=credits-$ticket
[cost] where id=$stat[id]");
mysql_query("update players set tickets=tickets+1
where id=$stat[id]");
mysql_query("update travel set tickets=tickets-1 where
id='1'");
} elseif ($help == scalpers) {
print "<br>Hey buddy, care to buy some
tickets? I've got hundreds of tickets, each one going for
950 credits. Would you like to <a href=travel.php?
help=buyscalper>buy</a> one?";
} elseif ($help == buyscalper) {
if ($stat[credits] < 950) {
print "<br>Get
lost, you don't have enough credits.";
include("footer.php");
exit;
}
mysql_query("update players set tickets=tickets+1
where id=$stat[id]");
mysql_query("update players set credits=credits-950
where id=$stat[id]");
print "There's your ticket, have a safe ride.";
} elseif ($help == board) {
if ($stat[tickets] == 0) {
print "<br>With
one swift tap on the shoulder, the train operator asks
you to leave. See, you'll need a ticket to board a ship.";
include("footer.php");
exit;
}
mysql_query("update players set city='1' where id=$stat
[id]");
mysql_query("update players set tickets=tickets-1
where id=$stat[id]");
print "All aboard! You quickly run in the ship just before
it leaves. You sit back, and enjoy your flight.";
}
include("footer.php");
?>

Discussion

  • Liam Bull

    Liam Bull - 2003-10-07

    Logged In: YES
    user_id=851002

    looks good, ill give it a run when i get home from work, thanks

     
  • Nobody/Anonymous

    Logged In: NO

    I need SQL tables plzzzz

     
  • Matt Evans

    Matt Evans - 2003-10-29
    • priority: 5 --> 1
    • status: open --> open-accepted
     
  • Nobody/Anonymous

    Logged In: NO

     
  • Backstab

    Backstab - 2005-08-12

    Logged In: YES
    user_id=1060455

    HUH?

     
  • Nobody/Anonymous

    Logged In: NO

    Is there another copy of this? One that isnt messed up by
    formating?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.