File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/API/IPO/V3/IPOCalendar/Demo.php
Back
<?php //IpoCalendar.php if(isset($_GET['c'])) $color = '#'.$_GET['c']; else $color = "#F16334"; function tintColor($hex, $percent) { $hex = ltrim($hex, '#'); if (strlen($hex) === 3) $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; $r = hexdec(substr($hex, 0, 2)); $g = hexdec(substr($hex, 2, 2)); $b = hexdec(substr($hex, 4, 2)); $r = (int)($r + (255 - $r) * $percent); $g = (int)($g + (255 - $g) * $percent); $b = (int)($b + (255 - $b) * $percent); return sprintf("#%02x%02x%02x", $r, $g, $b); } function shadeColor($hex, $percent) { $hex = ltrim($hex, '#'); if (strlen($hex) === 3) $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; $r = hexdec(substr($hex, 0, 2)); $g = hexdec(substr($hex, 2, 2)); $b = hexdec(substr($hex, 4, 2)); $r = (int)($r * (1 - $percent)); $g = (int)($g * (1 - $percent)); $b = (int)($b * (1 - $percent)); return sprintf("#%02x%02x%02x", $r, $g, $b); } $colorPageBg = tintColor($color, 0.93); $colorSurface = tintColor($color, 0.97); $colorSoft = tintColor($color, 0.86); $colorSofter = tintColor($color, 0.92); $colorLight = tintColor($color, 0.62); $colorHair = tintColor($color, 0.82); $colorDark = shadeColor($color, 0.45); $colorDeep = shadeColor($color, 0.65); require_once("Connection.php"); $sql = "SELECT `c_name` AS 'NAME',`TYPE` AS 'TYPE',`ipo_open` AS 'OPEN',`ipo_close` AS 'CLOSE',`ipo_allotment` AS 'ALLOTMENT',`ipo_refund` AS 'REFUND',`ipo_credit` AS 'CREDIT',`ipo_listing` AS 'LISTING' FROM `ipo_post`;"; $Orirows = $con->query($sql); $resultArray = $Orirows->fetch_all(MYSQLI_ASSOC); date_default_timezone_set("Asia/Calcutta"); $today = date("d-m-Y"); $cur = new DateTime( $today ); $eventMap = [ 'OPEN' => ['slug' => 'buy', 'label' => 'OPEN'], 'CLOSE' => ['slug' => 'sell', 'label' => 'CLOSE'], 'ALLOTMENT' => ['slug' => 'neutral', 'label' => 'ALLOTMENT'], 'REFUND' => ['slug' => 'neutral', 'label' => 'REFUND'], 'CREDIT' => ['slug' => 'neutral', 'label' => 'CREDIT'], 'LISTING' => ['slug' => 'buy', 'label' => 'LISTING'], ]; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>IPO Calendar</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel='stylesheet' href='https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css'> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link rel='stylesheet' href='https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick-theme.css'> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,ital,wght@9..144,0,400;9..144,0,500;9..144,0,600;9..144,0,700;9..144,1,400;9..144,1,500&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="./style.css"> <style> :root { --accent: <?php echo $color; ?>; --accent-deep: <?php echo $colorDeep; ?>; --accent-dark: <?php echo $colorDark; ?>; --accent-light: <?php echo $colorLight; ?>; --accent-hair: <?php echo $colorHair; ?>; --accent-soft: <?php echo $colorSoft; ?>; --accent-softer: <?php echo $colorSofter; ?>; --page: <?php echo $colorPageBg; ?>; --surface: #ffffff; --surface-tint: <?php echo $colorSurface; ?>; --ink: #1a1512; --ink-2: #4a4340; --ink-3: #7a746f; --buy: #0f6b3f; --buy-bg: #def0e5; --sell: #a81d25; --sell-bg: #fadee0; --radius: 16px; --radius-sm: 10px; --radius-pill: 999px; } *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } html, body { background: var(--page); background-image: radial-gradient(circle at 10% 0%, var(--accent-softer) 0%, transparent 40%), radial-gradient(circle at 100% 100%, var(--accent-soft) 0%, transparent 45%); background-attachment: fixed; } body { padding: 16px 12px 24px; min-height: 100vh; font-family: 'DM Sans', system-ui, sans-serif; font-size: 14px; line-height: 1.4; color: var(--ink); -webkit-font-smoothing: antialiased; } a { text-decoration: none; color: var(--accent); } /* §6.1 — gradient banner header */ .header { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%); color: #fff; border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; position: relative; overflow: hidden; box-shadow: 0 10px 30px -12px <?php echo $color; ?>66; } .header::before { position: absolute; content: ""; right: -20px; top: -20px; width: 70px; height: 70px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.18); pointer-events: none; } .header::after { position: absolute; content: ""; right: -45px; top: -45px; width: 120px; height: 120px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.10); pointer-events: none; } .header__title { font-family: 'Fraunces', serif; font-weight: 500; font-size: 26px; line-height: 1.15; letter-spacing: -0.025em; color: #fff; display: flex; align-items: baseline; gap: 8px; position: relative; z-index: 1; flex-wrap: wrap; } .header__title em { font-style: italic; font-weight: 400; color: rgba(255,255,255,0.85); } .header__pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; margin-left: 2px; animation: pulse 1.8s ease-in-out infinite; flex-shrink: 0; align-self: center; } @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.7); } 70% { box-shadow: 0 0 0 8px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } } @supports (-webkit-touch-callout: none) { .header { display: none; } } /* ── Filter chips (horizontally scrollable on overflow) ── */ .filter-bar { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; padding: 2px 0 4px; } .filter-bar::-webkit-scrollbar { display: none; } .filter-chip { flex-shrink: 0; display: inline-flex; align-items: center; padding: 6px 13px 5px; border-radius: var(--radius-pill); font-family: 'DM Sans', sans-serif; font-size: 10.5px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; line-height: 1.2; background: var(--surface); color: var(--accent-dark); border: 1px solid var(--accent-hair); cursor: pointer; user-select: none; transition: all .15s ease; white-space: nowrap; } .filter-chip:hover:not(.is-active) { border-color: var(--accent-light); color: var(--accent-deep); } .filter-chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 12px -4px <?php echo $color; ?>66; } /* §6.2 — day card w/ 4px left stripe + corner glow */ .day-card { background: var(--surface); border: 1px solid var(--accent-hair); border-radius: var(--radius); padding: 14px 18px 12px 22px; margin-bottom: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 0 <?php echo $color; ?>0d; transition: transform .2s ease, box-shadow .2s ease; animation: slideUp .5s ease backwards; } .day-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); } .day-card::after { content: ""; position: absolute; top: -45px; right: -45px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, <?php echo $color; ?>1f 0%, transparent 70%); pointer-events: none; } .day-card:hover { transform: translateY(-2px); box-shadow: 0 2px 0 <?php echo $color; ?>0d, 0 10px 26px -10px <?php echo $color; ?>33; } .day-card--today::before { width: 5px; background: var(--accent-deep); } .day-card--today::after { background: radial-gradient(circle, <?php echo $color; ?>33 0%, transparent 70%); } .day-card__header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; } .day-card__weekday { font-family: 'Fraunces', serif; font-weight: 500; font-size: 17px; color: var(--accent-deep); letter-spacing: -0.012em; line-height: 1.2; } .day-card__today-tag { font-family: 'DM Sans', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); line-height: 1.2; padding: 2px 7px; border-radius: var(--radius-pill); background: var(--accent-softer); } .day-card__date { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: -0.01em; margin-left: auto; } /* Event row — 2-column: badge | main block (name + type caption). Event badge and IPO name are the two primary visual fields; SME/Mainline is a tiny uppercase meta caption under the name. */ .event-row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--accent-hair); position: relative; z-index: 1; } .event-row:last-child { border-bottom: none; padding-bottom: 2px; } .event-row:first-of-type { padding-top: 4px; } .event-row__body { min-width: 0; } .event-row__name { font-family: 'Fraunces', serif; font-size: 15px; font-weight: 500; color: var(--accent-deep); letter-spacing: -0.012em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .event-row__meta { font-family: 'DM Sans', sans-serif; font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); line-height: 1.2; margin-top: 3px; } .event-row__meta--sme { color: var(--accent); } /* §6.5 — badges (buy / sell / neutral) */ .badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 3px 9px; border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 9.5px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; line-height: 1.2; white-space: nowrap; justify-content: flex-start; justify-self: start; } .badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; } .badge--buy { background: var(--buy-bg); color: var(--buy); } .badge--sell { background: var(--sell-bg); color: var(--sell); } .badge--neutral { background: var(--accent-softer); color: var(--accent-deep); } /* Filter hide via attribute — survives any cascade */ [data-filtered="out"] { display: none !important; } /* §6.8 — empty states */ .empty-state { background: var(--surface); border: 1px dashed var(--accent-light); border-radius: var(--radius); padding: 40px 20px; text-align: center; margin-bottom: 12px; } .empty-state__icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif; font-size: 24px; font-style: italic; } .empty-state__title { font-family: 'Fraunces', serif; font-size: 16px; color: var(--accent-deep); font-weight: 500; margin-bottom: 4px; letter-spacing: -0.01em; } .empty-state__text { font-size: 12px; color: var(--ink-3); line-height: 1.5; } /* §6.11 — disclaimer */ .disclaimer { background: var(--surface); border: 1px solid var(--accent-hair); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 10px 14px 11px; margin-bottom: 4px; box-shadow: 0 1px 0 <?php echo $color; ?>0d; animation: slideUp .5s ease backwards; } .disclaimer__label { font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; } .disclaimer__text { font-size: 11.5px; line-height: 1.5; color: var(--ink-2); } @keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } @media (prefers-reduced-motion: reduce) { .header__pulse, .day-card, .disclaimer, .filter-chip { animation: none !important; transition: none !important; } } </style> </head> <body> <div class="header"> <div class="header__title">IPO<em> Calendar</em><span class="header__pulse"></span></div> </div> <div class="filter-bar" id="filter-bar"> <button type="button" class="filter-chip is-active" data-filter="all">All</button> <?php foreach ($eventMap as $field => $meta): ?> <button type="button" class="filter-chip" data-filter="<?php echo $field; ?>"><?php echo ucfirst(strtolower($meta['label'])); ?></button> <?php endforeach; ?> </div> <div id="timeline"> <?php $anyDayRendered = false; if(count($resultArray) > 0) { $cnt = 1; while($cnt <= 30) { $rows = $resultArray; $day = $cur->format("d-m-Y"); $hasEvent = false; foreach($rows as $row) { if($row["OPEN"] == "") continue; if($day == $row["OPEN"] || $day == $row["CLOSE"] || $day == $row["ALLOTMENT"] || $day == $row["REFUND"] || $day == $row["CREDIT"] || $day == $row["LISTING"]) { $hasEvent = true; break; } } if($hasEvent) { $anyDayRendered = true; $timestamp = strtotime($day); $weekday = date('l', $timestamp); $dayDisplay = date('d-m-Y', $timestamp); // 4-digit year $isToday = ($day === $today); $delay = number_format(($cnt - 1) * 0.04, 2); ?> <article class="day-card <?php echo $isToday ? 'day-card--today' : ''; ?>" style="animation-delay:<?php echo $delay; ?>s"> <div class="day-card__header"> <div class="day-card__weekday"><?php echo $weekday; ?></div> <?php if ($isToday): ?> <span class="day-card__today-tag">Today</span> <?php endif; ?> <div class="day-card__date"><?php echo $dayDisplay; ?></div> </div> <?php $InsideRows = $resultArray; foreach($InsideRows as $InsideRow) { $ipoName = $InsideRow["NAME"]; $ipoType = $InsideRow["TYPE"]; if($ipoType == "S") $ipoType = "SME"; else $ipoType = "Mainline"; if("" == $row["OPEN"]) { continue; } foreach ($eventMap as $field => $meta) { if ($day == $InsideRow[$field]) { $metaClass = ($ipoType === 'SME') ? 'event-row__meta--sme' : ''; ?> <div class="event-row" data-event="<?php echo $field; ?>"> <span class="badge badge--<?php echo $meta['slug']; ?>"><?php echo $meta['label']; ?></span> <div class="event-row__body"> <div class="event-row__name" title="<?php echo htmlspecialchars($ipoName); ?>"><?php echo htmlspecialchars($ipoName); ?></div> <div class="event-row__meta <?php echo $metaClass; ?>"><?php echo htmlspecialchars($ipoType); ?></div> </div> </div> <?php } } } ?> </article> <?php } $cnt = $cnt + 1; $cur = $cur->modify('+1 day'); } } mysqli_close($con); ?> <div class="empty-state" id="filter-empty" style="display:none;"> <div class="empty-state__icon">i</div> <div class="empty-state__title">No matching events</div> <div class="empty-state__text">Try a different filter, or clear it with “All”.</div> </div> </div> <?php if (!$anyDayRendered): ?> <div class="empty-state"> <div class="empty-state__icon">i</div> <div class="empty-state__title">No IPO Events Found</div> <div class="empty-state__text">There are no IPO events scheduled in the next 30 days.</div> </div> <?php endif; ?> <div class="disclaimer"> <div class="disclaimer__label">Description</div> <div class="disclaimer__text"> Upcoming IPO events over the next 30 days — open, close, allotment, refund, credit and listing dates for both Mainline and SME issues. </div> </div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script> <script src='https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js'></script> <script> (function() { var activeFilter = 'all'; var $chips = $('.filter-chip'); var $filterEmpty = $('#filter-empty'); function applyFilter() { var anyDayVisible = false; $('.event-row').each(function() { var match = (activeFilter === 'all' || $(this).attr('data-event') === activeFilter); if (match) this.removeAttribute('data-filtered'); else this.setAttribute('data-filtered', 'out'); }); $('.day-card').each(function() { var $day = $(this); var visible = $day.find('.event-row:not([data-filtered])').length; if (visible === 0) { $day.attr('data-filtered', 'out'); } else { $day.removeAttr('data-filtered'); anyDayVisible = true; } }); $filterEmpty.toggle(activeFilter !== 'all' && !anyDayVisible); } $chips.on('click', function() { $chips.removeClass('is-active'); $(this).addClass('is-active'); activeFilter = $(this).attr('data-filter'); applyFilter(); }); })(); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings