I have a script thats all in one page called upload.php
After the image uploads it displays the links..
I want to make it so they can upload 3 images at a time or more or even maybe a javascript box that adds more upload boxs..
Heres the code for upload.php
<?include("include/common.php");
?>
<html>
<head>
</head>
<table cellpadding="0" cellspacing="0" width="19">
<tr>
<td height="19">
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" width="184">
<tr>
<td height="50" width="10" rowspan="2">
</td>
<td height="23" width="175" style="background-image: url(images/stat_top.gif); background-repeat: no-repeat; border: 1px solid #344966">
</td>
</tr>
<tr>
<td id="stats" height="70" width="174" style="border-bottom: 1px solid #344966">Ip address: <b><? echo getenv('REMOTE_ADDR'); ?></b><br><br> <?php
// Our log file;
$counter = "stats.txt";
// Date logging;
$today = getdate();
$month = $today[month];
$mday = $today[mday];
$year = $today[year];
$current_date = $mday . $month . $year;
// Log visit;
$fp = fopen($counter, "a");
$line = $REMOTE_ADDR . "|" . $mday . $month . $year . "\n";
$size = strlen($line);
fputs($fp, $line, $size);
fclose($fp);
// Read log file into array;
$contents = file($counter);
// Total hits;
$total_hits = sizeof($contents);
// Total hosts;
$total_hosts = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
array_push($total_hosts, $entry[0]);
}
$total_hosts_size = sizeof(array_unique($total_hosts));
// Daily hits;
$daily_hits = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
if ($current_date == chop($entry[1])) {
array_push($daily_hits, $entry[0]);
}
}
$daily_hits_size = sizeof($daily_hits);
// Daily hosts;
$daily_hosts = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
if ($current_date == chop($entry[1])) {
array_push($daily_hosts, $entry[0]);
}
}
$daily_hosts_size = sizeof(array_unique($daily_hosts));
?>
<? echo "
Page hits:<b> " . $total_hits . "</b><br><br>
Unique hits: <b> " . $total_hosts_size . "</b><br><br>
Todays Page hits: <b> " . $daily_hits_size . "</b><br><br>
Todays unique hits: <b>" . $daily_hosts_size; ?> </tr>
</table>
<table cellpadding="0" cellspacing="0" width="19">
<tr>
<td height="19">
</td>
</tr>
</table>
</td>
<td valign="top" height="404" width="3" rowspan="4">
<table cellpadding="0" cellspacing="0" width="3">
<tr>
<td height="19">
</td>
</tr>
</table>
</td>
<td valign="top" height="19" width="460">
</td>
<td valign="top" height="19" width="10">
</td>
</tr>
<tr>
<td height="25" width="460" style="border: 1px solid #344966; background-image: url(images/main.gif); background-repeat: no-repeat">
</td>
<td height="23" width="10">
</td>
</tr>
<tr>
<td id="main" valign="top" height="350" width="450">
<head>
<div style="width:100%; margin-bottom:1px;">
<div><strong></strong></div>
<p align="center"><?if($loggedin){
include("include/accmenu.php");
}?>
<?php
if( $_POST['submit'] && $_FILES['attached']['name'] ){
$ok_filetypes = explode("|",$att_filetypes);
if (!$_FILES['attached']['error'] && $_FILES['attached']['size'] > $att_max_size*1024){
errform('Sorry, but the attached file is too large. Please reduce the size of it\'s contents.'); // #err
$step = 1;
}
$filename = (!$_FILES['attached']['error'] ? substr( basename($_FILES['attached']['name']), -30 ) : '');
$x = strtolower( substr($_FILES['attached']['name'], -3));
if($filename && !in_array($x, $ok_filetypes) ){
errform('Sorry, the filetype you have tried to upload is not allowed.');
$step = 1;
}
if(!$posterr){
if(!isset($_GET["ipaddress"]) || ($_GET["ipaddress"] == "")) {
$ipaddress = $_SERVER['REMOTE_ADDR'];
$local = 1;
} else {
$ipaddress = $_GET["ipaddress"];
$local = 0;
}
$uniq = substr( md5(uniqid (rand())), 0, 10 );
$ext = strtolower( substr($_FILES['attached']['name'], -3));
move_uploaded_file($_FILES['attached']['tmp_name'], $att_path."/".$uniq.".".$ext );
$strQuery = "INSERT INTO images SET ";
$strQuery .= "filename='".$uniq.".".$ext."',";
$strQuery .= "ipaddress='{$ipaddress}',";
$strQuery .= "date='".time()."',";
$strQuery .= "pkey='{$uniq}',";
if($myuid){
$strQuery .= "user='{$myuid}',";
}
$strQuery .= "status='1'";
$result = mysql_query($strQuery) or die( mysql_error() );
$aid = mysql_insert_id();
if($aid){
$filen = $siteurl."/".str_replace('./', '', $att_path)."/".$uniq.".".$ext;
$filen = str_replace('http://','%%',$filen);
$filen = str_replace('//','/',$filen);
$filen = str_replace('%%','http://',$filen);
$step = 2;
}else{
$step = 1;
}
}
}else{
$step = 1;
}
if($step == 1){ ?>
<br>
Welcome to SharedImage! We are YOUR source for free image web hosting. Feel free to upload all the images you would like! SharedImage is great for posting images on message boards and even sharing pictures with your family! The possibilites are ENDLESS! Also, make sure you read our rules before uploading anything.
<form ENCTYPE="multipart/form-data" method="post" name="form1">
<div align="center">
<INPUT NAME="attached" TYPE="file" size="50">
<br>
File extensions allowed: <b>
<?=implode("</b>, <b>",explode("|",$att_filetypes))?>
</b><br>
File size limit: <b>
<?=$att_max_size?>
KB</b>
<br>
<br>
<input type="submit" name="submit" value="Upload Image">
</div>
</form><?
}else{
?>
<b>Your image has been successfully uploaded!</b><br>
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><img src="<?=$filen?>"></div></td>
</tr>
<tr>
<td><div align="center"><br>
To insert this image in a message board post copy and paste the following
code:<br>
<textarea name="textarea" cols="55" wrap="soft" rows="3">[img]<?=$filen?>[/img]</textarea>
</div></td>
</tr>
<tr>
<td><div align="center"><br>
To send this image to friends and family, copy and paste this code: <br>
<textarea name="textarea2" cols="55" rows="4"><?=$filen?></textarea>
</div></td>
</tr>
<tr>
<td><div align="center"><br>
To insert this image using HTML, copy and paste the following
code:<br>
<textarea name="textarea3" cols="55" wrap="soft" rows="3"><a href="<?=$siteurl?>" target="_blank"><img alt="Image Hosted by <?=$sitename?>" src="<?=$filen?>" /></a></textarea>
</div></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<? } ?>
</div>
</td>
<td valign="top" height="350" width="10">
</td>
</tr>
<tr>
<td valign="top" height="14" width="465" colspan="2"><table width="450" border="0">
<tr>
<th scope="col"> <!-- Begin: AdBrite -->
<style type="text/css">
.adHeadline {font: bold 10pt Arial; text-decoration: underline; color: #CC0000;}
.adText {font: normal 10pt Arial; text-decoration: none; color: #FFFFCC;}
</style>
<script type="text/javascript" src="http://ads.adbrite.com/mb/text_group.php?sid=290765&br=1&dk=6170706c7920666f7220612063726564697420636172645 f325f325f776562&col=2">
</script><div style="width:100%; margin-bottom:1px;">
<div><a class="adHeadline" target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=290765&afsid=1">Your Ad Here</a><br />Please click ADS daily to keep this site up </div>
<!-- End: AdBrite --></th>
</tr>
</table> </td>
</tr>
</table>
</td>
</tr>
</table>
<table align="center" cellpadding="0" cellspacing="0" width="700">
<!-- w3.org table -->
<tr>
<td height="37">
</td>
</tr>
</table>
</body>
</html>