PHP Classes

AdminPro getUser

Recommend this page to a friend!

      AdminPro class  >  All threads  >  AdminPro getUser  >  (Un) Subscribe thread alerts  
Subject:AdminPro getUser
Summary:get user on a nonprotected page?
Messages:3
Author:dizzledammit
Date:2009-09-24 04:47:00
Update:2009-09-25 20:14:28
 

  1. AdminPro getUser   Reply   Report abuse  
Picture of dizzledammit dizzledammit - 2009-09-24 04:47:00
Hello all. I must say that AdminPro is great. However, I'm having trouble getting the username on a nonprotected page. Any ideas? Thanks!

  2. Re: AdminPro getUser   Reply   Report abuse  
Picture of Philip Monos Philip Monos - 2009-09-24 14:21:07 - In reply to message 1 from dizzledammit
Create a class "noprotect" extending class "protect" wher you redefine method makeErrorHtml() to an empty function. Then use "noprotect" to access the user.
Here is a simple script where I have tested it.

<?php
include("adminpro_class.php");
include("adminpro_config.php");
class noprotect extends protect
{
// Redéfine makeErrorHtml méthod
function makeErrorHtml()
{
}
}

$noprot=new noprotect();
$user=$noprot->getuser();
if ($user == "")
{
echo "No user is connected";
} else {
echo "User $user is connected";
}
?>

Hope that helps.

PhilM

  3. Re: AdminPro getUser   Reply   Report abuse  
Picture of dizzledammit dizzledammit - 2009-09-25 20:14:28 - In reply to message 2 from Philip Monos
Many thanks! :)