wishthis/includes/pages/wishlist-product-add.php

53 lines
1.1 KiB
PHP
Raw Normal View History

2021-11-15 13:43:57 +00:00
<?php
/**
* wishlist.php
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/
use wishthis\Page;
use Embed\Embed;
2021-11-15 13:55:05 +00:00
if (isset($_POST['url'], $_POST['wishlist'])) {
$database->query('INSERT INTO `products`
(`wishlist`, `url`) VALUES
(' . $_POST['wishlist'] . ', "' . $_POST['url'] . '")
;');
}
2021-11-15 13:43:57 +00:00
$url = 'https://www.amazon.de/Adventskalender-2020-Schokolade-Weihnachtskalender-346g/dp/B08CTTP5JX';
$embed = new Embed();
$info = $embed->get($url);
2021-11-15 13:55:05 +00:00
// https://github.com/oscarotero/Embed
// echo '<pre>';
// var_dump($info);
// echo '</pre>';
2021-11-15 13:43:57 +00:00
2021-11-15 13:55:05 +00:00
$page = new page(__FILE__, 'Add a product');
2021-11-15 13:43:57 +00:00
$page->header();
?>
<main>
<section>
<h1>Add a product</h1>
<form method="post">
<fieldset>
<label>URL</label>
2021-11-15 13:55:05 +00:00
<input type="url" name="url" value="<?= $url ?>" />
</fieldset>
<fieldset>
<label>Wishlist</label>
<input type="number" name="wishlist" value="1" />
2021-11-15 13:43:57 +00:00
</fieldset>
<input type="submit" value="Add" />
</form>
</section>
</main>
<?php
$page->footer();