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

56 lines
1.7 KiB
PHP

<?require ("global.php");?>
<?php
$stamp = date("Ymdhis");
$filename = "";
$path = "";
$complete = "";
if (isset($_FILES['pic']['name']) && $_FILES['pic']['name'] != "")
{
$path = "$DOCUMENT_ROOT/tick/images/gallery/";
$filename = $stamp . preg_replace('/\s+/', '', basename($_FILES['pic']['name']));
$complete = $path . $filename;
move_uploaded_file($_FILES['pic']['tmp_name'], $complete);
chmod($complete, 0755);
$s = "/var/www/html/one/tick/scripts/pics.pl $filename --- 640";
exec("$s 2>&1", $updw);
$s = "/var/www/html/one/tick/scripts/pics.pl $filename t_ 130";
exec("$s 2>&1", $updw);
}
$stageID = 0;
if (isset($_POST['stageID'])) { $stageID = $_POST['stageID']; }
if ($stageID != 0)
{
$query = "INSERT INTO markers (stageID, icon, title, text, image, latitude, longitude) VALUES ("
. "'" . $stageID . "', "
. "'" . $_POST['icon'] . "', "
. "'" . myaddslashes($_POST['title']) . "', "
. "'" . myaddslashes($_POST['text']) . "', "
. "'" . $filename . "', "
. "'" . $_POST['latitude'] . "', "
. "'" . $_POST['longitude'] . "')";
$result = mysql_query($query, $db) or mysql_error($result);
}
if ($filename != "")
{
$big = "http://www.onemillionrevolutions.org/tick/images/gallery/${filename}\n";
$small = "http://www.onemillionrevolutions.org/tick/images/gallery/t_${filename}\n";
$file = "/var/www/html/one/tick/images/gallery/pic${ID}.txt";
if (!$file_handle = fopen($file,"a")) { echo "Cannot open file"; }
if (!fwrite($file_handle, $big)) { echo "Cannot write to file"; }
if (!fwrite($file_handle, $small)) { echo "Cannot write to file"; }
fclose($file_handle);
}
staticify($_POST['stageID']);
header("Location: /tick/markers.php");
?>