Page 1 of 1

manual [ PHP & phpBB ] Sitemap Generator

Posted: Tue Dec 03, 2024 10:27 pm
by CoDeR
BaraqMap V0.01
This is the link adding tool that I use in this forum.
The HTML form part is as follows:

Code: Select all

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="(max-width: 670px)" href="sitil/sitemap.css" type="text/css">
<title>BaraqWeb</title>
</head>
<body>
	<em>Add Page to Sitemap</em><br>
	<form id="form1" name="form1" method="post" action="sitemap.php?mode=addurl">
	<input name="Topic" type="text" id="veriiki" placeholder="Topic Numarasını Gir"/>
	<input name="link" type="text" id="veriiki" placeholder="Link Numarasını Gir"/>
	<input class="buton" type="submit" name="button" value="SEND"/>
	</form>
</body>
</html>
The PHP part is as follows. Just set the path according to your root.

Code: Select all

<?php
	$linkadd = "https://YOURDOMAINHERE.com/viewtopic.php?t=" . $_POST["Topic"];
	$linkaddp = "https://YOURDOMAINHERE.com/viewtopic.php?p=" . $_POST["link"];
	$linkaddpp = "https://YOURDOMAINHERE.com/viewtopic.php?p=" . $_POST["link"] . "#p" . $_POST["link"];
	
	$linkekle = fopen("../YOURPATH/urllist.txt", "a+"); //Dosyayı ekleme modunda açtık
	if(empty($_POST["Topic"])) {
	echo "Topic Boş";
	} else{ fputs($linkekle, "\n" . $linkadd); }
	if(empty($_POST["link"])) {
	echo "Post Boş";
	} else{
	fputs($linkekle, "\n" . $linkaddp);
	fputs($linkekle, "\n" . $linkaddpp); }
	fclose($linkekle);  //Açık Dosyayı kapattık
	
	/* BU KISIM XML Dosyasını Çalıştırıyor */
	$linkaddpxml = "https://YOURDOMAINHERE.com/viewtopic.php?p=" . $_POST["link"];
	$linkaddppxml = "https://YOURDOMAINHERE.com/viewtopic.php?p=" . $_POST["link"] . "#p" . $_POST["link"];
	
	$linkeklexml = fopen("../YOURPATH/sitemap.xml", "r+"); //Dosyayı ekleme modunda açtık
	if(empty($_POST["link"])) {
	echo "Post Boş";
	} else{
		fseek($linkeklexml, filesize("../YOURPATH/sitemap.xml")-10);
		fputs($linkeklexml, "\n<url>\n\t<loc>" . $linkaddpxml . "</loc>\n</url>");
		fputs($linkeklexml, "\n<url>\n\t<loc>" . $linkaddppxml . "</loc>\n</url>"); 
		fputs($linkeklexml, "\n</urlset>"); 
	}
	fclose($linkekle);  //Açık Dosyayı kapattık
?>
It appends links to the already existing url list.txt and sitemap.xml files. Don't forget to input the xml file correctly.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with BaraqWeb Sitemap Generator www.baraqweb.com -->
<url>
	<loc>https://forum.baraqweb.com/</loc>
</url>
<url>
	<loc>https://forum.baraqweb.com/index.php</loc>
</url>
<url>
	<loc>https://forum.baraqweb.com/app.php/help/faq</loc>
</url>