Page 1 of 1

how to make the webpage editable by the admin?????

Posted: Sat Feb 27, 2010 2:11 pm
by vin_akleh
i have a web page that is not editable by the client (read only)
when the admin login he can change the text in the page

i know that i have to use if condition, and i already have all what i need for the admin login, but i don't know what is the condition

Code: Select all

if (admin not loged in)
{
echo'<p>some text in here</p>';
}
else
{
echo'<form method="post" action=" '.$_SERVER['PHP_SELF'];.' ">
enter text here:<textarea name="content" cols="60" rows="10"></textarea>
<br>
<input type="submit" value="save">
<input type="reset" value="clear"><br/>
</form>';
}
 

Re: how to make the webpage editable by the admin?????

Posted: Sat Feb 27, 2010 5:04 pm
by Rippie
Dont think this script will get you very far in your admin script... The condition is something you set it to be and then check for it. normally a admin login script works like this


1. Check if admin is logged in. (this can be done with sessions, cookies or a text file. Normally sessions are used)
2. If admin is logged in some checks are ran in order to make sure it is really an admin
3. If all the checks turns out ok you see the admin page
4. If checks fail or the admin has not logged in (as in not written his username and password) then it show the login form.

If you dont mind me asking.... what code is it you have for your admin login ? and are you aware that the code you have is not at all enough in order to get your client to be able to edit pages online.

Rippie

Re: how to make the webpage editable by the admin?????

Posted: Sat Feb 27, 2010 5:07 pm
by Rippie
From the script you showed it looks like that you need to enter username and password and then the script looks up the same file.... now if this is the case of course you want to do some authentication checks before your client can update a page... where do you store admin username and password ?

Rippie

Re: how to make the webpage editable by the admin?????

Posted: Sat Feb 27, 2010 5:14 pm
by vin_akleh
this is not the full code.
the client is not going to be editing any thing.
the admin login code is to big:
1- login page
2- check if username and password is right page
3- login success page
4- login fail page
5- logout page


only one question are the session secure or is it better to use a boolean variable
or is there any flows in my way of coding, that i must consider using 2 pages for every page one for the client and one for the admin

Re: how to make the webpage editable by the admin?????

Posted: Sat Feb 27, 2010 5:15 pm
by vin_akleh
i store it in mysql database table
the password and username

Re: how to make the webpage editable by the admin?????

Posted: Sat Feb 27, 2010 5:51 pm
by Rippie
I used to just run sessions but then i friend told me to start run some checks on stuff. I can send you some code over from a friend... if you have msn PM me and i will contact you and send it over...

Rippie