15 lines
800 B
PHP
15 lines
800 B
PHP
<?php
|
|
require_once __DIR__ . '/_secrets.php';
|
|
header("Content-Type: application/json");
|
|
header("Access-Control-Allow-Origin: *");
|
|
$pg = pg_connect("host=127.0.0.1 dbname=adx_system user=admin password=" . weval_secret('WEVAL_PG_ADMIN_PASS') . "");
|
|
if (!$pg) { echo json_encode(["error"=>"DB"]); exit; }
|
|
$limit = min((int)($_GET["limit"] ?? 50), 200);
|
|
$offset = max((int)($_GET["offset"] ?? 0), 0);
|
|
$r = pg_query($pg, "SELECT id,nom,prenom,specialite,ville,pays,email,telephone,source,google_verified FROM ethica.medecins ORDER BY id DESC LIMIT $limit OFFSET $offset");
|
|
$rows = [];
|
|
while ($row = pg_fetch_assoc($r)) { $rows[] = $row; }
|
|
$cnt = pg_fetch_result(pg_query($pg, "SELECT count(*) FROM ethica.medecins"), 0, 0);
|
|
echo json_encode(["ok"=>true,"total"=>(int)$cnt,"data"=>$rows]);
|
|
pg_close($pg);
|