DonWolli
Posts: 93
|
| Posted: 06/09/2008, 4:44 AM |
|
i modified a login form so that it goes to the menu according the users type (via onclick event)
if (strlen(CCGetSession("UserLogin")))
{
if (CCGetSession("GroupID")== 20) $Redirect = "net_menuanbieter.php";// Anbieter
elseif (CCGetSession('GroupID')== 30) $Redirect = "net_menuadmin.php";// Erfasser
elseif (CCGetSession('GroupID')== 60) $Redirect = "net_menuadmin.php";// Mods
elseif (CCGetSession('GroupID')== 99) $Redirect = "net_menuadmin.php";// Admins
else $Redirect = "net_login.ccp";
}
else $Redirect = "net_login.ccp";
This orks really fine, BUT if the user logs in successfully the new page shoult be opened in a _blank window, else the error reload should take place inside the old window(_self).
I googled some hours but didnt find a good working solution. The best this should b to modify some (inexisting?) target variable which works together with $Redirect.
Someone any good ideas?? or even better KNOWLEDGE??
_________________
You may say I'm a dreamer, but I'm not the only one.(J.Lennon) |
 |
 |
datadoit
|
| Posted: 06/09/2008, 12:21 PM |
|
This will likely require javascript to implement. I'd start by
redirecting all successful logins to a redirect page. In that page's
<body> tag reference a javascript function that redirects to the
appropriate location.
Ex: <body onLoad="Goto();">
<script language="Javascript">
function Goto()
{
window.open('page1.php'); //open the new window.
window.opener.location.href='index.php'; //make sure this isn't a
CCS secured page!
}
</script>
This is just a basic idea. You'll have to send url parameters such as
the group id, then check for that id and redirect accordingly since
there's no way to get a session value via javascript that I know of.
Also be aware that browser popup blockers may prevent this from
happening at all.
|
|
|
 |
DonP
|
| Posted: 06/09/2008, 12:22 PM |
|
I don't believe you can redirect to a specific target. However, you
might be able to add some JavaScript to handle it, although it would
have to be custom coding as this is outside of what CCS (and the Web
server) does.
Don (DonP)
DonWolli wrote:
> i modified a login form so that it goes to the menu according the users type
> (via onclick event)
> if (strlen(CCGetSession("UserLogin")))
> {
> if (CCGetSession("GroupID")== 20) $Redirect = "net_menuanbieter.php";//
> Anbieter
> elseif (CCGetSession('GroupID')== 30) $Redirect = "net_menuadmin.php";//
> Erfasser
> elseif (CCGetSession('GroupID')== 60) $Redirect = "net_menuadmin.php";// Mods
> elseif (CCGetSession('GroupID')== 99) $Redirect = "net_menuadmin.php";//
> Admins
> else $Redirect = "net_login.ccp";
> }
> else $Redirect = "net_login.ccp";
>
> This orks really fine, BUT if the user logs in successfully the new page shoult
> be opened in a _blank window, else the error reload should take place inside the
> old window(_self).
>
> I googled some hours but didnt find a good working solution. The best this
> should b to modify some (inexisting?) target variable which works together with
> $Redirect.
>
> Someone any good ideas?? or even better KNOWLEDGE??
> _________________
> You may say I'm a dreamer, but I'm not the only one.(J.Lennon)
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
wkempees
Posts: 1679
|
| Posted: 06/09/2008, 1:52 PM |
|
I must be missing the issue.......
net_login, contains only the loginForm
User enters credentials and clicks Login button.
If authentication fails, user staus on this page.
If authentication is succes, user is redirected to the page set in the properties of the LoginButton ReturnPage.
This default behaviour has as benefit that if net_login is called as first page, user is redirected to the set ReturnPage, if a user reaches a restricted page directly, while NOT logged in, net_login is presented and when login is succesful, user is redirected to the page he came from.
To solve the casus, set ReturnPage to a 'landing page' (could be blank page), test the usergroupID and do the redirection.
Or am I missing something?
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 06/09/2008, 2:26 PM |
|
just did small test, created following pages:
net_login, choose NewPage, LoginPage.
Set LoginButton ReturnPage to net_landing.
net_landing, a blank page. Just put text LandingPage on it.
This page, properties, events: AfterInitialize added:
// -------------------------
// Write your own code here.
// -------------------------
global $Redirect;
$i = CCGetGroupID();
switch ($i) {
case 1: // Member
$Redirect = "net_member.php";
break;
case 2: // Admin
$Redirect = "net_admin.php";
break;
}
//End Custom Code
Then created 2 more pages
net_admin and net_member, each only containing the words 'admin page' resp. 'member page'
This works ok, if previous page button is pressed in Browser one goes back to LoginPage.
And it adhers to the CCS way of doing these cases simple.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
datadoit
|
| Posted: 06/10/2008, 4:53 AM |
|
wkempees wrote:
> I must be missing the issue.......
>
> Or am I missing something?
> ---------------------------------------
Yes. The request was to launch a new window (target='_blank') upon
successful login. However, you provided a good example of a 'landing
page' concept.
|
|
|
 |
wkempees
Posts: 1679
|
| Posted: 06/10/2008, 5:12 AM |
|
@d,
so this means:
first page blank with login.
Upon succesful login new browser with the appropriate page?
Meaning the login page (behind) remains where it is?
I am not going there.
Thanks, Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
datadoit
|
| Posted: 06/10/2008, 5:45 AM |
|
wkempees wrote:
> @d,
> so this means:
> first page blank with login.
> Upon succesful login new browser with the appropriate page?
> Meaning the login page (behind) remains where it is?
> I am not going there.
> ---------------------------------------
I'm with you there! Very dangerous. That's why in the javascript code
there needs to be a convention for also redirecting the opening page to
a non-protected or non-secured page (not requiring a login).
|
|
|
 |
|