This topic is locked

REDIRECT AFTER LOGIN

8/17/2009 09:53:39
PHPRunner General questions
C
chinwag author

Hi,
I have a project whereby the users $_SESSION["GroupID"] is a city name like LONDON, PARIS, MADRID, ROME.... where ever they are in the world, according to their user profile.
This information isalso automatically filled into one of the fields in my project (field called 'CITY') whenever they make a new entry.
When logging in I would like users to be redirected to a filtered list containing only entries that contain their city in the 'CITY' field.
E.G. If a user logs in whose $_SESSION["GroupID"] is LONDON, I would want the list page to only show entries where the 'CITY' field is LONDON.
I wish to do this with an URL redirect as other situations require users to see all records and not just their own city, so I cant do this with permissions.
I have tried using the search URL but I can't get it to work:

http://www.domain.com/project/table_list.php?a=search&value=1&SearchFor=$_SESSION["GroupID"]&SearchOption=Equals&SearchField=CITY


What should the URL be? at present my URL above literally searches for $_SESSION["GroupID"] rather than converting that to the 'CITY'

M
MaxxaM 8/17/2009

I think the best approach would be to look at your List Page: Before SQL query event. You already know what group(city) is, so try this:
$strWhereClause = whereAdd($strWhereClause,"City = '".$_SESSION["GroupID"]."'");
Obviously you can add all sorts of logic here, but this is a very basic approach. So to get it to work for some users and not others, you would have to add that logic.
Hope this helps a little.

C
chinwag author 8/17/2009

thank you for your reply, but I don't see how this will help with the redirection to the filtered list after login. Or maybe I am being stupid!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=43496&image=1&table=forumreplies' class='bbc_emoticon' alt=':lol:' /> <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=43496&image=2&table=forumreplies' class='bbc_emoticon' alt=':unsure:' />

M
MaxxaM 8/17/2009

In the example I gave you, it's not a redirection...it is handling the sql as the page is loading. So you would look at the Event on the list page that pulls up after login...because the system will know who the user is and what group they are associated with, you can put the code in the Event and it will handle it.
In the example you gave me, the redirection was opening table_list.php. In PHP Runner, go to the events table for the table in question...
The event is:

List Page: Before SQL query
The code you need to place in there is:

$strWhereClause = whereAdd($strWhereClause,"City = '".$_SESSION["GroupID"]."'");
I hope I'm being clear enough, if you're not following or if I'm not going the direction that works for you, hopefully someone else can help. I've been in the position you have before and this worked for me.

C
chinwag author 8/18/2009

In the example I gave you, it's not a redirection...it is handling the sql as the page is loading. So you would look at the Event on the list page that pulls up after login...because the system will know who the user is and what group they are associated with, you can put the code in the Event and it will handle it.

In the example you gave me, the redirection was opening table_list.php. In PHP Runner, go to the events table for the table in question...
The event is:

List Page: Before SQL query
The code you need to place in there is:

$strWhereClause = whereAdd($strWhereClause,"City = '".$_SESSION["GroupID"]."'");
I hope I'm being clear enough, if you're not following or if I'm not going the direction that works for you, hopefully someone else can help. I've been in the position you have before and this worked for me.


That makes sense now, thank you for taking the time to help me. I will try this out and let you know how I got on.