Web based editing script

Hey. So I’m making a script sort of like a CMS so I can easily edit my site but I don’t want to use a CMS to minimize CPU Load and some other stuff.
So far I’ve taken my existing site and taken out everything from the main content leaving just the CSS and where the main content goes I want to use a query and fetch it from a database.

[code]<?php
$dbname = “database”;
$dbuser = “user”;
$dbpass = “password”;
$dbhost = “localhost”;

mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
?>[/code]
That’s /admin/database.php
what i want is to be able to say for index.php just put in:

[code]<?php
require(“admin/database.php”);
~
?>
where i have ~ is where i’m confused. i want to be able to access my database details.
DB Structure:
Table: pages
Fields: 2
Field 1: filename (name of file accessing)
Field 2: contents (contents to display)
I want to write a script so in index.php I put in code to select the row where the value of filename is index.php and write in the code from the field contents in that place.

I also need a way (non .htaccess) to authenticate users into the /admin/ directory so they can edit the database entries. currently focusing on writing from DB and editing from phpMyAdmin.

the edit function is stuffing up for some reason so i have to reply - here is what the above post should really look like:

Hey. So I’m making a script sort of like a CMS so I can easily edit my site but I don’t want to use a CMS to minimize CPU Load and some other stuff.
So far I’ve taken my existing site and taken out everything from the main content leaving just the CSS and where the main content goes I want to use a query and fetch it from a database.

[code]<?php
$dbname = “database”;
$dbuser = “user”;
$dbpass = “password”;
$dbhost = “localhost”;

mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
?>[/code]
That’s /admin/database.php
what i want is to be able to say for index.php just put in:

<?php require("admin/database.php"); ~ ?>
where i have ~ is where i’m confused. i want to be able to access my database details.
DB Structure:
Table: pages
Fields: 2
Field 1: filename (name of file accessing)
Field 2: contents (contents to display)
I want to write a script so in index.php I put in code to select the row where the value of filename is index.php and write in the code from the field contents in that place.

I also need a way (non .htaccess) to authenticate users into the /admin/ directory so they can edit the database entries. currently focusing on writing from DB and editing from phpMyAdmin.

Sponsor our Newsletter | Privacy Policy | Terms of Service