last step thanks.php or upload.php
<?php
require('header.php');
// Check for the file id we should have gotten from SWFUpload
if (isset($_POST["hidFileID"]) && $_POST["hidFileID"] != "" ) {
$resume_id = $_POST["hidFileID"];
$resume_id = strtolower($resume_id);
}
$extension = strtolower($extension);
$extensions = strtolower($extensions);
$extensions = array('.png', '.gif', '.jpg', '.jpeg','.mov', '.swf', '.wmv', '.mpg','.mp3','.wav','.Mp3');
$extension1 = strrchr($_FILES['Filedata']['name'], '.');
$extension = strrchr($resume_id, '.');
if (($extension == '.gif') OR ($extension == '.png') OR ($extension == '.jpg') OR ($extension == '.jpeg'))
{
$picture = 'upload_files/'.$resume_id.'';
}
elseif($extension == '.wmv')
{
$picture = 'images/ico_wmv.jpg';
}
elseif($extension == '.avi')
{
$picture = 'images/ico_avi_tm.jpg';
}
elseif($extension == '.wav')
{
$picture = 'images/ico_wav.jpg';
}
elseif($extension == '.mov')
{
$picture = 'images/ico_mov.jpg';
}
elseif($extension == '.MOV')
{
$picture = 'images/ico_mov.jpg';
}
elseif($extension == '.mp3')
{
$picture = 'images/ico_mp3_tm.jpg';
}
elseif($extension == '.Mp3')
{
$picture = 'images/ico_mp3_tm.jpg';
}
elseif($extension == '.swf')
{
$picture = 'images/ico_swf.jpg';
}
else
{
$picture ='images/no_picture.jpg';
}
$uapprove = $_GET[uapprove];
if($uapprove = 'Yes')
{
$approve = "1";
}
else
{
$approve = "0";
}
$ip = $_SERVER['REMOTE_ADDR'];
$submitter = $_COOKIE[user];
$query = mysql_query("INSERT INTO pp_files (name, video_type, creator, description, date, file, file2, approved, ip, picture, category, submitter)
VALUES ('$_POST[name]', '$extension' , '$_COOKIE[user]', '".safe_sql_insert($_POST['description'])."', CURRENT_DATE(),'$resume_id','$w','$approve','$ip','$picture', '$_POST[category]', '$submitter')") or die(mysql_error());
$aupload = $_GET[aupload];
if($aupload = 'Yes') //OR ($aupload = 'Yes'))
{
$data = mysql_query("SELECT * FROM pp_config") or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
// admin email address
$email = $info['aemail'];
$sitename = $info['name'];
}
$data1 = mysql_query("SELECT id FROM pp_files") or die(mysql_error());
while($info1 = mysql_fetch_array( $data1 ))
{
$id1 = $info1['id'];
}
$data = mysql_query("SELECT email FROM pp_user where user = '$submitter'") or die(mysql_error());
while($infouser = mysql_fetch_array( $data ))
{
// user email address
$emailuser = $infouser['email'];
}
// The subject
$subject = 'Someone just upload a video to '."$sitename";
$headers = "From: " . strip_tags($email) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
//$headers .= "CC: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<img src="http://www.myfunnypets.com/30/templates/default/images/logo.png" alt="Powered by PHPDirector" />';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>User Name:</strong> </td><td>" . strip_tags($_COOKIE[user]) . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" . strip_tags($emailuser) . "</td></tr>";
$message .= "<tr><td><strong>Video Name:</strong> </td><td>" . strip_tags($_POST[name]) . "</td></tr>";
$message .= "<tr><td><strong>Category</strong> </td><td>" . strip_tags($_POST[category]) . "</td></tr>";
$message .= "<tr><td><strong>Description</strong> </td><td>" . strip_tags($_POST['description']) . "</td></tr>";
$message .= "<tr><td><strong>File</strong> </td><td>" . strip_tags($resume_id) . "</td></tr>";
$message .= "<tr><td><strong>File Uploaded to " ."$sitename"."</strong> </td><td>"."http://" . $_SERVER['SERVER_NAME']."/30/"."media-"."$id1". "</td></tr>";
$message .= "<tr><td><strong>User IP Address:</strong> </td><td>" . $ip . "</td></tr>";
$message .= "</table>";
$message .= "</body></html>";
//mail($email, $subject, $message, $headers, "From: $email");
mail($email, $subject, $message, $headers);
}
else
{
}
$uupload = $_GET[uupload];
if($uupload = 'Yes')
{
$data = mysql_query("SELECT email FROM pp_user where user = '$submitter'") or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
// user email address
$email = $info['email'];
}
$data1 = mysql_query("SELECT id FROM pp_files") or die(mysql_error());
while($info1 = mysql_fetch_array( $data1 ))
{
$id1 = $info1['id'];
}
// The subject
$subject = 'thanks for uploading to '. "$sitename";
// The message
$headers = "From: " . strip_tags($email) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
//$headers .= "CC: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<img src="http://www.myfunnypets.com/30/templates/default/images/logo.png" alt="Powered by PHPDirector" />';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>User Name:</strong> </td><td>" . strip_tags($_COOKIE[user]) . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" . strip_tags($email) . "</td></tr>";
$message .= "<tr><td><strong>Video Name:</strong> </td><td>" . strip_tags($_POST[name]) . "</td></tr>";
$message .= "<tr><td><strong>Category</strong> </td><td>" . strip_tags($_POST[category]) . "</td></tr>";
$message .= "<tr><td><strong>Description</strong> </td><td>" . strip_tags($_POST['description']) . "</td></tr>";
$message .= "<tr><td><strong>File</strong> </td><td>" . strip_tags($resume_id) . "</td></tr>";
$message .= "<tr><td><strong>File Uploaded to " ."$sitename"."</strong> </td><td>"."http://" . $_SERVER['SERVER_NAME']."/30/"."media-"."$id1". "</td></tr>";
$message .= "<tr><td><strong>User IP Address:</strong> </td><td>" . $ip . "</td></tr>";
$message .= "</table>";
$message .= "</body></html>";
mail($email, $subject, $message, $headers);
}
else
{
}
$smarty->assign('name', $_POST[name]);
$smarty->assign('description', $_POST[description]);
$smarty->assign('resume_id', $resume_id);
$smarty->display('thanks.tpl');
?>