All pastes #124012 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-08-09 19:27 UTC
rendered paste body
<?
require_once("i-bittorrent.php");
dbconn();
loggedinorreturn();
if(get_user_class() < UC_UPLOADER) stderr("Error","Uploaders only.");

if($_POST["no"]) header("Location: ".$BASEURL."/viewmy");

$uid = $CURUSER["id"];
$id = 0 + $_GET["id"];
if($_POST["yes"]) $id = 0 + $_POST["id"];

$exists = get_row_count("iexigo.images", "WHERE id=".$id);

if($exists == 1) {
  $owner = get_row_count("iexigo.images","WHERE id=".$id." AND userid=".$uid);
  if(($owner == 0 || !$owner) && get_user_class() < UC_MODERATOR) {
    stderr("Error","You don't own that image!");
  }
} else {
  stderr("Error","Image doesn't exist!");
}

if($_POST["yes"]) {
  mysql_query("DELETE FROM iexigo.images WHERE id=".$id);
  header("Location: ".$BASEURL."/viewmy");
}

$image_type = mysql_fetch_row(mysql_query("SELECT type FROM iexigo.images WHERE id=".$id));
$suffix = ".jpg";
if($image_type == "image/png") $suffix = ".png";
if($image_type == "image/jpeg") $suffix = ".jpg";
if($image_type == "image/gif") $suffix = ".gif";

stdhead(); begin_main_frame();
echo "<div align=\"center\">";
echo "<div><a href=\"/image/".$id.$suffix."\"><img border=\"0\" src=\"/thumb/".$id.$suffix."\"></a></div><br>";
echo noticebox(
    "<div style=\"font-size: 9pt;\">Are you sure you want to delete this image?</div><br>".
    "<div><form action=\"d\" method=\"post\">".
    "<input type=\"hidden\" name=\"id\" value=\"".$id."\">".
    "<input class=\"row2\" style=\"font-size: 9pt; font-weight: bold;\" type=\"submit\" name=\"no\" value=\"No\">&nbsp;&nbsp;".
    "<input class=\"row2\" style=\"font-size: 9pt; font-weight: bold;\" type=\"submit\" name=\"yes\" value=\"Yes\"></form></div>"
    );
echo "</div>";
end_frame(); end_main_frame();
?>