Robie takie coś:
<?php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
<meta http-equiv="Creation-date" content="2007-04-10T11:08:47Z">
<meta name="Authoring-tool" content="Pajaczek NxG PRO v5.6.1">
</head>
<body>
<form enctype="multipart/form-data" action="code.php" method="POST">
<table border="1">
<tr>
<td>
<!-- MAX_FILE_SIZE must precede the
file input field
--> <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in
$_FILES array --> plik: <input name="plik" type="file" />
</td>
</tr>
<tr>
<td>Potworek był na pozycji:</td>
<td>Potworek jest na pozycji:</td>
</tr>
<tr>
<td>X
<input type="text" name="x1" value="" /></td>
<td>X
<input type="text" name="x2" value="" /></td>
</tr>
<tr>
<td>Y
<input type="text" name="y1" value="" /></td>
<td>Y
<input type="text" name="y2" value="" /></td>
</tr>
<tr>
<td>Z
<input type="text" name="z1" value="" /></td>
<td>Z
<input type="text" name="z2" value="" /></td>
</tr>
</table>
<table width="100$" height="100%">
<tr>
<td align="center" valign="middle" width="300px">
<input type="submit" name="submit" value="Wykonaj" /></td>
</tr>
</table>
</form>
</body>
</html>
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
<meta http-equiv="Creation-date" content="2007-04-10T11:26:00Z">
<meta name="Authoring-tool" content="Pajaczek NxG PRO v5.6.1">
</head>
<body>
<?php
$roznicax=$_POST['x2']-$_POST['x1'];
$roznicay=$_POST['y2']-$_POST['y1'];
$roznicaz=$_POST['z2']-$_POST['z1'];
print("Różnica X: $roznicax"); print("Różnica Y: $roznicay"); print("Różnica Z: $roznicaz");
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
echo "File is valid, and was successfully uploaded.n"; } else {
echo "Possible file upload attack!n"; }
echo 'Here is some more debugging info:';
?>
</body>
</html>
I pokazuje się:
Różnica X: 232108
Różnica Y: 81099
Różnica Z: 0
Possible file upload attack!
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => island-spawn.xml
[type] => text/xml
[tmp_name] => C:/Program Files/WebServ/temp/file-uploads\php4D3.tmp
[error] => 0
[size] => 2281
)
)
Dlaczego?!?!