199 lines
7.2 KiB
PHP
199 lines
7.2 KiB
PHP
<?php
|
|
|
|
$creator_name;
|
|
$creator_pb;
|
|
$creator_jinxxyURL;
|
|
|
|
$content_name;
|
|
$content_price;
|
|
$content_rating;
|
|
|
|
$content_creator_id;
|
|
$content_currency_id;
|
|
|
|
$content_url;
|
|
$content_image;
|
|
|
|
$userData;
|
|
$productData;
|
|
|
|
$data = json_decode($_POST["data"]);
|
|
|
|
//print_r($data);
|
|
|
|
$product = $data->product;
|
|
$seller = $data->seller;
|
|
|
|
|
|
// set creator name
|
|
$creator_name = $seller->name;
|
|
|
|
// set creator jinxxy url
|
|
$creator_jinxxyURL = $seller->url;
|
|
|
|
// set creator pb
|
|
$creator_pb = $seller->image;
|
|
|
|
|
|
|
|
// set content name
|
|
$content_name = $product->name;
|
|
|
|
// set content price
|
|
$content_price = $product->price;
|
|
|
|
// set procuct url
|
|
$content_url = $product->url;
|
|
|
|
// set content image
|
|
$content_image = $product->image;
|
|
|
|
// set no rating
|
|
$content_rating = "null";
|
|
|
|
// currency type
|
|
$currency_currency = $product->currencySymbol;
|
|
|
|
$databaseConnection = new mysqli("10.0.0.200", "furatalog_usr", "1yRNpaUtXu[cw@-m", "furatalog");
|
|
$result = $databaseConnection->query("SELECT * FROM `currency` WHERE symbol=\"" . $currency_currency . "\";")->fetch_assoc();
|
|
|
|
$content_currency_id = $result["id"];
|
|
$currency_tag = $result["currency"];
|
|
|
|
$result2 = $databaseConnection->query("SELECT * FROM `creator` WHERE jinxxy_url=\"" . $creator_jinxxyURL . "\";");
|
|
|
|
if ($result2->num_rows > 0) {
|
|
$content_creator_id = $result2->fetch_assoc()["id"];
|
|
} else {
|
|
$content_creator_id = "";
|
|
}
|
|
|
|
|
|
/*
|
|
echo '<br><span style="font-family: consolas">Creator Name </span>' . $creator_name;
|
|
echo '<br><span style="font-family: consolas">Creator PB </span>' . $creator_pb;
|
|
echo '<br><span style="font-family: consolas">Creator JinxxyURL </span>' . $creator_jinxxyURL;
|
|
echo '<br>';
|
|
echo '<br>';
|
|
echo '<br>';
|
|
echo '<br><span style="font-family: consolas">Content Name </span>' . $content_name;
|
|
echo '<br><span style="font-family: consolas">Content Price </span>' . $content_price;
|
|
echo '<br><span style="font-family: consolas">Content Rating </span>' . $content_rating;
|
|
echo '<br>';
|
|
echo '<br><span style="font-family: consolas">Content CreatorID </span>' . $content_creator_id;
|
|
echo '<br><span style="font-family: consolas">Content CurrencyID </span>' . $content_currency_id;
|
|
echo '<br>';
|
|
echo '<br><span style="font-family: consolas">Content URL </span>' . $content_url;
|
|
echo '<br><span style="font-family: consolas">Content Image </span>' . $content_image;
|
|
echo '<br>';
|
|
echo '<br><span style="font-family: consolas">Currency Code </span>' . $currency_currency;
|
|
*/
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<?php echo file_get_contents("/var/www/furatalog-cdn/mainHead-Admin.html"); ?>
|
|
<title>Insert From Jinxxy - Admin Panel - Furatalog.xyz</title>
|
|
<style>
|
|
html, body {
|
|
margin: 0;
|
|
height: 100%;
|
|
padding: 0;
|
|
}
|
|
|
|
.insert form input[type="text"] {
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="sidebar">
|
|
<a href="logout.php">Logout</a>
|
|
<a href="/admin/">Dashboard</a>
|
|
<a href="/admin/insert.php">Insert Data (Gumroad)</a>
|
|
<a href="/admin/insert-species.php">Insert Species</a>
|
|
<a href="/admin/redirectFromJinxxy.php" class="active">Insert Data (Jinxxy)</a>
|
|
</div>
|
|
<div class="content">
|
|
<div class="insert" style="height: 100%;">
|
|
<?php
|
|
if (isset($_GET["has"]) && $_GET["has"] == "success") {
|
|
echo "<h2 style=\"color: var(--clr-primary-a0)\">Import Success!</h2>";
|
|
echo "<p>The Item with the following name and url has been added. <br>
|
|
Name: " . $_GET["msg"] . "</p>";
|
|
} else if (isset($_GET["has"]) && $_GET["has"] == "failed") {
|
|
echo "<h2 style=\"color: #ff3f3f\">Error while Importing</h2>";
|
|
echo "<p>An Error has Occurred <br>
|
|
Error: " . $_GET["msg"] . "</p>";
|
|
|
|
}
|
|
?>
|
|
<form action="insert-jinxxy.php" method="post" style="height: 100%; width:50%;">
|
|
<select name="section" id="section">
|
|
<option value="1">Assets</option>
|
|
<option value="2">Avatars</option>
|
|
<option value="3">Bases</option>
|
|
<option value="4">Worlds</option>
|
|
</select>
|
|
<div class="specieslist">
|
|
<?php
|
|
$furatalog = new mysqli("10.0.0.200", "furatalog_admin_usr", "NR6tLk7c56bPT5[]", "furatalog");
|
|
$requestSpeciesResult = $furatalog->query("SELECT * FROM `species`");
|
|
while ($row = $requestSpeciesResult->fetch_assoc()) {
|
|
echo "
|
|
<label>
|
|
<input type=\"checkbox\" name=\"" . $row["tag"] . "\">" . $row["name"] . "
|
|
</label>";
|
|
}
|
|
?>
|
|
</div>
|
|
<br>
|
|
<input type="text" name="creator_name" value="<?php echo $creator_name; ?>">
|
|
<input type="text" name="creator_pb" value="<?php echo $creator_pb; ?>">
|
|
<input type="text" name="creator_jinxxyURL" value="<?php echo $creator_jinxxyURL; ?>">
|
|
<input type="text" name="content_name" value="<?php echo $content_name; ?>">
|
|
<input type="text" name="content_price" value="<?php echo $content_price; ?>">
|
|
<input type="text" name="content_rating" value="<?php echo $content_rating; ?>">
|
|
<input type="text" name="content_creator_id" value="<?php echo $content_creator_id; ?>">
|
|
<input type="text" name="content_currency_id" value="<?php echo $content_currency_id; ?>">
|
|
<input type="text" name="content_url" value="<?php echo $content_url; ?>">
|
|
<input type="text" name="content_image" value="<?php echo $content_image; ?>">
|
|
<input type="text" name="currency_currency" value="<?php echo $currency_tag; ?>">
|
|
<input type="text" name="species" id="speciesIncluded" style="display: none;" value="props">
|
|
<input type="submit" value="Insert">
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
// Select all checkboxes and the result input field
|
|
const checkboxes = document.querySelectorAll('input[type="checkbox"]');
|
|
const resultInput = document.getElementById('speciesIncluded');
|
|
|
|
// Function to update the result input field
|
|
function updateResult() {
|
|
const selectedNames = Array.from(checkboxes) // Convert NodeList to Array
|
|
.filter(checkbox => checkbox.checked) // Filter only checked checkboxes
|
|
.map(checkbox => checkbox.name); // Map to their name attributes
|
|
|
|
// Join the names with a comma and update the result input
|
|
resultInput.value = selectedNames.join(' ');
|
|
|
|
if (resultInput.value == "" || resultInput.value == " ") {
|
|
resultInput.value = "props";
|
|
}
|
|
}
|
|
|
|
// Add event listeners to all checkboxes
|
|
checkboxes.forEach(checkbox => {
|
|
checkbox.addEventListener('change', updateResult); // Listen for 'change' event
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|