File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/admin3/adddemo.php
Back
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); include 'config.php'; session_start(); if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { header("Location: login.php"); exit; } $today = date('Y-m-d'); $showToast = isset($_GET['success']); // Handle Form Submission if ($_SERVER["REQUEST_METHOD"] === "POST") { $fields = [ 'c_name', 'ipokey', 'islive', 'img', 'm_application', 'rat', 'details', 'emoji', 'i_date', 'c_date', 'ipo_open', 'ipo_close', 'ipo_allotment', 'ipo_refund', 'ipo_credit', 'ipo_listing', 'status', 'suggestion', 'date', 'allotment', 'NO', 'TYPE', 'url', 'o_price', 'GMP', 'subscription' ]; $params = []; foreach ($fields as $field) { $params[":$field"] = $_POST[$field] ?? ''; } // Collect IPO date fields $ipo_dates = [ $_POST['ipo_open'] ?? '', $_POST['ipo_close'] ?? '', $_POST['ipo_allotment'] ?? '', $_POST['ipo_refund'] ?? '', $_POST['ipo_credit'] ?? '', $_POST['ipo_listing'] ?? '' ]; // If all IPO dates are same, blank them out if (count(array_unique($ipo_dates)) === 1) { $_POST['ipo_open'] = ''; $_POST['ipo_close'] = ''; $_POST['ipo_allotment'] = ''; $_POST['ipo_refund'] = ''; $_POST['ipo_credit'] = ''; $_POST['ipo_listing'] = ''; } function convertDate($date) { if (!empty($date)) { $d = DateTime::createFromFormat('Y-m-d', $date); return $d ? $d->format('d-m-Y') : $date; } return ''; } // Convert date fields $_POST['ipo_open'] = convertDate($_POST['ipo_open'] ?? ''); $_POST['ipo_close'] = convertDate($_POST['ipo_close'] ?? ''); $_POST['ipo_allotment'] = convertDate($_POST['ipo_allotment'] ?? ''); $_POST['ipo_refund'] = convertDate($_POST['ipo_refund'] ?? ''); $_POST['ipo_credit'] = convertDate($_POST['ipo_credit'] ?? ''); $_POST['ipo_listing'] = convertDate($_POST['ipo_listing'] ?? ''); // Prepare insert $params = []; foreach ($fields as $field) { $params[":$field"] = $_POST[$field] ?? ''; } $sql = "INSERT INTO ipo_post ( c_name, ipokey, islive, img, m_application, rat, details, emoji, i_date, c_date, ipo_open, ipo_close, ipo_allotment, ipo_refund, ipo_credit, ipo_listing, status, suggestion, date, allotment, NO, TYPE, url, o_price, GMP, subscription ) VALUES ( :c_name, :ipokey, :islive, :img, :m_application, :rat, :details, :emoji, :i_date, :c_date, :ipo_open, :ipo_close, :ipo_allotment, :ipo_refund, :ipo_credit, :ipo_listing, :status, :suggestion, :date, :allotment, :NO, :TYPE, :url, :o_price, :GMP, :subscription )"; try { $stmt = $pdo->prepare($sql); $stmt->execute($params); header("Location: add.php?success=1"); exit; } catch (PDOException $e) { die("DB Error: " . $e->getMessage()); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Add IPO - Wizard</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> <style> body { background-color: #f8f9fa; } .container { background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); } .step { display: none; opacity: 0; transition: opacity 0.3s ease; } .step.active { display: block; opacity: 1; } .step-indicator { display: flex; justify-content: space-between; margin-bottom: 10px; counter-reset: step; position: sticky; top: 0; z-index: 10; background: #fff; } .step-indicator div { flex: 1; text-align: center; padding: 10px; border-bottom: 4px solid #dee2e6; position: relative; } .step-indicator div::before { counter-increment: step; content: counter(step); position: absolute; top: -15px; left: 50%; transform: translateX(-50%); background-color: #dee2e6; color: #000; border-radius: 50%; width: 30px; height: 30px; line-height: 30px; display: inline-block; } .step-indicator .active { border-color: #0d6efd; font-weight: 600; color: #0d6efd; } .step-indicator .active::before { background-color: #0d6efd; color: #fff; } .progress-container { height: 6px; background-color: #e9ecef; margin-bottom: 20px; border-radius: 3px; overflow: hidden; position: sticky; top: 0; z-index: 10; } .progress-bar-custom { height: 6px; background-color: #0d6efd; transition: width 0.3s ease; } .markdown-preview { border: 1px solid #ced4da; padding: 10px; border-radius: 5px; background: #f8f9fa; } .markdown-preview p { margin-bottom: 0.5rem; } </style> </head> <body class="d-flex justify-content-center align-items-start" style="min-height: 100vh; padding-top: 30px; background-color: #f8f9fa;"> <div class="container" style="max-width: 800px; width: 100%;"> <div class="d-flex justify-content-between align-items-center mb-4"> <h2>Add IPO</h2> <a href="index.php" class="btn btn-outline-secondary">🔙 Back</a> </div> <div class="progress-container"> <div id="progressBar" class="progress-bar-custom" style="width: 0%;"></div> </div> <div class="step-indicator"> <div id="indicator-0" class="active">General</div> <div id="indicator-1">Dates</div> <div id="indicator-2">Financials</div> <div id="indicator-3">Status</div> <div id="indicator-4">Review</div> </div> <form method="POST" id="ipoForm"> <!-- Step 1: General --> <div class="step active"> <h5>Step 1: General</h5> <label class="form-label">Company Name</label> <input type="text" name="c_name" class="form-control mb-2" placeholder="Company Name" required> <label class="form-label" hidden>IPO Key</label> <input type="text" name="ipokey" class="form-control mb-2" placeholder="IPO Key" hidden> <label class="form-label">Live</label> <select name="islive" class="form-select mb-2"> <option value="NO">NO</option> <option value="YES">YES</option> </select> <label class="form-label">Image URL</label> <input type="text" name="img" class="form-control mb-2"> <label class="form-label">Rating</label> <input type="text" name="rat" class="form-control mb-2" value="0"> <label class="form-label">Details</label> <textarea name="details" class="form-control mb-2" rows="4"><?php echo 'Allotment: ' . date('F Y') . "\n" . 'Refund: ' . date('F Y') . "\n" . 'Listing: ' . date('F Y'); ?></textarea> <label class="form-label">Emoji</label> <input type="text" name="emoji" class="form-control mb-2"> </div> <!-- Step 2: Dates --> <div class="step"> <h5>Step 2: Dates</h5> <label class="form-label">Issue Date</label> <input type="text" name="i_date" class="form-control mb-2" value="<?php echo date('M Y'); ?>"> <label class="form-label">Close Date</label> <input type="text" name="c_date" class="form-control mb-2" value="<?php echo date('M Y'); ?>"> <label class="form-label">IPO Open</label> <input type="date" name="ipo_open" class="form-control mb-2" value="<?php echo $today; ?>"> <label class="form-label">IPO Close</label> <input type="date" name="ipo_close" class="form-control mb-2" value="<?php echo $today; ?>"> <label class="form-label">IPO Allotment</label> <input type="date" name="ipo_allotment" class="form-control mb-2" value="<?php echo $today; ?>"> <label class="form-label">IPO Refund</label> <input type="date" name="ipo_refund" class="form-control mb-2" value="<?php echo $today; ?>"> <label class="form-label">IPO Credit</label> <input type="date" name="ipo_credit" class="form-control mb-2" value="<?php echo $today; ?>"> <label class="form-label">IPO Listing</label> <input type="date" name="ipo_listing" class="form-control mb-2" value="<?php echo $today; ?>"> </div> <!-- Step 3: Financials --> <div class="step"> <h5>Step 3: Financials</h5> <label class="form-label">Offer Price</label> <input type="text" name="o_price" class="form-control mb-2"> <label class="form-label">Minimum Application</label> <input type="text" name="m_application" class="form-control mb-2"> <label class="form-label">GMP</label> <input type="text" name="GMP" class="form-control mb-2" value="More Details Awaited"> <label class="form-label">Subscription</label> <textarea name="subscription" class="form-control mb-2">NONE</textarea> </div> <!-- Step 4: Status --> <div class="step"> <h5>Step 4: Status</h5> <label class="form-label">Status</label> <select name="status" class="form-select mb-2"> <option value="PAST">PAST</option> <option value="PRESENT" selected>PRESENT</option> <option value="NEW">NEW</option> </select> <label class="form-label">Suggestion</label> <select name="suggestion" class="form-select mb-2"> <option value="Wait" selected>Wait</option> <option value="Avoid">Avoid</option> <option value="Neutral">Neutral</option> <option value="May Apply">May Apply</option> <option value="Apply">Apply</option> <option value="Must Apply">Must Apply</option> </select> <label class="form-label">Date Note</label> <input type="text" name="date" class="form-control mb-2" value="All Info. Education Purpose Only." hidden> <label class="form-label">Allotment Registrar</label> <select name="allotment" class="form-select mb-2"> <option value="https://ipo.bigshareonline.com/IPO_Status.html" selected>Bigshare</option> <option value="https://in.mpms.mufg.com/Initial_Offer/public-issues.html" >MUFG - Linkintime</option> <option value="https://ipostatus.kfintech.com/">KFintech Kosmic</option> <option value="https://www.skylinerta.com/ipo.php">Skyline</option> <option value="https://ipostatus1.cameoindia.com/">Cameo</option> <option value="https://www.purvashare.com/investor-service/ipo-query">Purva</option> <option value="https://maashitla.com/allotment-status/public-issues">Maashitla</option> <option value="https://www.masserv.com/opt.asp">Mas Services</option> <option value="https://www.satellitecorporate.com/ipo-query.php">Satellite Corporate</option> <option value="http://ipo.alankit.com/">Alankit</option> <option value="https://ipostatus.integratedregistry.in/RegistrarsToSTANew.aspx?od=2">Integrated Registry</option> </select> <label class="form-label">IPO Number (NO)</label> <input type="number" name="NO" class="form-control mb-2"> <label class="form-label">IPO Type</label> <select name="TYPE" class="form-select mb-2"> <option value="S" selected>SME</option> <option value="M">Mainline</option> </select> <label class="form-label">IPO Page URL</label> <textarea name="url" class="form-control mb-2">NONE</textarea> </div> <!-- Step 5: Review --> <div class="step"> <h5>Step 5: Review</h5> <div id="reviewContent" class="markdown-preview"></div> </div> <div class="mt-4 text-center"> <button type="button" class="btn btn-secondary" id="prevBtn">Previous</button> <button type="button" class="btn btn-primary" id="nextBtn">Next</button> <button type="submit" class="btn btn-success d-none" id="submitBtn">Submit</button> </div> </form> </div> <script> const steps = document.querySelectorAll(".step"); const indicators = document.querySelectorAll(".step-indicator div"); const progressBar = document.getElementById("progressBar"); let currentStep = 0; function showStep(step) { steps.forEach((el, i) => { el.classList.toggle("active", i === step); indicators[i].classList.toggle("active", i === step); }); progressBar.style.width = ((step) / (steps.length - 1)) * 100 + "%"; document.getElementById("prevBtn").style.display = step === 0 ? "none" : "inline-block"; document.getElementById("nextBtn").classList.toggle("d-none", step === steps.length - 1); document.getElementById("submitBtn").classList.toggle("d-none", step !== steps.length - 1); if (step === steps.length - 1) fillSummary(); } function fillSummary() { const form = document.getElementById("ipoForm"); const formData = new FormData(form); let summary = ""; for (const [key, value] of formData.entries()) { summary += `**${key}**: ${value}\n\n`; } document.getElementById("reviewContent").innerHTML = marked.parse(summary); } showStep(currentStep); document.getElementById("nextBtn").addEventListener("click", () => { if (currentStep < steps.length - 1) { currentStep++; showStep(currentStep); } }); document.getElementById("prevBtn").addEventListener("click", () => { if (currentStep > 0) { currentStep--; showStep(currentStep); } }); </script> <?php if ($showToast): ?> <script> window.onload = () => { const toast = document.createElement("div"); toast.className = "toast align-items-center text-white bg-success border-0 position-fixed bottom-0 end-0 m-3 show"; toast.setAttribute("role", "alert"); toast.innerHTML = '<div class="d-flex"><div class="toast-body">IPO Saved Successfully!</div><button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button></div>'; document.body.appendChild(toast); }; </script> <?php endif; ?> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'94d5a58e2baefe84',t:'MTc0OTUyNDcyMy4wMDAwMDA='};var a=document.createElement('script');a.nonce='';a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script><script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'98ab12889aac3fa7',t:'MTc1OTgxNTcxNw=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings