2025-05-29 23:10:56 +02:00
|
|
|
<?php
|
2025-07-19 15:57:10 +02:00
|
|
|
/*session_start();
|
2025-05-29 23:10:56 +02:00
|
|
|
if (!isset($_SESSION["login"]) && $_SESSION["login"] != "true-as-hell") {
|
|
|
|
|
header("Location: login.php");
|
|
|
|
|
die();
|
2025-07-19 15:57:10 +02:00
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
require_once("/var/www/furatalog/data/script/furatalog.sessions.php");
|
|
|
|
|
$fs = new furatalogSessions();
|
|
|
|
|
|
|
|
|
|
if (($fs->getSessionData("login") == null) && ($fs->getSessionData("login") != "true-as-hell")) {
|
|
|
|
|
header("Location: login.php");
|
|
|
|
|
die();
|
2025-05-29 23:10:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$furatalog = new mysqli("localhost", "furatalog_admin_usr", "NR6tLk7c56bPT5[]", "furatalog");
|
|
|
|
|
|
|
|
|
|
$creator_name = $_POST["creator_name"];
|
|
|
|
|
$creator_pb = $_POST["creator_pb"];
|
|
|
|
|
$creator_jinxxyURL = $_POST["creator_jinxxyURL"];
|
|
|
|
|
|
|
|
|
|
$content_name = $_POST["content_name"];
|
|
|
|
|
$content_price = $_POST["content_price"];
|
|
|
|
|
$content_rating = $_POST["content_rating"];
|
|
|
|
|
$content_creator_id = $_POST["content_creator_id"];
|
|
|
|
|
$content_currency_id = $_POST["content_currency_id"];
|
|
|
|
|
$content_url = $_POST["content_url"];
|
|
|
|
|
$content_image = $_POST["content_image"];
|
|
|
|
|
|
2025-06-10 14:02:43 +02:00
|
|
|
$section = $_POST["section"];
|
|
|
|
|
|
2025-05-29 23:10:56 +02:00
|
|
|
$currency_currency = $_POST["currency_currency"];
|
|
|
|
|
|
|
|
|
|
$creator;
|
|
|
|
|
$success = true;
|
|
|
|
|
|
2025-06-10 14:14:06 +02:00
|
|
|
$content_name = str_replace("'", "\'", $content_name);
|
|
|
|
|
|
2025-05-29 23:53:44 +02:00
|
|
|
try {
|
2025-05-29 23:26:19 +02:00
|
|
|
$creatorResult = $furatalog->query("SELECT * FROM `creator` WHERE `jinxxy_url`=\"" . $creator_jinxxyURL . "\";");
|
2025-05-29 23:53:44 +02:00
|
|
|
if ($creatorResult->num_rows == 0) {
|
|
|
|
|
$furatalog->query("INSERT INTO `creator`(`name`, `pb_url`, `jinxxy_url`) VALUES ('" . $creator_name . "','" . $creator_pb . "','" . $creator_jinxxyURL . "')");
|
2025-05-29 23:26:19 +02:00
|
|
|
|
2025-05-29 23:53:44 +02:00
|
|
|
$creatorResult = $furatalog->query("SELECT * FROM `creator` WHERE `jinxxy_url`=\"" . $creator_jinxxyURL . "\";");
|
|
|
|
|
|
|
|
|
|
$creator = $creatorResult->fetch_assoc();
|
|
|
|
|
} else {
|
|
|
|
|
$creator = $creatorResult->fetch_assoc();
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
echo "cannot get or create creator";
|
|
|
|
|
die();
|
2025-05-29 23:10:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$contentResult = $furatalog->query("SELECT * FROM `content` WHERE `url`=\"" . $content_url . "\";");
|
|
|
|
|
|
|
|
|
|
if ($contentResult->num_rows == 0) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$furatalog->query("INSERT INTO `content`(`name`, `price`, `rating`, `creator_id`, `currency_id`, `url`, `image`, `nsfw`, `section`) VALUES
|
|
|
|
|
('" . $content_name . "'
|
|
|
|
|
,'" . $content_price . "'
|
|
|
|
|
,'" . $content_rating . "'
|
|
|
|
|
,'" . $creator["id"] . "'
|
|
|
|
|
,'" . $content_currency_id . "'
|
|
|
|
|
,'" . $content_url . "'
|
|
|
|
|
,'" . $content_image . "'
|
|
|
|
|
, false
|
2025-06-10 14:02:43 +02:00
|
|
|
, " . $section . ")");
|
2025-05-29 23:10:56 +02:00
|
|
|
|
|
|
|
|
|
2025-05-29 23:14:57 +02:00
|
|
|
|
2025-05-29 23:10:56 +02:00
|
|
|
$parsed_url = parse_url($content_url);
|
|
|
|
|
$clean_url = $parsed_url['scheme'] . '://' . $parsed_url['host'] . $parsed_url['path'];
|
|
|
|
|
|
|
|
|
|
$contentResult = $furatalog->query("SELECT * FROM content WHERE url LIKE '%" . $clean_url . "%'");
|
|
|
|
|
$contentResultResult = $contentResult->fetch_assoc();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$species = explode(" ", $_POST["species"]);
|
|
|
|
|
|
|
|
|
|
foreach ($species as $key => $value) {
|
|
|
|
|
$speciesResult = $furatalog->query("SELECT * FROM species WHERE tag='" . $value . "'");
|
|
|
|
|
$speciesResultResult = $speciesResult->fetch_assoc();
|
|
|
|
|
|
|
|
|
|
$speciesID = $speciesResultResult["id"];
|
|
|
|
|
|
|
|
|
|
$furatalog->query("INSERT INTO `content_species` (`content_id`, `species_id`) VALUES ('" . $contentResultResult["id"] . "', '" . $speciesID . "')");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
echo "
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<style>
|
|
|
|
|
* {
|
|
|
|
|
background: darkgray;
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<p style=\"color:lightred\">An Error has Occurred</p>
|
|
|
|
|
<div>" . $e . "</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>";
|
|
|
|
|
$success = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($success) {
|
|
|
|
|
echo "<html>
|
|
|
|
|
<head>
|
|
|
|
|
<style>
|
|
|
|
|
* {
|
|
|
|
|
background: darkgray;
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<p style=\"color:lightred\">Success</p>
|
|
|
|
|
<div>The Item with the following name and url has been added. <br>
|
|
|
|
|
Name: " . $content_name . "</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|