Размер файла: 6.02Kb
<?php
/*-----------------------------------------------------------------------------------------
mcGalleryPRO
All code is © 2003 Marc Cagninacci.
No files may be redistributed in whole or significant part.
----------------- mcgalleryPRO IS NOT FREE SOFTWARE -------------------
You should have receive a file called license.txt in this package
--------------------------------------------------------------------------------------------*/
session_start();
if (empty($_SESSION['private_login']))
{
include "./sess.php";
exit;
}
if (!empty($_FILES))
{
$uploadedfile = $_FILES['uploadedfile']['name'];
$uploaded = $_FILES['uploadedfile']['tmp_name'];
$uploadedfile_type = $_FILES['uploadedfile']['type'];
$uploadedfile2 = $_FILES['uploadedfile2']['name'];
$uploaded2 = $_FILES['uploadedfile2']['tmp_name'];
$uploadedfile2_type = $_FILES['uploadedfile2']['type'];
}
if (!isset($func))
{
$func = "one";
}
switch ($func) {
case one:
$dir = '../videos/'.$idalbum;
echo '<form method="post" enctype="multipart/form-data" action="detailvideo.php">';
echo '<table border="0" align="center" cellspacing="1" cellpadding="3" bgcolor="#000000">';
echo '<tr><td bgcolor="#DDDDDD" align="center" colspan="5"><font face="verdana" size="2" color="black">';
echo $l_Addvideo.' <b>'.stripslashes($nom_album[0]).'</b></font></td>';
echo '<td bgcolor="#000000" align="left"><font face="verdana" size="1" color="white">'.$l_Video.': </font><input type="file" name="uploadedfile" size="25" maxlenght="90">';
echo '</td>';
echo '<td bgcolor="#000000" align="left"><font face="verdana" size="1" color="white">'.$l_Thumb.': </font><input type="file" name="uploadedfile2" size="25" maxlenght="90">';
echo '</td>';
echo ' <input type="hidden" name="idalbum" value="'.$idalbum.'">';
echo ' <input type="hidden" name="album" value="'.stripslashes($nom_album[0]).'">';
echo '<input type="hidden" name="func" value="two">';
echo '<td bgcolor="#000000"><input type="submit" name="submitfile" value="OK"></td></tr>';
echo '</table></form>';
break;
case two:
echo '<table align="center"><tr><td class="td2" align="center"><font face="verdana" size ="2" color="red">';
$uploadedfile = strtr($uploadedfile, "АБВГДЕабвгдеТУФХЦШтуфхцшИЙКЛийклЗзМНОПмнопЩЪЫЬщъыьяСс", "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn");
$ext = $uploadedfile_type;
$len = strlen($ext);
$dir = '../videos/'.$idalbum;
$pos = strpos($ext,'/')+1;
$extension = substr($ext, $pos, $len);
$ext2 = $uploadedfile2_type;
$len2 = strlen($ext2);
$pos2 = strpos($ext2,'/')+1;
$extension2 = substr($ext2, $pos2, $len2);
if($uploadedfile == '' || $uploadedfile2 == '')
{
unset($uploadedfile);
unset($uploadedfile2);
echo $l_Addvideo_err0.'<br>';
echo '<a href="detailvideo.php?idalbum='.$idalbum.'" class="lien1"><b>'.$l_Retour.'</a></b>.</font>';
exit();
}
if($extension=="mpeg"){ $extension="mpg"; }
if($extension=="MPEG"){ $extension="mpg"; }
if($extension=="MPG"){ $extension="mpg"; }
if($extension=="AVI"){ $extension="avi"; }
if($extension != 'mpg' && $extension != 'avi')
{
unset($uploadedfile);
unset($uploadedfile2);
echo $l_Addvideo_err1.'<br>';
echo '<a href="detailvideo.php?idalbum='.$idalbum.'" class="lien1"><b>'.$l_Retour.'</a></b>.</font>';
exit();
}
if($extension2=="pjpeg"){ $extension2="jpg"; }
if($extension2=="PJPEG"){ $extension2="jpg"; }
if($extension2=="jpeg"){ $extension2="jpg"; }
if($extension2=="JPEG"){ $extension2="jpg"; }
if($extension2 != 'jpg' && $extension2 != 'JPG')
{
unset($uploadedfile);
unset($uploadedfile2);
echo $l_Addvideo_err2.'<br>';
echo '<a href="detailvideo.php?idalbum='.$idalbum.'" class="lien1"><b>'.$l_Retour.'</a></b>.</font>';
exit();
}
if (file_exists("$dir/$uploadedfile"))
{
unset($uploadedfile);
unset($uploadedfile2);
echo $l_Addphoto_err2.'<br>';
echo '<a href="detailvideo.php?idalbum='.$idalbum.'" class="lien1"><b>'.$l_Retour.'</a></b>.</font>';
exit();
}
//if image exist, upload it in correct dir
if($uploadedfile <> 'none' && $uploadedfile2 <> 'none')
{
//$uploadedfile2 = str_replace($extension2, 'jpg', $uploadedfile);
if (!copy($uploaded, "$dir/$uploadedfile") || !copy($uploaded2, "$dir/small/$uploadedfile2"))
{
//display errors
echo 'Server error (can\'t upload).<br>';
echo '<a href="detailvideo.php?idalbum='.$idalbum.'" class="lien1"><b>'.$l_Retour.'</a></b>.</font>';
exit();
}
//or finish
else
{
chmod("$dir/$uploadedfile", 0777 );
chmod("$dir/small/$uploadedfile2", 0777 );
rename($dir.'/small/'.$uploadedfile2, $dir.'/small/'.str_replace($extension, 'jpg', $uploadedfile));
$newfile = $idalbum.'_'.$uploadedfile;
$newalbum = addslashes($nom_album[0]);
$newcat = addslashes($rowcat1[0]);
$date = date("Y-m-d");
$sql = "INSERT INTO mcgallery_video (file, idalbum, album, cat, add_date) VALUES('$newfile', $idalbum, '$newalbum', '$newcat', '$date')";
mysql_query($sql);
$dir = '../videos/'.$idalbum;
echo '<form method="post" enctype="multipart/form-data" action="detailvideo.php">';
echo '<table border="0" align="center" cellspacing="1" cellpadding="3" bgcolor="#000000">';
echo '<tr><td bgcolor="#DDDDDD" align="center" colspan="5"><font face="verdana" size="2" color="black">';
echo $l_Addvideo.' <b>'.stripslashes($nom_album[0]).'</b></font></td>';
echo '<td bgcolor="#000000" align="left"><font face="verdana" size="1" color="white">'.$l_Video.': </font><input type="file" name="uploadedfile" size="25">';
echo '</td>';
echo '<td bgcolor="#000000" align="left"><font face="verdana" size="1" color="white">'.$l_Thumb.': </font><input type="file" name="uploadedfile2" size="25">';
echo '</td>';
echo ' <input type="hidden" name="idalbum" value="'.$idalbum.'">';
echo ' <input type="hidden" name="album" value="'.stripslashes($nom_album[0]).'">';
echo '<input type="hidden" name="func" value="two">';
echo '<td bgcolor="#000000"><input type="submit" name="submitfile" value="OK"></td></tr>';
echo '</table></form>';
}
}
break;
echo '</td></tr></table>';
}
?>