Site Builder
Editing:
index1.php
writable 0666
<?php // Path to PH directory $phDir = $_SERVER['DOCUMENT_ROOT'] . '/../ph/'; if (!is_dir($phDir)) $phDir = $_SERVER['DOCUMENT_ROOT'] . '/ph/'; // Find all 10-digit folders $bizDirs = []; foreach (scandir($phDir) as $d) { if (preg_match('/^\d{10}$/', $d) && is_dir($phDir . $d)) { $ctime = filemtime($phDir . $d); $bizDirs[] = ['dir' => $d, 'ctime' => $ctime]; } } // Newest first usort($bizDirs, fn($a, $b) => $b['ctime'] <=> $a['ctime']); function h($s) { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); } function badge($paid) { return $paid ? '<span class="badge premium">Premium</span>' : '<span class="badge free">Free</span>'; } function shortDesc($d, $limit=180) { return mb_strlen($d) > $limit ? mb_substr($d, 0, $limit-3).'...' : $d; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>New Listings | BestDealOn</title> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="robots" content="index,follow"> <meta name="description" content="See the latest new business listings and premium profiles recently added to BestDealOn. Claim your business today!"> <style> body {background:#f5f8fb;font-family:system-ui,Arial,sans-serif;margin:0;color:#233;} h1 {text-align:center;font-size:2.15em;margin:2rem 0 .8rem 0;color:#2d38b6;} .wrap {max-width:740px;margin:2rem auto 2.2rem auto;} .result {background:#fff;border-radius:13px;box-shadow:0 2px 11px #d3dafe23;padding:1.45em 1.45em 1.2em 1.45em;margin-bottom:1.3em;position:relative;} .result .biz-title {font-size:1.32em;font-weight:700;color:#1a36b7;text-decoration:none;} .result .biz-title:hover {text-decoration:underline;} .result .badge {font-size:.96em;font-weight:600;padding:.18em .85em .21em .85em;border-radius:2em;margin-left:1em;} .badge.free {background:#e7f3fa;color:#146b90;border:1.3px solid #b5d5e6;} .badge.premium {background:#fdf2d8;color:#a25e0b;border:1.3px solid #eed399;} .result .slogan {font-size:1.03em;color:#567; margin:.1em 0 .3em 0;} .result .desc {font-size:1.02em;margin:.15em 0 .6em 0;color:#243146;} .result .meta {font-size:.98em;color:#334;} .result .tags {margin-top:.47em;} .tag {display:inline-block;background:#ecf2ff;color:#2354b4;border-radius:13px;padding:.2em .9em;margin:0 .13em .16em 0;font-size:.99em;} @media (max-width:600px){.wrap{padding:0 .14em;} .result{padding:1em .2em 1em .2em;}} </style> </head> <body> <h1>🆕 New Listings on BestDealOn</h1> <div class="wrap"> <?php if (!$bizDirs) { echo '<div style="text-align:center;color:#b55;font-size:1.1em;margin-top:3em;">No businesses listed yet. Add your business now!</div>'; } else { foreach ($bizDirs as $info) { $d = $info['dir']; $dir = $phDir . $d; $paid = false; $bizFile = is_readable("$dir/business.json") ? "$dir/business.json" : (is_readable("$dir/new-business.json") ? "$dir/new-business.json" : null); if (!$bizFile) continue; $biz = json_decode(file_get_contents($bizFile), true); if (!$biz) continue; $paid = is_readable("$dir/business.json"); $name = $biz['name'] ?? $d; $slogan = $biz['slogan'] ?? ''; $desc = $biz['description'] ?? ''; $city = $biz['city'] ?? ''; $state = $biz['state'] ?? ''; $tags = $biz['tags'] ?? []; $url = "/ph/$d/"; echo '<div class="result">'; echo '<a class="biz-title" href="'.h($url).'">'.h($name).'</a> ' . badge($paid); if ($slogan) echo '<div class="slogan">'.h($slogan).'</div>'; if ($desc) echo '<div class="desc">'.h(shortDesc($desc)).'</div>'; echo '<div class="meta">'.h($city).($city&&$state?', ':'').h($state).'</div>'; if ($tags && is_array($tags)) { echo '<div class="tags">'; foreach ($tags as $t) echo '<span class="tag">'.h($t).'</span>'; echo '</div>'; } echo '</div>'; } } ?> </div> </body> </html>
Save changes
Create folder
writable 0777
Create
Cancel