Jump to content

Admin login


Buttero

Recommended Posts

Hey all,

I've recently made a very simple CMS, add news, and delete news. However I wanna expand on this and add two new things:

[list]
[*]The ability to edit a news article straight from the CMS
[*]Show login name e.g. Buttero, log out
[/list]

I dont have any clue on how to do the first, and for the log in, Im just using Cpanels 'Password protect directory' to protect it, but with this I cant display the user thats logged in.

Any help on this would be greatly apprichiated, and any other tips on what to add in my CMS would also help,

Thanks in advance  :)
Link to comment
https://forums.phpfreaks.com/topic/36234-admin-login/
Share on other sites

to edit articles you will need to make an edit link that passes the article id through the url.

Once you have passed it, you will need to use $_GET['id'] to pass it into a query which pulls out the data for that article from the database. You will then set variables for each item obtained from the db, and in your form you set the value="<?php echo $variable_name ?>" piece so that the default value is the data pulled from your query.

That will populate the form with the information so you can edit it, then you simply grab all the $_POST[] variables and run another query using UPDATE instead of INSERT and update the record to the new values.
Link to comment
https://forums.phpfreaks.com/topic/36234-admin-login/#findComment-172236
Share on other sites

for the login, are you using mysql to store all the data. if you are then just create a new table in your cms database called admin or something, insert some fields with the admin's username and password then on your login page when they submit a user name and password check it against the ones in the database.
if they passed, register the new session. On all the pages that require you to be logged in just check if that session is set, if it isn't then show an error, else show the page. rather simple... just gotta think about it.
Link to comment
https://forums.phpfreaks.com/topic/36234-admin-login/#findComment-172272
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.