hmmmm... I have a simple uploader-script that works fine. But I don't know how to make a varification-by-mail on it...
But I once changed it to, at least, having a password-protection.
Make an index.php - this one includes the password-protection:
Code:
<?php
$password = "YOU_CUSTOM_PASSWORD";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>upload</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
P { FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Verdana, Tahoma, Arial}
TD { FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Verdana, Tahoma, Arial}
-->
</style>
</head>
<body>
<?php
// If password is valid let the user get access
if (isset($_POST["password"]) && ($_POST["password"]=="$password")) {
?>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p align="center"><font size="3" face="Arial, Helvetica, sans-serif"><strong>CHOOSE FILE TO UPLOAD:</strong></font></p>
<p align="center"><br>
<input name="uploaded" type="file" />
</p>
<p align="center"><br />
<input type="submit" value="Upload" />
</p>
</form>
<?php
}
else
{
// Wrong password or no password entered display this message
if (isset($_POST['password']) || $password == "") {
print "<p align=\"center\"><font color=\"red\"><b>WRONG PASSWORD</b><br>TYPE CORRECT PASSWORD</font></p>";}
print "<form method=\"post\"><p align=\"center\">PLEASE TYPE IN PASSWORD<br>";
print "<input name=\"password\" type=\"password\" size=\"10\" maxlength=\"10\"><input value=\"Login\" type=\"submit\"></p></form>";
}
?>
</body></html>
The, if correct password has been entered, it call's the site with the uploader:
Make a upload.php:
Code:
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if ($uploaded_size > 350000)
{
echo "THE FILE IS TO BIG.<br>";
$ok=0;
}
if ($uploaded_type =="text/php")
{
echo "YOU CAN NOT UPLOADE PHP FILES<br>";
$ok=0;
}
if ($ok==0)
{
Echo "SOMETHING WENT WRONG";
}
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "THE FILE ". basename( $_FILES['uploadedfile']['name']). " HAS BEEN UPLOADET";
}
else
{
echo "SOMETHING ****ED UP :o(";
}
}
?>
You might have spotted some great features:
You can set a max sixe to files, and even exclude some extensions (In this case, the uploader won't accept PHP-files).
Hope this was useful
Bookmarks