discourse-legacysite-perl/site/slowtwitch.com/www/tick/videos_add.php
2024-06-17 22:30:36 +10:00

58 lines
1.6 KiB
PHP

<?require ("global.php");?>
<?php
$ID = 0;
list($msec, $sec) = explode(" ", microtime());
$stamp = date("Ymdhis") . substr($msec, 4);
$filename = "";
$path = "";
$complete = "";
$url = "";
$sql = "";
if (isset($_POST['ID'])) { $ID = $_POST['ID']; }
if (isset($_FILES['thumbnail']['name']) && $_FILES['thumbnail']['name'] != "")
{
$path = "$DOCUMENT_ROOT/tick/images/gallery/";
$pieces = preg_split('/\./', basename($_FILES['thumbnail']['name']));
$filename = "t_" . $stamp . "." . $pieces[1];
$complete = $path . $filename;
move_uploaded_file($_FILES['thumbnail']['tmp_name'], $complete);
chmod($complete, 0755);
$s = "/var/home/slowtwitch/slowtwitch.com/www/tick/scripts/pics.pl $filename --- 130";
exec("$s 2>&1", $updw);
$url = "/tick/images/gallery/";
$sql = "thumbname = '" . $filename . "', thumburl = '" . $url . "', ";
}
if ($ID != 0)
{
$query = "UPDATE videos SET "
. $sql
. "link = '" . $_POST['link'] . "',"
. "caption = '" . myaddslashes($_POST['caption']) . "',"
. "courtesy_of = '" . myaddslashes($_POST['courtesy_of']) . "' "
. "WHERE ID = '$ID'";
$result = mysql_query($query, $db);
}
else
{
$query = "INSERT INTO videos (stageID,thumbname,thumburl,link,caption,courtesy_of,default_flag) VALUES ('"
. $_POST['stageID'] . "','"
. $filename . "','"
. $url . "','"
. $_POST['link'] . "','"
. myaddslashes($_POST['caption']) . "','"
. myaddslashes($_POST['courtesy_of']) . "','"
. "no')";
$result = mysql_query($query, $db);
}
$file = "$DOCUMENT_ROOT/tick/images/gallery/pic" . $_POST['stageID'] . ".txt";
header("Location: /tick/videos.php");
?>