All pastes #283300 Raw Edit

Magilla

public text v1 · immutable
#283300 ·published 2006-12-18 06:48 UTC
rendered paste body
<?php
define ('IN_GALLERY','true');
include 'functions.php';
if (empty($_GET))
{
   header("Location: admin_pics.php");
   exit;
}
else
{
   $sql = "SELECT * FROM `" . $config['tb_prefix'] . "pictures` WHERE `id`='" . $_GET['pic'] . "';";
   $data = mysql_query($sql) or die("Error fetching data from database");
   $pCount = 0;
   while($row = mysql_fetch_row($data))
   {
      $picData[$pCount] = $row;
      ++$pCount;
   }
   if ($pCount == 0)
   {
   header("Location: admin_pics.php");
   exit;
   }
}
print "<html><head><title>Edit Picture</title></head>\n";
print "<body><center>\n";

print_r($picData);



?>


<form action="upload.php" method="POST">
   <table cellpadding="2px" border="1px">
      <tr>
         <td>
            Location:
         </td>
         <td>
            <input type="text" name="location" value="<?php echo html_entity_decode($picData[4],ENT_QUOTES); ?>" />
         </td>
         <td rowspan="4">
            <textarea name="description" rows="6" cols="40"><?php echo html_entity_decode($picData[7],ENT_QUOTES); ?></textarea>
         </td>
      </tr>
      <tr>
         <td>
            Date Taken:
         </td>
         <td>
            <input type="text" name="date" <?php echo html_entity_decode($picData[3],ENT_QUOTES); ?> />
         </td>
      </tr>
      <tr>
         <td>
            Gallery:
         </td>
         <td>
            <select name="gallery">
               <option value="-1">--Choose a gallery--</option>
<?php
$sql = "SELECT id, name FROM `" . $config['tb_prefix'] . "galleries`;";
$data = mysql_query($sql) or die("Error fetching data from database");
$count = 0;
while($row = mysql_fetch_row($data))
{
   $galleryData[$count][0] = $row[0];
   $galleryData[$count][1] = $row[1];
   ++$count;
}
if ($count != 0)
{
   foreach($galleryData as $gallery)
   {
      if ($picData[2]==$gallery[0])
      {
         echo "               <option SELECTED value='$gallery[0]'>$gallery[1]</option>\n";
      }
      else
      {
         echo "               <option value='$gallery[0]'>$gallery[1]</option>\n";
      }
   }
}
?>
            </select>
         </td>
      </tr>
      <tr>
         <td colspan="3" align="center">
            <input type="submit" value="Edit" />
         </td>
      </tr>
   </table>
</form>
</center>
</body>
</html>