CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 How can I load different "home" page based on UserID

Print topic Send  topic

Author Message
chriss
Posted: 06/29/2008, 2:01 PM

I have a Login link on a website

I want o load a different page depending on user access level or UserID

If UserID = "Admin" (or level)
load page1
Else
load page 2




aondecker

Posts: 58
Posted: 06/30/2008, 4:06 AM

Quote chriss:
I have a Login link on a website

I want o load a different page depending on user access level or UserID

If UserID = "Admin" (or level)
load page1
Else
load page 2


Have the login page goto a blank page and on the the before show code for the blank page put:

global $Redirect;

if (CCGetUserID() =="Admin")
$Redirect = "your_page.php";
else
$Redirect = "my_page.php";
View profile  Send private message
chriss
Posted: 06/30/2008, 6:09 AM

> global $Redirect;
>
> if (CCGetUserID() =="Admin")
> $Redirect = "your_page.php";
> else
> $Redirect = "my_page.php";

Ok I tried this but

function Page_BeforeShow()
{
$Page_BeforeShow = true;
//End Page_BeforeShow

//Custom Code @3-968A1CAC
// -------------------------
// global $loginpage; -**** I remmed this out
global $Redirect;

if (CCGetUserID() =="Admin")
$Redirect = "adminpage.php";
else
$Redirect = "userspage.php";

// Write your own code here.

seems to be ignoring the IF statement so ALWAYS load the userpage.php

Do I need to close the IF statement ??
(tried 'end' on the line below $Redirect = "userspage.php";

"aondecker" <aondecker@forum.codecharge> wrote in message
news:54868be1c170a8@news.codecharge.com...
>
Quote chriss:
> I have a Login link on a website
>
> I want o load a different page depending on user access level or UserID
>
> If UserID = "Admin" (or level)
> load page1
> Else
> load page 2
>
>
>
> Have the login page goto a blank page and on the the before show code for
> the
> blank page put:
>
> global $Redirect;
>
> if (CCGetUserID() =="Admin")
> $Redirect = "your_page.php";
> else
> $Redirect = "my_page.php";
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

aondecker

Posts: 58
Posted: 06/30/2008, 6:31 AM

What is the USERID of your admin?

You would need to replace the =="Admin" with your UserID

i.e.

if (CCGetUserID() == 1)
$Redirect = "your_page.php"


If you have multiple admin's then you have to use the CCGetGroupID() and set it to the Group ID of your admins (Project->Settings->Security Groups)

if (CCGetGroupID) == 99)
$Redirect = "your_page.php"

hope that helps
View profile  Send private message
chriss
Posted: 06/30/2008, 7:56 AM


No - dosen't make sense...

still find ONLY the last statement is executed !!

I put the value of the UserID on the page ( 1 is admin, 2 is chris and 3-6
are other users)

Depending on who I login ie. bill (=5) - the UserID is displayed


ie. else
$Redirect = "userpage.php"
-----------
function Page_BeforeShow()
{
$Page_BeforeShow = true;
//End Page_BeforeShow

//Custom Code @3-968A1CAC
// -------------------------
global $Redirect;

if (CCGetUserID() =="Admin")
$Redirect = "adminpage.php";
else
$Redirect = "userspage.php";

// Write your own code here.

If I swap the pages in the if statement the LAST line executes!

"aondecker" <aondecker@forum.codecharge> wrote in message
news:54868e0155168d@news.codecharge.com...
> What is the USERID of your admin?
>
> You would need to replace the =="Admin" with your UserID
>
> i.e.
>
> if (CCGetUserID() == 1)
> $Redirect = "your_page.php"
>
>
> If you have multiple admin's then you have to use the CCGetGroupID() and
> set it
> to the Group ID of your admins (Project->Settings->Security Groups)
>
> if (CCGetGroupID) == 99)
> $Redirect = "your_page.php"
>
> hope that helps
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

alii

Posts: 5
Posted: 06/30/2008, 11:51 AM

hey

instead of redirecting based on user id try redirecting based on group id. check out this link

http://forums.yessoftware.com/posts.php?post_id=93632&s_keyword=

it worked for me.
View profile  Send private message
chriss
Posted: 06/30/2008, 1:54 PM

Thanks

It worked with the redirect after I added

CCSecurityRedirect("", "login.php");

before the if statement!



"alii" <alii@forum.codecharge> wrote in message
news:548692b39b3109@news.codecharge.com...
> hey
>
> look at this link
>
> http://forums.yessoftware.com/posts.php?post_id=93632&s_keyword=
>
> it worked for me.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.