This topic is locked

Register Link

12/28/2006 10:25:51
PHPRunner General questions
A
amannerud author

I am creating a system which utilizes the built-in register.php function and was wondering what the best way is to move the Register link from the Login page to the Menu page and only be visible if the user is an admin? The users are designated as admins if the field "Category" in the "Agency" table states "Admin". Any suggestions?

Sergey Kornilov admin 12/28/2006

Probably the easiest way is to put the following code snippet to header.php or to footer.php

// make sure this code is only executed on menu page

if (strrpos($_SERVER["SCRIPT_NAME"], "menu.php")>=0)

{

// run SQL query to check if currently logged user is an admin

if ( User is admin)

{

echo "<a href=register.php>Register</a>";

}
}
A
amannerud author 1/2/2007

Thank you very much for your time and expertise.

Regards,

Tom