Heres my code:
form.php
Code: Select all
<?php
if(!eregi("modules.php", $_SERVER['PHP_SELF'])){
die("You can't access this file directly...");
}
$module_name = basename(dirname(__FILE__));
$module_dir = "modules/$module_name/";
include("header.php");
$index = 1;//right sidebar or not 0=off 1=on
title("Submit Band info/Mp3's/Image's");
OpenTable();
?>
<form enctype="multipart/form-data" action="http://naild.com/localmm/modules.php?name=Bands_Showcase&file=submit" method="post">
<br>                                 Band Name:<center><input type="text" name="bandname"size=20></center>
<br>
<br><center>Band Description:                   Band History:</center><br><center><textarea cols=30 rows=10 name="description"></textarea><textarea cols=30 rows=10 name="history"></textarea></center>
<br>
<br>                                 Influences:<center><input type="text" name="influences"size=40></center>
<br>                                 Select Genra:<center><select name="genra" size=20 multiple></center>
<option>Acoustic
<option>Alternative
<option>Blues
<option>Christian
<option>Classic Rock
<option>Classical
<option>Country
<option>Cover Bands
<option>Death Metal
<option>Disc Jockey
<option>Easy Listening
<option>Electronic
<option>Emo
<option>Experimental
<option>Folk
<option>Funk
<option>Gospel
<option>Gothic
<option>Grunge
<option>Hardcore
<option>Hip Hop
<option>Instrumental
<option>Jazz
<option>Metal
<option>Modern Rock
<option>Progressive
<option>Punk
<option>Rap
<option>Reggae
<option>Rock
<option>Speed Metal
<option>Swing
<option>Techno
</select>
<br>Email:<center><input type="text" name="email"size=20></center>
<br>Website:<center><input type="text" name="website"size=20></center>
<input type="hidden" name="MAX_FILE_SIZE" value="500000" />
<br>Upload Image: <center><input name="imageupload" type="file" /> </center> Max image size is 500kb
<input type="hidden" name="MAX_FILE_SIZE" value="3500000" />
<br>Upload mp3: <center><input name="mp3upload1" type="file" /> </center>  Max mp3 size is 3.5 mb.
<input type="hidden" name="MAX_FILE_SIZE" value="3500000" />
<br>Upload mp3: <center><input name="mp3upload2" type="file" /> </center>  Max mp3 size is 3.5 mb.
<input type="hidden" name="MAX_FILE_SIZE" value="7000000" />
<br>If Mp3 exceeds 3.5 mb Upload Here: <center><input name="mp3upload3" type="file" /> </center>
<center><i>If one of your mp3's exceeds 3.5 mb. You may only upload 1 mp3. But if they are 3.5mb or less you may upload 2. PLEASE ABIDE TO THIS RULE! If you do not. Your information will be discarded.</center></i>
<br><input type="submit" name="submit" value="Submit">
</form>
<?php
CloseTable();
include("footer.php");
?>Code: Select all
<?php
if(!eregi("modules.php", $_SERVER['PHP_SELF'])){
die("You can't access this file directly...");
}
if ($_POST['submit']){ //changed
//these should come before the email
$bandname=$_POST['bandname'];
$genra=$_POST['genra'];
$description=$_POST['description'];
$history=$_POST['history'];
$email=$_POST['email'];
$website=$_POST['website'];
$influences=$_POST['influences'];
//Email Variables (these work fine)
$recipient = "mikegotnaild@hotmail.com";
$subject = "Bands Showcase Submission";
$message = "Band Name: $bandname, Genra: $genra, Band Description: $description, Band History: $history, Email: $email, Website: $website, Influences: $influences";
$subject=$_POST['subject'];
mail($recipient,$subject,$message);
// upload action script.
$uploaddir = $_SERVER['DOCUMENT_ROOT'] . '/localmm/upload/'; //changed
$uploadfile1 = $uploaddir . $_FILES['imageupload']['name'];
$uploadfile2 = $uploaddir . $_FILES['mp3upload1']['name'];
$uploadfile3 = $uploaddir . $_FILES['mp3upload2']['name'];
$uploadfile4 = $uploaddir . $_FILES['mp3upload3']['name'];
if (!move_uploaded_file($_FILES['imageupload']['tmp_name'], $uploadfile1)) {
print "ERROR: File is invalid";
print_r($_FILES);
}
if (!move_uploaded_file($_FILES['mp3upload1']['tmp_name'], $uploadfile2)) {
print "ERROR: File is invalid";
print_r($_FILES);
}
if (!move_uploaded_file($_FILES['mp3upload2']['tmp_name'], $uploadfile3)) {
print "ERROR: File is invalid";
print_r($_FILES);
}
if (!move_uploaded_file($_FILES['mp3upload3']['tmp_name'], $uploadfile4)) {
print "ERROR: File is invalid";
print_r($_FILES);
}
//commented out the following line because it would prevent you from seeing the debugging info
//header("Location: http://naild.com/localmm/modules.php?na ... &file=sent");
}
?>