All pastes #117921 Raw Edit

Someone

public text v1 · immutable
·published 2006-08-06 03:41 UTC
rendered paste body
------ my index

<?
$sid = sha1(uniqid(rand()));
?>
<script language="javascript" type="text/javascript" src="fuse/upload/scripts.js"></script>
<center>
<iframe src="" name="progress" id="progress" frameborder="0" scrolling="no" width="600" height="100"></iframe>
<form  enctype="multipart/form-data" action="cgi-bin/upload.cgi?sid=<? echo $sid; ?>" method="post">
<table border=0 align="left" cellpadding=3>
	<tr><td><input type="file" name="file[0]"></td></tr>
	<tr><td><input type="file" name="file[1]"></td></tr>
	<tr><td><input type="file" name="file[2]"></td></tr>
	<tr><td><input type="file" name="file[3]"></td></tr>
	<tr><td><input type="file" name="file[4]"></td></tr>
	<tr><td><input type="file" name="file[5]"></td></tr>
	<tr><td><input type="file" name="file[6]"></td></tr>
	<tr><td><input type="file" name="file[7]"></td></tr>
	<tr><td><input type="file" name="file[8]"></td></tr>
	<tr><td><input type="file" name="file[9]"></td></tr>
	<tr><td colspan=2 align="center">
		<input type="hidden" name="sessionid" value="<?= $sid ?>">
		<input type="button" value="Upload" onClick="upload();">
	</td></tr>
</table>
</form>
</center>


---- scripts.js

var postLocation="fuse/upload/progress.php";

/* 
 * add any extension that you do no want to upload to the list 
 * below they should be placed with in the /^ and / characters
 * separate each extension by a pipe symbol |
 */
 
var re = /^(\.php)|(\.sh)/;  // disallow shell scripts and php


/**
 * dofilter = true; to enable filtering
 */
var dofilter=true;

/**
 * this method will match each of the filenames with a
 * given list of banned extension. If any one of the
 * extensions match, an alert will be popped up and the
 * upload will not continue;
 */
 
function check_types() {
	if(dofilter==false)
		return true;
	with(document.forms[0])
	{
		/*
		 * with who uses with?
		 * i do, i am an ancient. ok?
		 */
		
		for(i=0 ; i < elements.length ; i++)
		{
			if(elements[i].value.match(re))
			{
				alert('Sorry ' + elements[i].value + ' is not allowed');
				return false;
			}
		}
	}
	return true;
}

function upload()
{

	if(check_types() == false)
	{
		return false;
	}
	baseUrl = postLocation;
	sid = document.forms[0].sessionid.value;
	iTotal = escape("-1");
	baseUrl += "?iTotal=" + iTotal;
	baseUrl += "&iRead=0";
	baseUrl += "&iStatus=1";
	baseUrl += "&sessionid=" + sid;
	frames['progress'].location.href = baseUrl;
	document.forms[0].submit();
}

-------------
test here: http://uploadian.com/upload it seems to submit the form, but it dosnt change the iframe first? thanks