$name = trim($_GET['name']);
$title = trim($_GET['title']);
$file = trim($_GET['file']);
$type = $_POST['type'];
$path = $_GET['path'];
$id = $_GET['id'];
$Name = stripslashes($name);
//$Title = stripslashes($title);
$File = stripslashes($file);
$Type = addslashes($type);
if ($name == '')
{
print "
You must enter the name of the file . Please go back and try again.
";
exit();
}
if ($path == '')
{
print "You must enter the full file location. Please go back and try again.
";
exit();
}
include("../include/dbconfig.php");
$connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable to connect!");
mysql_select_db($db_name);
$query = "SELECT title, level, type, language from OM_titles where id =".$id;
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_row($result);
$title = $row[0] ;
$level = $row[1];
$type = $row[2];
$language = $row[3];
// $query = 'insert into filedetails (filename, filepath, title, level, media, language, name) VALUES ("'.$File.'", "'.$path.'", "'.stripslashes($Title).'", "'.$level.'", "'.$type.'", "'.$language.'", "'.$Name.'")';
$query = 'insert into OM_media (filename, title, name) VALUES ("'.$File.'", "'.$id.'", "'.$Name.'")';
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
$atitle = stripslashes($Title);
header("Location: addf2title.php?title=$atitle&id=$id");
exit();
?>