Intet chek efter email og navn i PHP.. middelsvær!
Jeg har downloadet dette script og vil gerne have at den IKKE spørger efter navn og specielt!! email!Fil skal den have, men IKKE email!
Scriptet:
<?
// set variables (SET THESE TO SUIT YOUR CIRCUMSTANCES):
// Upload directory (MUST HAVE TRAILING SLASH):
$uploaddir="./../billeder/film2/";
// Your email
$youremail="rydbirk@mail1.stofanet.dk";
// Thank you page:
$thankspage="tak.htm";
// Set Upload thanks message for USER
$uptymessage="$realname, tak fordi du uploadede filen file $file_name\n\n.";
// Set Upload thanks message for OWNER
$ownermessage="$realname [ $email ] har uploadet en fil med navnet $file_name\n\nTjek mappen.";
// Email message on or off ? 1 = on, 0 = off
$emailmessages = "0";
// start code (DO NOT CHANGE ANYTHING BELOW THIS LINE):
// Check for valid email address
$x = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email);
if($x==0)
// if no valid email address entered, display no email message
{
echo "<div align=center>Du <b>skal</b> skrive en gyldig emailadresse. <a href=java script:history.back(-1)>Tilbage</a>.</div>";
}
else {
// Check to see if valid file
if ($file == "none") {
// if no valid email address entered, display no file message
echo "<div align=center>Du <b>skal</b> vælge en fil. <a href=java script:history.back(-1)>Tilbage</a>.</div>";
}
else {
//directory to upload to
copy($file, $uploaddir.$file_name);
unlink($file);
//return thank you page
Header("Location: $thankspage");
}
}
if ($emailmessages == "1") {
//mail you to let you know a new uploaded file
mail("$youremail", "Uploaded fil", "$ownermessage");
//mail user to thank them
mail("$email", "Uploaded fil", "$uptymessage");
exit;
}
?>