« Back to History
test.php
|
20260723_000646.php
Initial Domain Snapshot
Copy Code
<?php // hello.php - bootstrap PHP at top (must be inside PHP tags) error_reporting(E_ALL); ini_set('display_errors',1); /* ---- Auth + scope (AUTH FILES UNTOUCHED) ---- */ require_once __DIR__ . '/modules/auth/page_acl.php'; $ctx = page_require_access('yarn_entry'); $company_id = (int)($ctx['company_id'] ?? 3); $pdo = $ctx['pdo'] ?? null; $u = $ctx['user'] ?? null; // ✅ header expects $u /* ---- Hardened JSON helper (flush buffers + force headers) ---- */ function jsend($ok,$data=[],$code=200){ while (ob_get_level()>0) { @ob_end_clean(); } if (!headers_sent()) { header_remove(); header('Content-Type: application/json; charset=utf-8'); http_response_code($code); } echo json_encode($ok?['ok'=>true,'data'=>$data]:['ok'=>false,'error'=>$data], JSON_UNESCAPED_UNICODE); exit; } /* ---- AJAX: auth + error handling guards ---- */ if (isset($_GET['ajax'])) { if (!is_array($ctx) || empty($ctx['user'] ?? null)) { jsend(false,'unauthenticated',401); } set_error_handler(function($severity,$message,$file,$line){ if (!(error_reporting() & $severity)) return false; throw new ErrorException($message,0,$severity,$file,$line); }); @ini_set('display_errors','0'); } /* ---- PDO bootstrap (robust; no auth edits) ---- */ if (!($pdo instanceof PDO)) { $tryInclude = function(string $path) use (&$pdo) { @include_once $path; if ($pdo instanceof PDO) return true; if (isset($db) && $db instanceof PDO) { $pdo = $db; return true; } if (isset($dbh) && $dbh instanceof PDO) { $pdo = $dbh; return true; } if (isset($conn) && $conn instanceof PDO){ $pdo = $conn; return true; } return false; }; foreach ([__DIR__.'/core/db.php', __DIR__.'/db.php', __DIR__.'/config/db.php', __DIR__.'/config.php'] as $p) { if (is_file($p) && $tryInclude($p)) { break; } } if (!($pdo instanceof PDO)) { http_response_code(500); exit('DB bootstrap failed.'); } } /* ---- Legacy header expectation: $company['name'] ---- */ if (!isset($company) || !is_array($company)) { $company = ['id'=>$company_id, 'name'=>($u['company_name'] ?? '')]; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Saree by month</title> <style> body { background: #edabaa; font-family: 'Segoe UI', Arial, sans-serif; margin: 0; } .container, .last-entry-section { background: #354046; color: #f2f6f5; border-radius: 10px; width: 96%; max-width: 560px; margin: 30px auto 0 auto; box-shadow: 2px 8px 16px #7574744c; padding: 24px 18px 16px 18px; } .last-entry-section { margin-top: 30px; padding-top: 18px; padding-bottom: 22px; } h1 { text-align: center; font-size: 2.2rem; font-weight: 400; letter-spacing: 1px; margin-bottom: 26px; } h2 { font-weight: 400; text-align: left; margin-bottom: 10px; font-size: 1.3em; } .saree-form { margin-bottom: 12px; } .row { display: flex; gap: 18px; margin-bottom: 16px; } .column { flex: 1; display: flex; flex-direction: column; } label { font-size: 1em; margin-bottom: 4px; } input[type="text"], input[type="number"] { padding: 9px 12px; border-radius: 5px; border: none; background: #f2f6f5; color: #354046; font-size: 1.08em; margin-bottom: 0; box-sizing: border-box; transition: outline 0.2s; } input[type="text"]:focus, input[type="number"]:focus { outline: 2px solid #24744a; } .column-full { flex: 2; } .actions { display: flex; gap: 16px; margin-top: 10px; } .btn { padding: 8px 30px; background: #318165; color: #fff; font-size: 1em; border: none; border-radius: 4px; cursor: pointer; font-family: inherit; } .btn.btn-report { background: #24744a; } .last-entry-section input[type="text"] { width: 100%; background: #f2f6f5; color: #354046; border-radius: 5px; border: none; padding: 8px 10px; font-size: 1.07em; margin-top: 2px; box-sizing: border-box; } </style> </head> <body> <div class="container"> <h1>Saree by month</h1> <form class="saree-form"> <div class="row"> <div class="column"> <label for="month">Month</label> <input type="text" id="month" name="month" value="Sep-2025"> </div> <div class="column"> <label for="quality">Quality</label> <input type="text" id="quality" name="quality" value="GP"> </div> </div> <div class="row"> <div class="column-full"> <label for="khata">Khata</label> <input type="text" id="khata" name="khata" value="MST-1"> </div> </div> <div class="row"> <div class="column"> <label for="total_saree">Total Saree</label> <input type="text" id="total_saree" name="total_saree" value="582"> </div> <div class="column"> <label for="cut">Cut</label> <input type="text" id="cut" name="cut" value="6.1"> </div> </div> <div class="actions"> <button type="submit" class="btn">Submit</button> <button type="button" class="btn btn-report">Report</button> </div> </form> </div> <div class="last-entry-section"> <h2>Last entry</h2> <input type="text" value="12-Sep-2025 | GP|Mor | Red | 12" disabled> </div> </body> </html>