<?php
declare(strict_types=1);require __DIR__.'/bootstrap.php';require_admin();
$tab=(string)($_GET['tab']??'products');$msg='';
$themes=['Kingdom of Happiness','Cricket Legend','Football Champion','Army Mission','Racing Adventure','Sea Explorer','Police Officer','Dragon Kingdom','Dinosaur Island','Superhero Child','Treasure Hunter','Underwater Kingdom','Space Explorer','Sundarbans Explorer','Magic School','Rainbow Unicorn Land','Royal Adventure','Little Doctor','Young Scientist','Pilot Adventure','Firefighter Hero','Environmental Protector','Little Detective','Time Travel Adventure','Candy Kingdom','Robot Future City','Sonargaon Heritage Quest','Lalbagh Fort Mystery',"Cox's Bazar Turtle Rescue","Saint Martin Coral Guardian",'Tea Garden Adventure','Padma River Explorer','Nakshi Kantha Secret','Pohela Boishakh Art Quest','Future Architect','Young Chef Challenge','Wildlife Veterinarian','Young Entrepreneur','Moon Base Commander','Weather Scientist','Journey Inside the Human Body','Dolphin Rescue','Elephant Family Journey','Penguin Island Rescue','Butterfly Garden','My First Day at School','My Feelings Superpower','The Anti-Bullying Team','Ramadan Kindness Mission','Eid Moon Adventure'];
function slugify(string $v):string{$v=strtolower(trim($v));$v=preg_replace('/[^a-z0-9]+/','-',$v);return trim((string)$v,'-').'-'.substr(bin2hex(random_bytes(3)),0,6);}
if($_SERVER['REQUEST_METHOD']==='POST'){check_csrf();$act=(string)($_POST['action']??'');try{
 if($act==='save_product'){$id=(int)($_POST['id']??0);$title=trim((string)$_POST['title']);$titleBn=trim((string)($_POST['title_bn']??''));$theme=trim((string)$_POST['theme']);$summary=trim((string)$_POST['summary']);$summaryBn=trim((string)($_POST['summary_bn']??''));$price=max(0,(float)$_POST['price']);if(!$title||!$theme||!$summary)throw new RuntimeException('English title, theme and summary are required.');$old=null;if($id){$s=$pdo->prepare('SELECT * FROM store_products WHERE id=?');$s->execute([$id]);$old=$s->fetch();} $cover=upload_image('cover','store-cover')?:($old['cover_image']??null);$gallery=$old?json_decode((string)$old['gallery_json'],true):[];$gallery=is_array($gallery)?$gallery:[];foreach($_FILES['gallery']['tmp_name']??[] as $i=>$tmp){if(!$tmp)continue;$_FILES['_gallery']=['name'=>$_FILES['gallery']['name'][$i],'type'=>$_FILES['gallery']['type'][$i],'tmp_name'=>$tmp,'error'=>$_FILES['gallery']['error'][$i],'size'=>$_FILES['gallery']['size'][$i]];$img=upload_image('_gallery','store-slide');if($img)$gallery[]=$img;} $gallery=array_slice(array_values(array_unique($gallery)),0,3);if($id){$s=$pdo->prepare('UPDATE store_products SET title=?,title_bn=?,theme=?,summary=?,summary_bn=?,price=?,cover_image=?,gallery_json=?,active=? WHERE id=?');$s->execute([$title,$titleBn,$theme,$summary,$summaryBn,$price,$cover,json_encode($gallery),isset($_POST['active'])?1:0,$id]);}else{$s=$pdo->prepare('INSERT INTO store_products(title,title_bn,slug,theme,summary,summary_bn,price,cover_image,gallery_json,active) VALUES(?,?,?,?,?,?,?,?,?,?)');$s->execute([$title,$titleBn,slugify($title),$theme,$summary,$summaryBn,$price,$cover,json_encode($gallery),isset($_POST['active'])?1:0]);}$msg='Product saved.';$tab='products';}
 if($act==='delete_product'){$s=$pdo->prepare('DELETE FROM store_products WHERE id=? AND NOT EXISTS(SELECT 1 FROM store_orders WHERE product_id=store_products.id)');$s->execute([(int)$_POST['id']]);$msg=$s->rowCount()?'Product deleted.':'Product with orders cannot be deleted; make it inactive.';}
 if($act==='save_coupon'){$code=strtoupper(preg_replace('/[^A-Za-z0-9_-]/','',trim((string)$_POST['code'])));if(!$code)throw new RuntimeException('Coupon code required.');$s=$pdo->prepare('INSERT INTO store_coupons(code,discount_type,discount_value,active,expires_at) VALUES(?,?,?,?,?) ON DUPLICATE KEY UPDATE discount_type=VALUES(discount_type),discount_value=VALUES(discount_value),active=VALUES(active),expires_at=VALUES(expires_at)');$s->execute([$code,$_POST['discount_type']==='percent'?'percent':'fixed',max(0,(float)$_POST['discount_value']),isset($_POST['active'])?1:0,$_POST['expires_at']?:null]);$msg='Coupon saved.';$tab='coupons';}
 if($act==='delete_coupon'){$pdo->prepare('DELETE FROM store_coupons WHERE id=?')->execute([(int)$_POST['id']]);$msg='Coupon deleted.';$tab='coupons';}
 if($act==='save_slider'){$id=(int)($_POST['id']??0);$old=[];if($id){$s=$pdo->prepare('SELECT * FROM store_sliders WHERE id=?');$s->execute([$id]);$old=$s->fetch()?:[];}$desktop=upload_image('desktop_image','homepage-desktop')?:($old['desktop_image']??null);$mobile=upload_image('mobile_image','homepage-mobile')?:($old['mobile_image']??null);if(!$desktop)throw new RuntimeException('Desktop slider image is required.');$data=[trim((string)($_POST['title']??'')),trim((string)($_POST['subtitle']??'')),$desktop,$mobile,trim((string)($_POST['button_text']??'')),trim((string)($_POST['button_url']??'')),(int)($_POST['sort_order']??0),isset($_POST['active'])?1:0];if($id){$data[]=$id;$pdo->prepare('UPDATE store_sliders SET title=?,subtitle=?,desktop_image=?,mobile_image=?,button_text=?,button_url=?,sort_order=?,active=? WHERE id=?')->execute($data);}else{$pdo->prepare('INSERT INTO store_sliders(title,subtitle,desktop_image,mobile_image,button_text,button_url,sort_order,active) VALUES(?,?,?,?,?,?,?,?)')->execute($data);}$msg='Homepage slider saved.';$tab='sliders';}
 if($act==='delete_slider'){$pdo->prepare('DELETE FROM store_sliders WHERE id=?')->execute([(int)$_POST['id']]);$msg='Slider deleted.';$tab='sliders';}
 if($act==='settings'){$notify=trim((string)($_POST['notification_email']??''));$from=trim((string)($_POST['mail_from_email']??''));if($notify!==''&&!filter_var($notify,FILTER_VALIDATE_EMAIL))throw new RuntimeException('Enter a valid business notification email.');if($from!==''&&!filter_var($from,FILTER_VALIDATE_EMAIL))throw new RuntimeException('Enter a valid sender email.');$keys=['site_name','topbar_text','topbar_text_bn','whatsapp_number','messenger_url','notification_email','mail_from_email','mail_from_name','facebook_pixel','facebook_dataset_id','facebook_domain_verification','seo_title','seo_description','seo_keywords','canonical_url'];foreach($keys as $key)save_store_setting($pdo,$key,trim((string)($_POST[$key]??'')));$oldSettings=store_settings($pdo);$logo=upload_image('site_logo','site-logo');if($logo)save_store_setting($pdo,'site_logo',$logo);$og=upload_image('seo_og_image','seo-og');if($og)save_store_setting($pdo,'seo_og_image',$og);$token=trim((string)($_POST['facebook_access_token']??''));if($token!=='')save_store_setting($pdo,'facebook_access_token',$token);$msg='Website settings saved.';$tab='settings';}
 if($act==='order_status'){$status=in_array($_POST['status']??'',['placed','production','review','confirmed','delivery','delivered','canceled'],true)?$_POST['status']:'placed';$pdo->prepare('UPDATE store_orders SET status=? WHERE id=?')->execute([$status,(string)$_POST['id']]);$msg='Order updated.';$tab='orders';}
}catch(Throwable $e){$msg=$e->getMessage();}}
$products=$pdo->query('SELECT * FROM store_products ORDER BY sort_order,title')->fetchAll();$coupons=$pdo->query('SELECT * FROM store_coupons ORDER BY id DESC')->fetchAll();$orders=$pdo->query("SELECT o.*,p.title product_title,COALESCE(em.admin_sent,0) admin_mail_sent,COALESCE(em.customer_sent,0) customer_mail_sent FROM store_orders o JOIN store_products p ON p.id=o.product_id LEFT JOIN (SELECT order_id,MAX(CASE WHEN email_type='admin' THEN sent ELSE 0 END) admin_sent,MAX(CASE WHEN email_type='customer' THEN sent ELSE 0 END) customer_sent FROM store_email_log GROUP BY order_id) em ON em.order_id=o.id ORDER BY o.created_at DESC")->fetchAll();$sliders=$pdo->query('SELECT * FROM store_sliders ORDER BY sort_order,id')->fetchAll();$settings=store_settings($pdo);$edit=null;$editSlider=null;if(isset($_GET['edit'])){foreach($products as $p)if((int)$p['id']===(int)$_GET['edit'])$edit=$p;}if(isset($_GET['edit_slider'])){foreach($sliders as $s)if((int)$s['id']===(int)$_GET['edit_slider'])$editSlider=$s;}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>StoryBook Store Admin</title>
<link rel="stylesheet" href="assets/store.css">
</head>
<body>
<div class="admin">
<aside class="sidebar">
<div class="logo" style="color:white;margin-bottom:25px">Store Admin</div>
<a href="store-admin.php?tab=products">Products</a>
<a href="store-admin.php?tab=orders">Store Orders</a>
<a href="store-admin.php?tab=coupons">Coupons</a>
<a href="store-admin.php?tab=sliders">Homepage Slider</a>
<a href="store-admin.php?tab=settings">Website Settings</a>
<a href="index.php" target="_blank">View Storefront ↗</a>
<a href="cms.php">← StoryBook CMS</a>
</aside>
<main class="adminmain">
<?php if($msg):?>
<div class="notice">
<?=e($msg)?>
</div>
<?php endif?>
<?php if($tab==='products'):?>
<h1>StoryBook Products <small>(<?=count($products)?> ready themes)</small></h1>
<div class="notice">All 50 story products are added automatically with English and Bangla titles, summaries and default price. Normally you only need to open Edit and upload the book cover plus 2–3 gallery images.</div>
<div class="panel">
<h2>
<?=$edit?'Edit product':'Add new product'?>
</h2>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf" value="<?=e(csrf())?>">
<input type="hidden" name="action" value="save_product">
<input type="hidden" name="id" value="<?=e((string)($edit['id']??''))?>">
<div class="fields">
<div>
<label>Story title</label>
<input name="title" required value="<?=e($edit['title']??'')?>">
</div>
<div>
<label>গল্পের বাংলা নাম</label>
<input name="title_bn" value="<?=e($edit['title_bn']??'')?>">
</div>
<div>
<label>CMS story theme</label>
<select name="theme" required>
<?php foreach($themes as $t):?>
<option <?=$t===($edit['theme']??'')?'selected':''?>>
<?=e($t)?>
</option>
<?php endforeach?>
</select>
</div>
<div>
<label>Price (৳)</label>
<input type="number" min="0" name="price" required value="<?=e((string)($edit['price']??''))?>">
</div>
<div>
<label>Book cover</label>
<input type="file" name="cover" accept="image/jpeg,image/png,image/webp">
</div>
<div class="field full">
<label>Summary</label>
<textarea name="summary" required>
<?=e($edit['summary']??'')?>
</textarea>
</div>
<div class="field full">
<label>বাংলা সারাংশ</label>
<textarea name="summary_bn"><?=e($edit['summary_bn']??'')?></textarea>
</div>
<div class="field full">
<label>Product gallery images (select 2–3 images)</label>
<input type="file" name="gallery[]" multiple accept="image/jpeg,image/png,image/webp">
</div>
<div>
<label>
<input style="width:auto" type="checkbox" name="active" <?=!$edit||(int)$edit['active']?'checked':''?>> Active in store</label>
</div>
</div>
<button class="btn" style="margin-top:15px">Save product</button>
</form>
</div>
<h2 style="margin-top:28px">All products</h2>
<div class="tablewrap">
<table class="table">
<tr>
<th>Book</th>
<th>Theme</th>
<th>Price</th>
<th>Status</th>
<th>Actions</th>
</tr>
<?php foreach($products as $p):?>
<tr>
<td>
<b>
<?=e($p['title'])?>
</b>
</td>
<td>
<?=e($p['theme'])?>
</td>
<td>
<?=money($p['price'])?>
</td>
<td>
<?=$p['active']?'Active':'Hidden'?>
</td>
<td>
<a href="?tab=products&edit=<?=$p['id']?>">Edit</a> · <a target="_blank" href="index.php?book=<?=e($p['slug'])?>">View</a> <form method="post" style="display:inline" onsubmit="return confirm('Delete this product?')">
<input type="hidden" name="csrf" value="<?=e(csrf())?>">
<input type="hidden" name="action" value="delete_product">
<input type="hidden" name="id" value="<?=$p['id']?>">
<button style="border:0;background:none;color:#a22;cursor:pointer">Delete</button>
</form>
</td>
</tr>
<?php endforeach?>
</table>
</div>
<?php elseif($tab==='orders'):?>
<h1>Store Orders</h1>
<div class="tablewrap">
<table class="table">
<tr>
<th>Date</th>
<th>Order</th>
<th>Customer</th>
<th>Personalize</th>
<th>Delivery</th>
<th>Total</th>
<th>Email</th>
<th>Status</th>
</tr>
<?php foreach($orders as $o):?>
<tr>
<td>
<?=e(substr($o['created_at'],0,16))?>
</td>
<td>
<b>
<?=e($o['product_title'])?>
</b>
<br>
<small>
<?=e($o['id'])?>
</small>
</td>
<td>
<?=e($o['customer_name'])?>
<br>
<?=e($o['phone'])?>
<?php if($o['customer_email']):?><br><?=e($o['customer_email'])?><?php endif?>
<br>
<small>
<?=e($o['delivery_address'])?>
</small>
</td>
<td>
<?=e($o['character_name'])?> · <?=e($o['character_age'])?> · <?=e($o['character_gender'])?>
<br>
<small>Book language: <?=($o['book_language']??'en')==='bn'?'Bangla':'English'?></small>
<br>
<?php $extra=json_decode((string)($o['extra_photos_json']??''),true);$extra=is_array($extra)?$extra:[];?>
<?php if($o['baby_photo']):?><a href="<?=e($o['baby_photo'])?>" target="_blank">Face photo</a><?php endif?><?php foreach($extra as $i=>$photo):?> · <a href="<?=e($photo)?>" target="_blank">Photo <?=$i+2?></a><?php endforeach?>
<br>
<small>
<?=e($o['notes'])?>
</small>
</td>
<td>
<?=e($o['delivery_zone'])?> · <?=money($o['delivery_fee'])?>
</td>
<td>
<b>
<?=money($o['total'])?>
</b>
<?php if($o['coupon_code']):?>
<br>
<small>
<?=e($o['coupon_code'])?> −<?=money($o['discount'])?>
</small>
<?php endif?>
</td>
<td><small>Admin: <?=$o['admin_mail_sent']?'Sent':'Not sent'?><br>Customer: <?=$o['customer_email']?($o['customer_mail_sent']?'Sent':'Not sent'):'No email'?></small></td>
<td>
<form method="post">
<input type="hidden" name="csrf" value="<?=e(csrf())?>">
<input type="hidden" name="action" value="order_status">
<input type="hidden" name="id" value="<?=e($o['id'])?>">
<select name="status" onchange="this.form.submit()">
<?php foreach(STATUSES as $s):?>
<option <?=$s===$o['status']?'selected':''?>>
<?=$s?>
</option>
<?php endforeach?>
</select>
</form>
</td>
</tr>
<?php endforeach?>
</table>
</div>
<?php elseif($tab==='coupons'):?>
<h1>Coupon System</h1>
<div class="panel">
<form method="post">
<input type="hidden" name="csrf" value="<?=e(csrf())?>">
<input type="hidden" name="action" value="save_coupon">
<div class="fields">
<div>
<label>Coupon code</label>
<input name="code" required placeholder="WELCOME100">
</div>
<div>
<label>Discount type</label>
<select name="discount_type">
<option value="fixed">Fixed ৳</option>
<option value="percent">Percent %</option>
</select>
</div>
<div>
<label>Discount value</label>
<input type="number" min="0" name="discount_value" required>
</div>
<div>
<label>Expiry date (optional)</label>
<input type="date" name="expires_at">
</div>
<div>
<label>
<input style="width:auto" type="checkbox" name="active" checked> Active</label>
</div>
</div>
<button class="btn" style="margin-top:15px">Save coupon</button>
</form>
</div>
<div class="tablewrap" style="margin-top:25px">
<table class="table">
<tr>
<th>Code</th>
<th>Discount</th>
<th>Expiry</th>
<th>Status</th>
<th>
</th>
</tr>
<?php foreach($coupons as $c):?>
<tr>
<td>
<b>
<?=e($c['code'])?>
</b>
</td>
<td>
<?=e($c['discount_type'])?> · <?=e((string)$c['discount_value'])?>
</td>
<td>
<?=e($c['expires_at']??'No expiry')?>
</td>
<td>
<?=$c['active']?'Active':'Inactive'?>
</td>
<td>
<form method="post">
<input type="hidden" name="csrf" value="<?=e(csrf())?>">
<input type="hidden" name="action" value="delete_coupon">
<input type="hidden" name="id" value="<?=$c['id']?>">
<button>Delete</button>
</form>
</td>
</tr>
<?php endforeach?>
</table>
</div>
<?php elseif($tab==='sliders'):?>
<h1>Homepage Slider</h1>
<div class="panel">
<h2>
<?=$editSlider?'Edit slide':'Add new slide'?>
</h2>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf" value="<?=e(csrf())?>">
<input type="hidden" name="action" value="save_slider">
<input type="hidden" name="id" value="<?=e((string)($editSlider['id']??''))?>">
<div class="fields">
<div>
<label>Title</label>
<input name="title" value="<?=e($editSlider['title']??'')?>">
</div>
<div>
<label>Sort order</label>
<input type="number" name="sort_order" value="<?=e((string)($editSlider['sort_order']??0))?>">
</div>
<div class="field full">
<label>Subtitle</label>
<textarea name="subtitle">
<?=e($editSlider['subtitle']??'')?>
</textarea>
</div>
<div>
<label>Desktop image *</label>
<input type="file" name="desktop_image" accept="image/jpeg,image/png,image/webp">
</div>
<div>
<label>Mobile image (optional)</label>
<input type="file" name="mobile_image" accept="image/jpeg,image/png,image/webp">
</div>
<div>
<label>Button text</label>
<input name="button_text" value="<?=e($editSlider['button_text']??'Explore Books')?>">
</div>
<div>
<label>Button URL</label>
<input name="button_url" value="<?=e($editSlider['button_url']??'#books')?>">
</div>
<div>
<label>
<input style="width:auto" type="checkbox" name="active" <?=!$editSlider||(int)$editSlider['active']?'checked':''?>> Active</label>
</div>
</div>
<button class="btn" style="margin-top:15px">Save slide</button>
</form>
</div>
<div class="tablewrap" style="margin-top:25px">
<table class="table">
<tr>
<th>Preview</th>
<th>Title</th>
<th>Order</th>
<th>Status</th>
<th>Actions</th>
</tr>
<?php foreach($sliders as $s):?>
<tr>
<td>
<img src="<?=e($s['desktop_image'])?>" alt="" style="width:100px;height:55px;object-fit:cover;border-radius:6px">
</td>
<td>
<?=e($s['title'])?>
</td>
<td>
<?=e((string)$s['sort_order'])?>
</td>
<td>
<?=$s['active']?'Active':'Hidden'?>
</td>
<td>
<a href="?tab=sliders&edit_slider=<?=$s['id']?>">Edit</a> <form method="post" style="display:inline" onsubmit="return confirm('Delete this slide?')">
<input type="hidden" name="csrf" value="<?=e(csrf())?>">
<input type="hidden" name="action" value="delete_slider">
<input type="hidden" name="id" value="<?=$s['id']?>">
<button>Delete</button>
</form>
</td>
</tr>
<?php endforeach?>
</table>
</div>
<?php else:?>
<h1>Website Settings</h1>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf" value="<?=e(csrf())?>">
<input type="hidden" name="action" value="settings">
<div class="panel">
<h2>Brand & Contact</h2>
<div class="fields">
<div>
<label>Website / brand name</label>
<input name="site_name" value="<?=e($settings['site_name']??'Personalized StoryBook')?>">
</div>
<div>
<label>Header logo</label>
<input type="file" name="site_logo" accept="image/jpeg,image/png,image/webp">
</div>
<div class="field full">
<label>Top bar text</label>
<input name="topbar_text" value="<?=e($settings['topbar_text']??'Your child. Their face. Their name. Their unforgettable adventure.')?>">
</div>
<div>
<label>Top bar text (Bangla)</label>
<input name="topbar_text_bn" value="<?=e($settings['topbar_text_bn']??'আপনার শিশু। তার নিজের গল্প। তার অবিস্মরণীয় অভিযান।')?>">
</div>
<div>
<label>WhatsApp number (country codeসহ)</label>
<input name="whatsapp_number" value="<?=e($settings['whatsapp_number']??'')?>" placeholder="8801XXXXXXXXX">
</div>
<div>
<label>Facebook Messenger URL</label>
<input name="messenger_url" value="<?=e($settings['messenger_url']??'')?>" placeholder="https://m.me/yourpage">
</div>
</div>
</div>
<div class="panel" style="margin-top:20px">
<h2>Order Email Notifications</h2>
<p class="summary">A new storefront order sends full details to your business email and a confirmation to the customer when they provide an email address. Use an email address created on this cPanel domain as the sender for best delivery.</p>
<div class="fields">
<div>
<label>Admin / business notification email</label>
<input type="email" name="notification_email" value="<?=e($settings['notification_email']??'')?>" placeholder="orders@yourdomain.com">
</div>
<div>
<label>Sender email (same website domain)</label>
<input type="email" name="mail_from_email" value="<?=e($settings['mail_from_email']??'')?>" placeholder="no-reply@yourdomain.com">
</div>
<div>
<label>Sender name</label>
<input name="mail_from_name" value="<?=e($settings['mail_from_name']??($settings['site_name']??'Personalized StoryBook'))?>">
</div>
</div>
</div>
<div class="panel" style="margin-top:20px">
<h2>Facebook / Meta Tracking</h2>
<div class="fields">
<div>
<label>Facebook Pixel ID</label>
<input name="facebook_pixel" value="<?=e($settings['facebook_pixel']??'')?>" placeholder="123456789012345">
</div>
<div>
<label>Dataset ID (Pixel ID)</label>
<input name="facebook_dataset_id" value="<?=e($settings['facebook_dataset_id']??'')?>" placeholder="Defaults to Pixel ID">
</div>
<div class="field full">
<label>Conversions API Access Token</label>
<input type="password" name="facebook_access_token" value="" autocomplete="new-password" placeholder="Leave blank to keep the saved token">
<p class="summary">Token is stored server-side only and is never printed in Storefront HTML.</p>
</div>
<div class="field full">
<label>Facebook Domain Verification code</label>
<input name="facebook_domain_verification" value="<?=e($settings['facebook_domain_verification']??'')?>" placeholder="Meta verification code only">
</div>
</div>
</div>
<div class="panel" style="margin-top:20px">
<h2>Website SEO</h2>
<div class="fields">
<div>
<label>SEO title</label>
<input name="seo_title" value="<?=e($settings['seo_title']??'')?>">
</div>
<div>
<label>Canonical website URL</label>
<input name="canonical_url" value="<?=e($settings['canonical_url']??'')?>" placeholder="https://example.com/">
</div>
<div class="field full">
<label>Meta description</label>
<textarea name="seo_description">
<?=e($settings['seo_description']??'')?>
</textarea>
</div>
<div class="field full">
<label>Keywords</label>
<input name="seo_keywords" value="<?=e($settings['seo_keywords']??'')?>">
</div>
<div>
<label>Social share (OG) image</label>
<input type="file" name="seo_og_image" accept="image/jpeg,image/png,image/webp">
</div>
</div>
</div>
<button class="btn" style="margin-top:20px">Save Website Settings</button>
</form>
<?php endif?>
</main>
</div>
</body>
</html>
