<?
include "header.php";

if(isset($_GET['u'])) {
$u_id = $_GET['u'];
} else {
exit();
}

if(isset($_GET['i'])) {
$i_id = $_GET['i'];
} else {
exit();
}

$query = mysql_query("SELECT * FROM ims_image WHERE i_id = '$i_id'");
$image_info = mysql_fetch_assoc($query);
if(mysql_num_rows($query) == 0) { exit(); }
$server_array = explode("/", $_SERVER['PHP_SELF']);
$server_array_mod = array_pop($server_array);
$server_info = implode("/", $server_array);
$server = "http://".$_SERVER['HTTP_HOST'].$server_info;
$imageurl = "$server/pic.php?u=$u_id$user_info[code]&i=$i_id";
$htmlcode = "<a href=\"$imageurl\"><img src=\"$imageurl\" border=\"0\"></a>";
$ubbcode = "[url=$imageurl][img]"; $ubbcode .= $imageurl; $ubbcode .= "[/img][/url]";
echo "
<html>
<head>
<title>View Code</title>
<META HTTP-EQUIV='Pragma' CONTENT='no-cache'>
<link rel='STYLESHEET' type='text/css' href='../styles.css'>
</head>
<body>
<center>
<b>HTML Code</b><br>
<textarea rows='5' cols='50'>
$htmlcode
</textarea><br><br>
<b>UBB Code</b><br>
<textarea rows='5' cols='50'>
$ubbcode
</textarea><br><br>
<input class='button' type='submit' value='Close Window' onClick=\"window.close()\">
</center>
</body>
</html>
";

?>