Hiding Admin Link

------=_NextPart_000_005B_01C9C9DA.B84E6A10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,
I am very new at PHP so I will try to explain my question the best I =
can. I was wondering if there was a way to have a link show only to the =
owner of the site? Like having a "Admin" link for editing posts, but =
hidden to all users except the owner. Thank you very much for your time!!
------=_NextPart_000_005B_01C9C9DA.B84E6A10--
Joey Hendricks [ Fr, 01 Mai 2009 04:29 ] [ ID #1999893 ]

Re: Hiding Admin Link

--000e0cd56b080b2b4e0468d4bb9d
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Easy way to do it is if you use a MySQL database to store it. Do
$username = (name of user);
$admin = mysql_query( "SELECT * FROM usertable WHERE user='$username'" );
if( $admin->admin )
{
print "<a href='/adminarea'>ADMIN</a>"
}

$username --> variable to hold the name of the user.
$admin --> query to obtain the database row for that user
if() --> checks to see if the "admin status" column of the database is set
to true, if so it prints admin link.

On Thu, Apr 30, 2009 at 9:29 PM, Joey Hendricks
<j.hendricksjr [at] comcast.net>wrote:

> Hello,
> I am very new at PHP so I will try to explain my question the best I can. I
> was wondering if there was a way to have a link show only to the owner of
> the site? Like having a "Admin" link for editing posts, but hidden to all
> users except the owner. Thank you very much for your time!!

--000e0cd56b080b2b4e0468d4bb9d--
kurokawa [ Fr, 01 Mai 2009 09:26 ] [ ID #1999894 ]

Re: Hiding Admin Link

You can start by creating a login system
http://www.phpeasystep.com/workshopview.php?id=6
Then you can do an if/then statement to show the link only to people who
have logged in...


On 4/30/2009 10:29 PM, Joey Hendricks wrote:
> Hello,
> I am very new at PHP so I will try to explain my question the best I can. I was wondering if there was a way to have a link show only to the owner of the site? Like having a "Admin" link for editing posts, but hidden to all users except the owner. Thank you very much for your time!!
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Harvey [ Fr, 01 Mai 2009 14:01 ] [ ID #1999895 ]
PHP » gmane.comp.php.database » Hiding Admin Link

Vorheriges Thema: PostgreSQL query many escape characters?
Nächstes Thema: PHP Generator