<?php

  ini_set('include_path',"/home/tuve/include/");
  include("site.inc");

  $uploaddir = '/usr/web/uploads/';
  $uploadfile = $_GET['userName'] . "-" . time() . "-" . basename($_FILES['Filedata']['name']);
  $file2 = stripslashes($uploadfile);


  $headers  = 'MIME-Version: 1.0' . "\r\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  $headers .= 'From: Super TUve <tuve@ubixonline.com>' . "\r\n";

  $message = "User: " . $_GET['userName'] . "\nArtist: " . $_GET['artist'] . "\nTitle: " . $_GET['title'] . "\nGenre: " . $_GET['genre'] . "\nClassification: " . $_GET['classification'] . "\nRating: " . $_GET['rating'] . "\nFile: $uploadfile [$file2]\n\n";

if (move_uploaded_file($_FILES['Filedata']['tmp_name'],$uploaddir . $file2)) {
   $oid = $_GET['oid'];
   $cid = $_GET['cid'];
   $rid = $_GET['rid'];
   $artist = $_GET['artist'];
   $title  = $_GET['title'];
   $genre  = $_GET['genre'];
   
   $query = "INSERT INTO videos_pending (oid,classification,rating,artist,title,genre,file,encoded) VALUES($oid,$cid,$rid,'$artist','$title','$genre',\"$uploadfile\",0)";
   mysql_query($query);
   mail("Christopher Olsen <cwolsen@domainatlantic.com>","New Media",$message,$headers);
}
else {
   mail("Christopher Olsen <cwolsen@domainatlantic.com>","ERROR: Media","Error W/ Media",$headers);
   return(false);
  }
?>
