943,923 Members | Top Members by Rank

Ad:
Jul 9th, 2009
-1

Create a PHP Script Game

Expand Post »
Here's how this one works. I'll start by posting one line of PHP script. The next person to post will add another line and copy the script into their post. You will simply add a line of PHP code to the script everyone wrote above you. Also don't forget to use CODE tags and try to write your line based on the code in the post above you.
The first line:
PHP Syntax (Toggle Plain Text)
  1. session_start();
Similar Threads
Reputation Points: 47
Solved Threads: 47
Posting Whiz
FlashCreations is offline Offline
393 posts
since Sep 2008
Jul 9th, 2009
0

Re: Create a PHP Script Game

php Syntax (Toggle Plain Text)
  1. exit("I'm mean.");
Last edited by MosaicFuneral; Jul 9th, 2009 at 3:55 am.
Reputation Points: 888
Solved Threads: 114
Nearly a Posting Virtuoso
MosaicFuneral is offline Offline
1,270 posts
since Nov 2008
Sep 25th, 2009
0

Re: Create a PHP Script Game

Here's how this one works. I'll start by posting one line of PHP script. The next person to post will add another line and copy the script into their post. You will simply add a line of PHP code to the script everyone wrote above you. Also don't forget to use CODE tags and try to write your line based on the code in the post above you.
The first line:
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. session_start();
  3. $slugtalk = "I may not move fast but I can still slug you." ?>
is that how the game goes?
Reputation Points: 48
Solved Threads: 11
Posting Pro
tiger86 is offline Offline
540 posts
since Feb 2008
Sep 25th, 2009
0

Re: Create a PHP Script Game

Sure. Everyone just adds a line...but after the second post, there really wasn't anything that could be done....but we can ignore that post:
[code=PHP]
<?php
session_start();
$slugtalk = "I may not move fast but I can still slug you.";
$slugtalk += " I'm a slug...\n";
?>
Reputation Points: 47
Solved Threads: 47
Posting Whiz
FlashCreations is offline Offline
393 posts
since Sep 2008
Sep 27th, 2009
0

Re: Create a PHP Script Game

I have a few lines.
php Syntax (Toggle Plain Text)
  1. <?php
  2. session_start();
  3. $slugtalk = "I may not move fast but I can still slug you.";
  4. $slugtalk.= " I'm a slug...\n";
  5. for ($i=0;$i<6;$i++) {
  6. if ($i==round($i/2)) {
  7. $slugtalk.=$slugtalk;
  8. } else {
  9. $slugtalk.="Hey, how about me!\n";
  10. $slugtalk.='Testing';
  11. for ($v=1;$v<=$i;$v++) {
  12. $slugtalk.=' '.$v;
  13. }
  14. $slugtalk.=".\n";
  15. }
  16. }
Not that they do much.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Sep 27th, 2009
0

Re: Create a PHP Script Game

php Syntax (Toggle Plain Text)
  1. <?php
  2. session_start();
  3. $slugtalk = "I may not move fast but I can still slug you.";
  4. $slugtalk.= " I'm a slug...\n";
  5. for ($i=0;$i<6;$i++) {
  6. if ($i==round($i/2)) {
  7. $slugtalk.=$slugtalk;
  8. } else {
  9. $slugtalk.="Hey, how about me!\n";
  10. $slugtalk.='Testing';
  11. for ($v=1;$v<=$i;$v++) {
  12. $slugtalk.=' '.$v;
  13. }
  14. $slugtalk.=".\n";
  15. }
  16. }
  17.  
  18. $DB = mysql_connect("localhost", "user", "pass") or die("Slug Squashed!");
  19. mysql_select_db("someDB") or die("The slug was too slow!");
  20. mysql_query("SELECT id WHERE slug='{$slugtalk}'");
Reputation Points: 47
Solved Threads: 47
Posting Whiz
FlashCreations is offline Offline
393 posts
since Sep 2008
Sep 27th, 2009
0

Re: Create a PHP Script Game

php Syntax (Toggle Plain Text)
  1. <?php
  2. session_start();
  3. $slugtalk = "I may not move fast but I can still slug you.";
  4. $slugtalk.= " I'm a slug...\n";
  5. for ($i=0;$i<6;$i++) {
  6. if ($i==round($i/2)) {
  7. $slugtalk.=$slugtalk;
  8. } else {
  9. $slugtalk.="Hey, how about me!\n";
  10. $slugtalk.='Testing';
  11. for ($v=1;$v<=$i;$v++) {
  12. $slugtalk.=' '.$v;
  13. }
  14. $slugtalk.=".\n";
  15. }
  16. }
  17.  
  18. $DB = mysql_connect("localhost", "user", "pass") or die("Slug Squashed!");
  19. mysql_select_db("someDB") or die("The slug was too slow!");
  20. mysql_query("SELECT id WHERE slug='{$slugtalk}'");
