login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Missions

Offline bozmafia - 05/03/2006 23:10 (laatste wijziging 05/03/2006 23:23)
Avatar van bozmafiaPHP interesse Goedenavond mensen,

Ik zou graag weten wat er mis was met mijn script.. hij geeft een fout aan, waarvan ik niet weet wat het precies is.. ik hoop dat jullie ff kunnen helpen.. het script ziet er als volgt uit:

  1. <CENTER>
  2. <TABLE width=450>
  3. ENDHTML;
  4.  
  5. if($user['mission'] == 1){
  6. print <<<ENDHTML
  7. <form action="<?=$_SERVER['PHP_SELF']; ?>?item=mission" method="POST">
  8. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0 width=80%>
  9. <th class="title" colspan="2">Mission #1</th>
  10. <tr><td>Mission:</td><td>Running man</td></tr>
  11. <tr><td>Story:</td><td>Your brother wants to do a big organized crime, but he is unable to find a good car. Steal a car for him and he will pay you very good.</td></tr>
  12. <tr><td>Task:</td><td>You need to steal car FROM <b>Netherlands</b> with a value of $25,000 and ship it to <b>Italy</b>. When you are there, click the 'Check mission' button.</td></tr>
  13. <tr><td>Time limit:</td><td>No limit</td></tr>
  14. <tr><td>Reward:</td><td><b>$150,000</b> and <b>1000</b> bullets.</td></tr>
  15. <tr><td colspan=2 align=center><input type="submit" class="submit" value="Check Mission" name="check"></td></tr>
  16. </table>
  17. </form>
  18. ENDHTML;
  19. } elseif($user['mission'] == 2){
  20. print <<<ENDHTML
  21. <form action="<?=$_SERVER['PHP_SELF']; ?>?item=mission" method="POST">
  22. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0 width=80%>
  23. <th class="title" colspan="2">Mission #2</th>
  24. <tr><td>Mission:</td><td>ThaLegend's Realname</td></tr>
  25. <tr><td>Story:</td><td>ThaLegend forgot his real name, now you have to help him out to find out.</td></tr>
  26. <tr><td>Task:</td><td>Help ThaLegend by filling in his real name over here.</td></tr>
  27. <tr><td>Time limit:</td><td>No limit</td></tr>
  28. <tr><td>Reward:</td><td><b>$100,000</b> and <b>1500</b> bullets.</td></tr>
  29. <tr><td><input type="text" name="realname" maxlength"16"></td></tr>
  30. <tr><td colspan=2 align=center><input type="submit" class="submit" value="Complete Mission" name="doit"></td></tr>
  31. </table>
  32. </form>
  33. ENDHTML;
  34.  
  35. } else {
  36. print <<<ENDHTML
  37. <form action="<?=$_SERVER['PHP_SELF']; ?>?item=mission" method="POST">
  38. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0 width=80%>
  39. <th class="title" colspan="2">Mission #3</th>
  40. <tr><td>Mission:</td><td>Running man</td></tr>
  41. <tr><td>Story:</td><td>test</td></tr>
  42. <tr><td>Task:</td><td>You need to steal car FROM <b>Netherlands</b> with a value of $25,000 and ship it to <b>Italy</b>. When you are there, click the 'Check mission' button.</td></tr>
  43. <tr><td>Time limit:</td><td>No limit</td></tr>
  44. <tr><td>Reward:</td><td><b>$test</b> and <b>test</b> bullets.</td></tr>
  45. <tr><td colspan=2 align=center><input type="submit" class="submit" value="Check Mission" name="check"></td></tr>
  46. </table>
  47. </form>
  48. ENDHTML;
  49. }
  50. /* ------------------------- */ ?>
  51. <?PHP
  52. if(isset($_POST['check'])){
  53. $query = "SELECT * FROM `garage` WHERE `owner` = '".$user['username']."' AND `original` = 'Netherlands' AND `country` = 'Italy'";
  54. $query = mysql_query($query);
  55. $car = mysql_fetch_object($query);
  56. if($car->value < 25000){
  57. echo "The value of the car is too low.";
  58. }
  59. else{
  60. $nmoney = $user['money'] + 150000;
  61. $nmission = 2;
  62. $nbullets = $user['bullets'] + 1000;
  63. $nexperience = $user['experience'] + 500;
  64. $query = "UPDATE `users` SET `bullets` = '".$nbullets."', `money` = '".$nmoney."', `mission` = '".$nmission."', `experience` = '".$nexperience."' WHERE `id` = '".$user['id']."'";
  65. mysql_query($query) or die(mysql_error());
  66.  
  67. $msg = "You succesfully completed the <b>Running Man</b> mission. You got <b>$150,000</b> and <b>1000</b> bullets.";
  68. $query = "INSERT INTO `messages` (`from`,`to`,`date`,`message`,`read`,`saved`) VALUES ('Notification','".$user['username']."','".date("d/m/Y H:i:s")."','".$msg."','0','0')";
  69. mysql_query($query) or die(mysql_error());
  70.  
  71. $query = "DELETE FROM `garage` WHERE `id` = '".$car->id."'";
  72. mysql_query($query) or die(mysql_error());
  73.  
  74. echo "You completed the mission.";
  75. }
  76. }
  77. ?>
  78. <?PHP
  79. elseif (isset($_POST['doit'])){
  80.  
  81. /* Verander hieronder de naam van de admin(bij admin) */
  82.  
  83. if ($_POST['realname'] == "Jan"){
  84. mysql_query("UPDATE `users` SET `money`=`money`+'100000' WHERE `id` = '".$user['id']."'";
  85. mysql_query("UPDATE `users` SET `bullets`=`bullets`+'1500' WHERE `id` = '".$user['id']."'";
  86. echo "You completed the mission.";
  87. } else {
  88. echo "Wrong answer. Keep trying!";
  89. }
  90. }
  91. ?>


EDIT: dit is de fout:

Parse error: syntax error, unexpected T_ELSEIF in /home/kk4857/domains/loyaltyrecords.nl/public_html/eng/mission.php on line 79

~Bedankt..

8 antwoorden

Gesponsorde links
Offline Ultimatum - 05/03/2006 23:18
Avatar van Ultimatum PHP expert 1. ga eens tutorials lezen voordat je het hele forum onder spamt
2. zet code tussen [code] tags
3. misschien makkelijk als je verteld welke fout
4. geen idee komt nog wel...
Offline bozmafia - 05/03/2006 23:22
Avatar van bozmafia PHP interesse Dit is de fout:

Parse error: syntax error, unexpected T_ELSEIF in /home/kk4857/domains/loyaltyrecords.nl/public_html/eng/mission.php on line 79
Offline nathanael - 05/03/2006 23:56
Avatar van nathanael Gouden medaille

HTML gevorderde
je gebruikt een elseif() terwijl je gewoon de else() kan gebruiken want je gebruikt later bij de allereerste if() helemaal geen else()

dus kan je die elseif helemaal niet gebruiken en moet je dus else gebruiken

snappie;-)
Offline haytjes - 05/03/2006 23:57 (laatste wijziging 05/03/2006 23:58)
Avatar van haytjes Gouden medailleGouden medaille

JS gevorderde
  1. <?
  2. ...
  3. //r75
  4. echo "You completed the mission.";
  5. }
  6. }
  7. } // je sloot je {} 1 keer te weinig
  8. ?>
  9. <?PHP
  10. elseif (isset($_POST['doit'])){
  11.  
  12. /* Verander hieronder de naam van de admin(bij admin) */
  13. ...
  14. ?>
Offline Wijnand - 06/03/2006 11:35 (laatste wijziging 06/03/2006 11:38)
Avatar van Wijnand Moderator Nope, haytjes, dat is niet zo. Hij heeft genoeg haakjes.

Wat wel de fout is naar mijn mening:

  1. mysql_query("UPDATE `users` SET `money`=`money`+'100000' WHERE `id` = '".$user['id']."'";
  2. mysql_query("UPDATE `users` SET `bullets`=`bullets`+'1500' WHERE `id` = '".$user['id']."'";


Hier ben je vergeten de rondehaakjes ( ) << deze dus ) af te sluiten.

  1. mysql_query("UPDATE `users` SET `money`=`money`+'100000' WHERE `id` = '".$user['id']."'") or die (mysql_error());
  2. mysql_query("UPDATE `users` SET `bullets`=`bullets`+'1500' WHERE `id` = '".$user['id']."'") or die (mysql_error());


Zoiets?!?
Offline timo - 06/03/2006 12:29
Avatar van timo PHP ver gevorderde waarom ?><?PHP
dat kan je oowk gwn weglaten...
Offline bozmafia - 06/03/2006 18:38
Avatar van bozmafia PHP interesse Goedenmiddag mensen, ik heb een script gemaakt: missies.. alleen nu werkt hij nog niet correct, en wil ik jullie vragen om mij te helpen hiermee.. alvast bedankt.. het script ziet er als volgt uit:

  1. <CENTER>
  2. <TABLE width=450>
  3.  
  4. <?PHP
  5. if($user['mission'] == 1){
  6.  
  7. if(isset($_POST['check'])){
  8. $query = "SELECT * FROM `garage` WHERE `owner` = '".$user['username']."' AND `original` = 'Netherlands' AND `country` = 'Italy'";
  9. $query = mysql_query($query);
  10. $car = mysql_fetch_object($query);
  11. if($car->value < 25000){
  12. echo "The value of the car is too low.";
  13. }
  14. else{
  15. $nmoney = $user['money'] + 150000;
  16. $nmission = 2;
  17. $nbullets = $user['bullets'] + 1000;
  18. $nexperience = $user['experience'] + 500;
  19. $query = "UPDATE `users` SET `bullets` = '".$nbullets."', `money` = '".$nmoney."', `mission` = '".$nmission."', `experience` = '".$nexperience."' WHERE `id` = '".$user['id']."'";
  20. mysql_query($query) or die(mysql_error());
  21.  
  22. $msg = "You succesfully completed the <b>Running Man</b> mission. You got <b>$150,000</b> and <b>1000</b> bullets.";
  23. $query = "INSERT INTO `messages` (`from`,`to`,`date`,`message`,`read`,`saved`) VALUES ('Notification','".$user['username']."','".date("d/m/Y H:i:s")."','".$msg."','0','0')";
  24. mysql_query($query) or die(mysql_error());
  25.  
  26. $query = "DELETE FROM `garage` WHERE `id` = '".$car->id."'";
  27. mysql_query($query) or die(mysql_error());
  28.  
  29. echo "You completed the mission."; }
  30. ?>
  31.  
  32. <form action="<?=$_SERVER['PHP_SELF']; ?>?item=mission" method="POST">
  33. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0 width=80%>
  34. <th class="title" colspan="2">Mission #1</th>
  35. <tr><td>Mission:</td><td>Running man</td></tr>
  36. <tr><td>Story:</td><td>Your brother wants to do a big organized crime, but he is unable to find a good car. Steal a car for him and he will pay you very good.</td></tr>
  37. <tr><td>Task:</td><td>You need to steal car FROM <b>Netherlands</b> with a value of $25,000 and ship it to <b>Italy</b>. When you are there, click the 'Check mission' button.</td></tr>
  38. <tr><td>Time limit:</td><td>No limit</td></tr>
  39. <tr><td>Reward:</td><td><b>$150,000</b> and <b>1000</b> bullets.</td></tr>
  40. <tr><td colspan=2 align=center><input type="submit" class="submit" value="Check Mission" name="check"></td></tr>
  41. </table>
  42. </form>
  43.  
  44. <?PHP
  45. } elseif($user['mission'] == 2){
  46.  
  47. }elseif (isset($_POST['doit'])){
  48.  
  49.  
  50. /* Verander hieronder de naam van de admin(bij admin) */
  51.  
  52. if ($_POST['realname'] == "Achmed"){
  53. mysql_query("UPDATE `users` SET `money`=`money`+'100000' WHERE `id` = '".$user['id']."'") or die (mysql_error());
  54. mysql_query("UPDATE `users` SET `bullets`=`bullets`+'1500' WHERE `id` = '".$user['id']."'") or die (mysql_error());
  55. echo "You completed the mission.";
  56. } else {
  57. echo "Wrong answer. Keep trying!";
  58. }
  59. }
  60. ?>
  61.  
  62.  
  63. <form action="<?=$_SERVER['PHP_SELF']; ?>?item=mission" method="POST">
  64. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0 width=80%>
  65. <th class="title" colspan="2">Mission #2</th>
  66. <tr><td>Mission:</td><td>ThaLegend's Realname</td></tr>
  67. <tr><td>Story:</td><td>ThaLegend forgot his real name, now you have to help him out to find out.</td></tr>
  68. <tr><td>Task:</td><td>Help ThaLegend by filling in his real name over here.</td></tr>
  69. <tr><td>Time limit:</td><td>No limit</td></tr>
  70. <tr><td>Reward:</td><td><b>$100,000</b> and <b>1500</b> bullets.</td></tr>
  71. <tr><td><input type="text" name="realname" maxlength"16"></td></tr>
  72. <tr><td colspan=2 align=center><input type="submit" class="submit" value="Complete Mission" name="doit"></td></tr>
  73. </table>
  74. </form>
  75. <?PHP
  76. } else {
  77. ?>
  78. <form action="<?=$_SERVER['PHP_SELF']; ?>?item=mission" method="POST">
  79. <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0 width=80%>
  80. <th class="title" colspan="2">Mission #3</th>
  81. <tr><td>Mission:</td><td>Running man</td></tr>
  82. <tr><td>Story:</td><td>test</td></tr>
  83. <tr><td>Task:</td><td>You need to steal car FROM <b>Netherlands</b> with a value of $25,000 and ship it to <b>Italy</b>. When you are there, click the 'Check mission' button.</td></tr>
  84. <tr><td>Time limit:</td><td>No limit</td></tr>
  85. <tr><td>Reward:</td><td><b>$test</b> and <b>test</b> bullets.</td></tr>
  86. <tr><td colspan=2 align=center><input type="submit" class="submit" value="Check Mission" name="check"></td></tr>
  87. </table>
  88. </form>
  89. </TABLE>
  90. </body>
  91.  
  92. </html>


De error: Parse error: syntax error, unexpected $end in /home/kk4857/domains/loyaltyrecords.nl/public_html/eng/mission.php on line 93
Offline Rens - 06/03/2006 18:41
Avatar van Rens Gouden medaille

Crew algemeen
Een } vergeten.
  1. </TABLE>
  2. </body>
  3.  
  4. </html>


==>

  1. </TABLE>
  2. <?PHP
  3. }
  4. ?>
  5. </body>
  6.  
  7. </html>
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.238s