I've just been editing an open-source PHP application (original version at http://scripts.ringsworld.com/content-management/basiccms/ , and modifying it to suit my needs :icon_cheesygrin:
However, the PHP application is a CMS and always generates URLs this way:
http://yourwebaddresshere.com/cms/?id=1
when I am trying to get it to be
http://yourwebaddresshere.com/cms/?id=pagename
but I am struggling to try and get this to work.
This is the code for index.php that generates the pages from the database:
<?php
session_start();
include("Includes/PortalConection.php");
include("Includes/Database.php");
if (!isset($_GET['id']))
{
$strID="";
}
else
{
$strID=QuerySafeString($_GET["id"]);
}
$strDetails="";
$strError ="";
if ($strID != "")
{
$strsql = "SELECT description ";
$strsql .=" FROM pages_t_details ";
$strsql .=" WHERE id=$strID";
$conclass =new DataBase();
$rst= $conclass->Execute ($strsql,$strError);
if ($strError=="")
{
while ($line = mysql_fetch_array($rst, MYSQL_ASSOC))
{
$strDetails=$line['description'];
}
}
}
elseif ($strID == "0") {
$strDetails="";
}
else
{
$strsql = "SELECT description ";
$strsql .=" FROM pages_t_details ";
$strsql .=" WHERE startpage='Y'";
$conclass =new DataBase();
$rst= $conclass->Execute ($strsql,$strError);
if ($strError=="")
{
while ($line = mysql_fetch_array($rst, MYSQL_ASSOC))
{
$strDetails=$line['description'];
}
}
}
print $strDetails;
?>