pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

PHP paste-bin - collaborative debugging tool View Help


Posted by Phate on Wed 13th Jun 22:28
download | new post

  1. <?      include("../include/config.php");
  2. ?>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7. <title>Add a Tournament</title>
  8. <title>Executing queries...</title>
  9. <style type="text/css">
  10. <!--
  11. body,td,th {
  12.         font-family: Verdana, Arial, Helvetica, sans-serif;
  13.         font-size: 10px;
  14.         color: #000000;
  15. }
  16. body {
  17.         background-color: #999999;
  18. }
  19. -->
  20. </style>
  21. </head>
  22. <body>
  23. <?
  24. // Show the header
  25. echo "<p align=\"center\"><img src=\"../images/header.png\" alt=\"header\" width=\"1024\" height=\"150\" /></p>";
  26.  
  27. // If we haven't clicked add yet, insert info in this table
  28. if (!isset($_POST['add']))
  29.         {
  30.         echo "<h1> Add a Tournament </h1><br><br>";
  31.         echo "We need the following info. Please make sure all fields are entered.<br>";
  32.         echo "<form action=\"add.php\" method=\"post\">
  33. <table width=\"860\" height=\"689\" border=\"1\">
  34.   <tr>
  35.     <td width=\"158\">Tournament Name </td>
  36.     <td width=\"686\"><input type=\"text\" name=\"name\" /></td>
  37.   </tr>
  38.   <tr>
  39.     <td>Tournament Date </td>
  40.     <td><input type=\"text\" name=\"date\" /></td>
  41.   </tr>
  42.   <tr>
  43.     <td>Tournament Website </td>
  44.     <td><input type=\"text\" name=\"website\" /></td>
  45.   </tr>
  46.   <tr>
  47.     <td>Tournament Location </td>
  48.     <td><input type=\"text\" name=\"location\" /></td>
  49.   </tr>
  50.   <tr>
  51.     <td>Tournament Players Fee </td>
  52.     <td><input type=\"text\" name=\"fee\" /></td>
  53.   </tr>
  54.   <tr>
  55.     <td>Max Players </td>
  56.     <td><input type=\"text\" name=\"maxplayers\" /></td>
  57.   </tr>
  58.   <tr>
  59.     <td>Player Level </td>
  60.     <td><input type=\"text\" name=\"level\" /></td>
  61.   </tr>
  62.   <tr>
  63.     <td height=\"487\">Tournament Description </td>
  64.     <td><textarea name=\"description\" cols=\"100\" rows=\"30\"></textarea></td>
  65.   </tr>
  66. </table>
  67. <input name=\"add\" type=\"submit\" value=\"Add\" />
  68. </form>";
  69.         }
  70. // If we have clicked add yet, add to db
  71. else
  72.         {
  73.         echo $dbname;
  74. // Include our config
  75.  
  76. // Set Table name and query
  77.         $table = $dbprefix . "info";
  78.         $query = "INSERT INTO " . $table . " (date, name, website, location, playersfee, maxplayers, level, description) VALUES('$_POST['date']', '$_POST['name']', '$_POST['website']', '$_POST['location']', '$_POST['fee']', '$_POST['maxplayers']', '$_POST['level']', '$_POST['description']')";
  79.        
  80. // Now connect to the db and select it
  81.         mysql_connect($dbhost, $dbuser, $dbpass)
  82.                 or die("Could not connect to DB! Error: " . mysql_error());
  83.         mysql_select_db($dbname)
  84.                 or die("Could not find DB! Error: " . mysql_error());
  85. // Execute the query = Insert info into db
  86.         mysql_query($query)
  87.                 or die("Could not insert into DB! Error: " . mysql_error());
  88. // Echo success! And continue
  89.         echo "Success! Tournament added!<br>";
  90.         echo "<a href=\"control.php\"><img src=\"images/next.png\" alt=\"next\" width=\"61\" height=\"61\"                          border=\"0\"/></a>";
  91.         }
  92.  
  93. ?>

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Use syntax highlighting

To highlight particular lines, prefix each line with @@
:
:
Remember my settings