OOPS - Fatal error, better fix it:
php Syntax (Toggle Plain Text)
  1. <?php
  2. session_start();
  3. $slugtalk = "I may not move fast but I can still slug you.";
  4. $slugtalk.= " I'm a slug...\n";
  5. for ($i=0;$i<6;$i++) {
  6. if ($i==round($i/2)) {
  7. $slugtalk.=$slugtalk;
  8. } else {
  9. $slugtalk.="Hey, how about me!\n";
  10. $slugtalk.='Testing';
  11. for ($v=1;$v<=$i;$v++) {
  12. $slugtalk.=' '.$v;
  13. }
  14. $slugtalk.=".\n";
  15. }
  16. }
  17.  
  18. $DB = mysql_connect("localhost", "user", "pass") or die("Slug Squashed!");
  19. mysql_select_db("someDB") or die("The slug was too slow!");
  20. mysql_query("SELECT id FROM `table` WHERE slug='".mysql_real_escape_string($slugtalk)."'");
Last edited by cwarn23; Sep 27th, 2009 at 7:24 pm.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Sep 27th, 2009
0

Re: Create a PHP Script Game

Alright:
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. session_start();
  3. $slugtalk = "I may not move fast but I can still slug you.";
  4. $slugtalk.= " I'm a slug...\n";
  5. for ($i=0;$i<6;$i++) {
  6. if ($i==round($i/2)) {
  7. $slugtalk.=$slugtalk;
  8. } else {
  9. $slugtalk.="Hey, how about me!\n";
  10. $slugtalk.='Testing';
  11. for ($v=1;$v<=$i;$v++) {
  12. $slugtalk.=' '.$v;
  13. }
  14. $slugtalk.=".\n";
  15. }
  16. }
  17.  
  18. $DB = mysql_connect("localhost", "user", "pass") or die("Slug Squashed!");
  19. mysql_select_db("someDB") or die("The slug was too slow!");
  20. $res = mysql_query("SELECT id FROM `table` WHERE slug='".mysql_real_escape_string($slugtalk)."'");
  21. $results = new array();
  22. while($arr = mysql_fetch_array($res))
  23. {
  24. $results[] = (int)$arr['id']+count($results);
  25. }
Reputation Points: 47
Solved Threads: 47
Posting Whiz
FlashCreations is offline Offline
393 posts
since Sep 2008
Sep 27th, 2009
0

Re: Create a PHP Script Game

Got a few more lines
php Syntax (Toggle Plain Text)
  1. <?php
  2. session_start();
  3. $slugtalk = "I may not move fast but I can still slug you.";
  4. $slugtalk.= " I'm a slug...\n";
  5. for ($i=0;$i<6;$i++) {
  6. if ($i==round($i/2)) {
  7. $slugtalk.=$slugtalk;
  8. } else {
  9. $slugtalk.="Hey, how about me!\n";
  10. $slugtalk.='Testing';
  11. for ($v=1;$v<=$i;$v++) {
  12. $slugtalk.=' '.$v;
  13. }
  14. $slugtalk.=".\n";
  15. }
  16. }
  17.  
  18. $DB = mysql_connect("localhost", "user", "pass") or die("Slug Squashed!");
  19. mysql_select_db("someDB") or die("The slug was too slow!");
  20. $res = mysql_query("SELECT id FROM `table` WHERE slug='".mysql_real_escape_string($slugtalk)."'");
  21. $results = new array();
  22. while($arr = mysql_fetch_array($res))
  23. {
  24. $results[] = (int)$arr['id']+count($results);
  25. $results[((int)$arr['id']+count($results))]=true;
  26. }
  27. if (isset($results[$_GET['i']])) {
  28. die('You won. <a href="index.php">Click here</a> to play again.');
  29. } else if (isset($_GET['i']) && !empty($_GET['i'])) {
  30. die('You lost mate. <a href="index.php">Click here</a> to loose again.');
  31. } else {
  32. echo "\n<p>".'<form method="get">Enter a number in the box below<br>';
  33. echo '<input type="text" name="i">';
  34. echo '<input type="submit" value="Guess the number"></form>';
  35. }
Last edited by cwarn23; Sep 27th, 2009 at 8:39 pm.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Posting Games Forum Timeline: designer breeds
Next Thread in Posting Games Forum Timeline: My life according to {Band name}





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC