Jump to content

how to make an admin panel?


chmpdog

Recommended Posts

Hi,

 

My client has me tied down right now. To untangle myself I was thinking of using an admin panel. I want them to be able to edit each page without any knowledge of coding.

 

For the site I am using a file system where there is only one index and each page's content is hosted individually. So how would I do this? Is there a program that I could use?

 

Thanks

Link to comment
Share on other sites

This is a tough one .. there are php softwares out there but IMO they either take forever to implement and/or you still need to have some coding knowledge.

 

unless you are running a CMS system, it's almost a trade off getting the editing script up and running and doing the edits yourself.

 

I've used this one in the past. http://www.snippetmaster.com/index.php

 

but again, you will need to have a little bit of experience coding.

Link to comment
Share on other sites

make a php file, that has the users "Username" and "password (md5)", this will allow you to keep away from databases.

 

Example:

<?php
$user = "fred";
$pass = "8dm4ujg04j8ndkco3mfpqnt85hnwmci4";
?>

 

then when they login, check that file, create some sessions.

 

the make a function to check if the user is logged in:

 

functions.php

<?php
function is_logged(){
     if($_SESSION['logged'])
          $logged = TRUE;
     else
          $logged = FALSE;
     return $logged;
}
?>

 

 

next at the top of every page where they need to be logged in place this:

<?php
session_start();
include 'functions.php';
if(!logged()){
     header("location: login.php");
     exit;
}
?>

 

That would be somewhat of a start...

Link to comment
Share on other sites

make a php file, that has the users "Username" and "password (md5)", this will allow you to keep away from databases.

 

Example:

<?php
$user = "fred";
$pass = "8dm4ujg04j8ndkco3mfpqnt85hnwmci4";
?>

 

then when they login, check that file, create some sessions.

 

the make a function to check if the user is logged in:

 

functions.php

<?php
function is_logged(){
     if($_SESSION['logged'])
          $logged = TRUE;
     else
          $logged = FALSE;
     return $logged;
}
?>

 

 

next at the top of every page where they need to be logged in place this:

<?php
session_start();
include 'functions.php';
if(!logged()){
     header("location: login.php");
     exit;
}
?>

 

That would be somewhat of a start...

 

But what about the actual re-write of the content. Thanks for the help :)

Link to comment
Share on other sites

Check out PHP's Smarty feature. This will allow them to edit templates of codes, without affecting the php behind it, etc... I believe it's along the lines of what you want...

 

Or are you saying that they have NO experience with coding whatsoever and you need something like Dreamweaver's Design View for these people?

Link to comment
Share on other sites

Create a protected Directory using a .htaccess and .htpasswd.

 

Then create and index file in the dir. with the pages that they would like to modify. Or on file with a drop down menu of each page on on the site. In your database create a table for pages. Include a section for body text. (Body text will be the information that gets swapped out on each new page). 

 

This java script works well for converting text to html. It uses a simple textarea. The customer does not need to know any html or coding.

 

http://tinymce.moxiecode.com/

(Download it and upload it to the site.)

 

How to use it.

 

http://wiki.moxiecode.com/index.php/TinyMCE:Installation

 

This program has the ability to customize the tools that are shown. This will make it a little more simple for your customers.

 

Here is a link to the different default buttons. (You can also modify them your self.)

 

http://wiki.moxiecode.com/examples/tinymce/installation_example_00.php

 

Have your form set up so that it adds the information to your database.

 

Then all you have to do is pull the information from the database for each webpage.

 

If you need more detail information just ask.

Link to comment
Share on other sites

Create a protected Directory using a .htaccess and .htpasswd.

 

Then create and index file in the dir. with the pages that they would like to modify. Or on file with a drop down menu of each page on on the site. In your database create a table for pages. Include a section for body text. (Body text will be the information that gets swapped out on each new page). 

 

This java script works well for converting text to html. It uses a simple textarea. The customer does not need to know any html or coding.

 

http://tinymce.moxiecode.com/

(Download it and upload it to the site.)

 

How to use it.

 

http://wiki.moxiecode.com/index.php/TinyMCE:Installation

 

This program has the ability to customize the tools that are shown. This will make it a little more simple for your customers.

 

Here is a link to the different default buttons. (You can also modify them your self.)

 

http://wiki.moxiecode.com/examples/tinymce/installation_example_00.php

 

Have your form set up so that it adds the information to your database.

 

Then all you have to do is pull the information from the database for each webpage.

 

If you need more detail information just ask.

 

Thanks, but I have two questions.

 

How would I get the iformation from the database for each page?

 

And how do I send the info to the database?

 

Thanks again :)

Link to comment
Share on other sites

This is incomplete code you will need to fill in the gaps and customize it to your databases tables and fields.

 

Establishes A Connection With The Database in your php script.

 

This is part of the code you would you on your webpage that the public sees.

$query = "SELECT * FROM pages WHERE pg_id = 1"; /*pages would be the name of the table in your DB. pg_id would be the information you would like to request for the page you are loading.*/
$results = mysql_query($query) or die (mysql_error()); //This runs the query and retreves the information.
$rows = mysql_fetch_array($results) //This loads the results form the query into an array.

$pg_name = $rows['pg_bodytxt']; //This loads the results form the query into an array.

//Put this code on your  website templete where you want the body text to be loaded.
<?php echo $pg_name ?>

 

Create your form with the textarea.

 

//This pulls the information from your form that was submited.
$body_text = $_post['body_text'];

//You will need to load your DB Table with entries for each page on your site that your customer would like to edit.

//This code updates your db tabe info.
$query2 = "UPDATE pages SET pages.bodytxt='$body_text WHERE pages.pg_id = '1'";//Updates DB information.

$result2 = mysql_query($query2) or die(mysql_error());//Runs Query

if($result2 =="1")
     {
     echo '<br /><div style=" color:#FF0000;"><h3>'.$sel_pg_name.' has been updated.</h3></div><br />';
     }

 

THIS CODE IS NOT COMPLETE... You stated early that you new PHP. If you have problems fallowing this script I would recomend downloading the PHP & MYSQL Video Training form the link below. It is free and gives a lot of good informtion that you need for working with any PHP & mysql.

 

http://www.3dbuzz.com/vbforum/sv_dl_tr.php

 

Create a login and then click on "PHP & MySQL Integration".

 

Have fun with this it is a very useful and you can charge a good amount for intigrating customer admin to a site.

 

 

 

 

 

Link to comment
Share on other sites

  • 3 weeks later...

Regarding making the admin panel,

 

It is begining to be quite an undertaking that i started some time ago if you would like i can give you a basic structure on how i started mine and give advice along the way.

 

Mine is far from finished but what application ever is?

 

If you have fair to good knowlegde of php and mysql its more of a ime consuming thing than being hard.

Let me know if you would like some help.

Link to comment
Share on other sites

Iam half way trhough making an admin panel. Admin panels for me need to be.

 

1) User friendly

2) secure

3) easy to navigate

4) supported by you

 

Firstly start of with what you need the user to be able to do such as...

 

Upload files

Edit/change files

Block ip's

 

The main idea I tend to use is templates for the main site. Think simple for your admin panel because by time you get round to it you will have a list as long as your arm that you need to impliment and it will be slow and not time effective.

 

Templated main site the user to create new pages which can then be integrated into the main design. so data could be stored in a database or files. I suggest a database.

 

Admin panel step one:

 

Make graphical interface with menu options (baring in mind any menu changes and other pages you may want to make)

 

2) make a secure login.

 

- Login using sessions as data holders. The path of your sessions are usually default to tmp although there are disadvantages as if on a shared host it will be accessable from other users too so not majorly secure. Although if you move the session path to something above your servers http folder the garbage collection will not happen and you can be left with again unsecure sessions. Choice is yours though.

 

-encrypt data such as passwords using md5 or sha1 for example.

 

-make sessions time-out after say 30 minutes.

 

-don't use obvious names such as password or username, although it helps to navigate your code it is potential window.

 

-Once you have session securty and such set up check the user is authorised to view everytime they go to a new page or carry out a new routine.

 

- once you have done basic security and your happy with your administration set up more security such as captcha's to stop automated scripted attacks

 

once thats done its pretty much easy from there :)

 

 

Link to comment
Share on other sites

The first thing I did to build mine was figure out a basic layout for the admin section.

Then I set up a couple of Tables in Mysql one for Pages and one for page elements or sections of HTML code.

 

Then the first thing to get working is an html editor. The one I have been using is TinyMce it turns a basic textarea into a text editor. This will let your client write basic html code without having to know HTML.

 

you set up the textarea in a form and send the data via POST to a php script page that will store the data in a Data Base Be sure however that you use html_entities() to encode your data to prevent uh ohs in your query.  This is a very important step that took me a while to fiure out. And be sure to decode it with html_entity_decode() when echoing that data back to the content section of your template.

 

Your template page should work by using Get variables this will allow visitors to still book mark the page and set up links to it a link will look something like "page.php?page_id=1"

 

Then you will run a query on your DB something like

 
$query = "SELECT * FROM PageElements WHERE Id='$page_id'";
$result=mysql_query($query);

and out put whith a 

while ($row=mysql_fetch_array($result)){
  echo $row['Content'] . "<br />";
}
  

That should give a good start

 

The Hardest part is figuring out where to start, so my advice is just make it do something and build from there.

 

And when any body get to where they can figure out how to use TinyMce to insert an image by browsing a folder on you server Feel free to let me know where to start. I am kind of at a stand still.

 

Although some one somewhere on this forum said they wrote a script for just that purpose.

I got a $10 donation for php Freaks once someone shares.

 

Hope that this advice helps someone

 

 

Link to comment
Share on other sites

You could have seriously made this a lot easier. If each page was, navigated by like:

 

index.php?page=this

 

And 'this' was an included file such as: includes/this.inc

 

Whilst being an admin, have an admin-only link on the bottom of the page that would say "Edit this Page," then you would be prompted with like.

 

admin.php?act=edit&page=this

 

Using fread and fwrite, you can easily have the person just edit the file as a whole.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.