Jump to content

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


vin_akleh

Recommended Posts

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

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>';
}

are you using sessions or cookies.

 

If it is sessions then you could just go for a straight forward:

 

session_start();

if(!isset($_SESSION['SESS_USER_ADMIN']) || (trim($_SESSION['SESS_USER_ADMIN']) == '')) {
	header("location: access-denied.php");
	exit();
}

 

or for cookies just replace the $_SESSION with $_COOKIE.

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.