<?php
include('config.php');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php print $title; ?> - Image Hosting Website</title>
<link rel="stylesheet" type="text/css" media="screen" title="<?php print $title; ?> Cascading Stylesheet" href="style.css" />
<script type="text/javascript">
//<![CDATA[
window.onload = function() {
if(window.location.hash) {
document.getElementById('showimg').src = '<?php print $filedir; ?>/' + window.location.hash.substring(1);
document.getElementById('showdiv').style.display = 'block';
}
}
//]]>
</script>
</head>
<body>
<h1><?php print $title; ?> - Upload Your Pictures</h1>
</div>
<div id="showdiv"<?php if(empty($imgurl)) { ?> style="display: none;"<?php } ?>>
<img id="showimg" src="<?php if(!empty($imgurl)) print $imgurl; else { ?>about:blank<?php } ?>" alt="Loading image..." />
</div>
<div id="squares">
<script type="text/javascript"><!--
google_ad_client = "<?php print $adsenseid; ?>";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "<?php print $adsenseid; ?>";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
preg_match('/\.([a-zA-Z]+?)$/', $_FILES['file']['name'], $matches);
if(in_array(strtolower($matches[1]), $accepted)) {
if($_FILES['file']['size'] <= $maxsize) {
$newname = md5_file($_FILES['file']['tmp_name']).'.'.$matches[1];
move_uploaded_file($_FILES['file']['tmp_name'], $filedir.'/'.$newname);
$linkurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).'#'.$newname;
$imgurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).$filedir.'/'.$newname;
print '<h2>Upload Succesful!</h2> <p id="codes"><label for="codebb">Embed on bulletin boards:</label><br />
<input type="text" id="codebb" value="[URL='.$linkurl.'][IMG]'.$imgurl.'[/IMG][/URL]" onclick="javascript:this.focus();this.select();" readonly="true" /><br />
<label for="codehtml">Embed on webpages or MySpace: </label><br />
<input type="text" id="codehtml" value=\'<a href="'.$linkurl.'"><img src="'.$imgurl.'" alt="Image hosting by '.$title.'" /></a>\' onclick="javascript:this.focus();this.select();" readonly="true" /><br />
<label for="codedirect">Direct link:</label><br />
<input type="text" id="codedirect" value="'.$imgurl.'" onclick="javascript:this.focus();this.select();" readonly="true" /></p>';
} else
print '<p>Sorry, that file is too big.</p>';
} else
print '<p>Sorry, that file type is not supported.</p>';
}
?>
<form enctype="multipart/form-data" action="<?php print preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']) ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php print (ini_get('upload_max_filesize')>$maxsize)?ini_get('upload_max_filesize'):$maxsize; ?>" />
<label for="file">Upload an image: </label><input type="file" name="file" id="file" /> (must not be bigger than <?php print ((ini_get('upload_max_filesize')>$maxsize)?ini_get('upload_max_filesize'):$maxsize)/1024; ?> KiB)<br />
<input name="submit" type="submit" value="Upload" />
</form>
<div class="banner">
<script type="text/javascript"><!--
google_ad_client = "<?php print $adsenseid; ?>";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<p id="footer">
Copyright © 2007 YourSite.com.
<!--You may not remove the following line without permission!-->
Powered by <a href="http://www.dxldev.info/">DXL dev' Image Hosting Script</a>.
</p>
</body>
</html>