K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / var / www / html / sman1baleendah_sch_id-1111111111111 / public /
server ip : 104.21.89.46

your ip : 108.162.241.112

H O M E


Filename/var/www/html/sman1baleendah_sch_id-1111111111111/public/sitemap.php
Size1.3 kb
Permissionrw-r--r--
Ownerwww-data : www-data
Create time11-May-2025 20:00
Last modified11-May-2025 19:59
Last accessed05-Jul-2025 12:36
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php
// Mendeteksi direktori skrip saat ini
$directoryPath = dirname(__FILE__);

// Nama file daftar (diletakkan di direktori yang sama dengan skrip ini)
$fileName = $directoryPath . '/list.txt';

// Membaca file dan mendapatkan isi dalam bentuk array
$entries = file_exists($fileName) ? file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) : [];

// Mendapatkan basis URL
$scriptPath = $_SERVER['PHP_SELF'];
$basePath = rtrim(dirname($scriptPath), '/\\');
$baseUrl = 'https://' . $_SERVER['HTTP_HOST'];

// Membuat awal file XML
$sitemap = new SimpleXMLElement('<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"></urlset>');

// Menambahkan URL ke file sitemap
foreach ($entries as $entry) {
// Mengganti spasi dengan tanda plus
$formattedEntry = str_replace(' ', '+', $entry);

$url = $sitemap->addChild('url');
$url->addChild('loc', $baseUrl . $basePath . '/?id=' . $formattedEntry);
$url->addChild('lastmod', date('Y-m-d'));
$url->addChild('changefreq', 'daily');
$url->addChild('priority', '0.5');
}

// Menyimpan file sitemap di direktori yang sama dengan skrip
$sitemapFilePath = $directoryPath . '/sitemap.xml';
$sitemap->asXML($sitemapFilePath);

// Output ke browser
header('Content-Type: application/xml');
echo $sitemap->asXML();
?>