mysql_connect(HostName,UserName,Password) or die("<html><body>Can not connect to MySql server!<br></body></html>");
mysql_select_db (DBName) or die ("<html><body>Could not select database ".DBName."<br></body></html>");
if ($act=='1') {
$ftitle=addslashes($ftitle);
$fvideo=addslashes($fvideo);
$query=mysql_query("INSERT INTO `gal_photos` (`video`, `cat_id`, `title`, `approved`) VALUES ('$fvideo', '$fcat_id', '$ftitle', '$fapproved')") or die (mysql_error());
$photo_id=mysql_insert_id();
$filename=$_FILES['bpic2']['tmp_name'];
if ($filename!="") {
if (file_exists('photos/photo_'.$photo_id.'.jpg')) {unlink ('photos/photo_'.$photo_id.'.jpg');};