| | | |  |  | |  |
01.04.2005, 04:21
|
#1 (permalink)
| | Baby Mamber
Join Date: Apr 2005
Posts: 10
| Building Event Registration Module, but need an assist I have been working on a module for one of our clients where registered members of the site can easily register online for upcoming events. Everything is working smoothly - the admin, registration and soon, online payments for the classes.
The problem is that I initially built the module outside of Mambo and have it loosely connected. Meaning that it is not a module per se - but a separate entity that is linked from Mambo. There are parts of the event manager that I need to ensure that only individuals that are currently logged in can access. What is the best manner in which to check if the user is currently logged into the site?
Here is a quick breakdown of the site structure if this helps make the above more clear:
httpdocs/
|_Mambo/
|_Event Manager/
I appreciate your help and hope to be able to release this module some time in the future. Seems that there a re a few people that are looking for such an animal.
Warm regards,  |
| |
01.04.2005, 10:12
|
#2 (permalink)
| | Junior Mamber
Join Date: Oct 2004 Location: Milwaukee, WI
Posts: 31
| Re: Building Event Registration Module, but need an assist Have you checked out the Event Sessions component? http://mamboforge.net/projects/eventssessions/ That may have some good code examples for what you are looking for. I was also able to integrate it with Community Builder http://www.mambojoe.com |
| |
01.04.2005, 19:32
|
#3 (permalink)
| | Baby Mamber
Join Date: Apr 2005
Posts: 10
| Re: Building Event Registration Module, but need an assist Thanx scubaguy, this may give me a template to look at from time to time but really does not resolve the issue that I have at this point. When time allows, I will be working our event manager into a module, but at this time I need to be able to link from Mambo via a URL to the event manager and still be able to check if that user is logged in.
Any other ideas? |
| |
01.04.2005, 19:43
|
#4 (permalink)
| | Expert Mamber
Join Date: Nov 2004
Posts: 328
| Re: Building Event Registration Module, but need an assist I'm not a coder, so take what I'm going to tell you with the reserve of the case. The first thing I would do is to put an index.htm blank to avoid direct access, I guess you already did it. And then... have you played with facile forms? thre is an example to create a Tag board that checks if the person is registered or not. Maybe you can blend your module there.
It is here: http://www.facileforms.biz/content/view/25/47/
Have fun!
S. |
| |
01.04.2005, 22:36
|
#5 (permalink)
| | Baby Mamber
Join Date: Apr 2005
Posts: 10
| Re: Building Event Registration Module, but need an assist Thanx anadantra,
I went through the information you provided via the link - thank you. Hmmm, maybe I need to clarify what I am looking for. Forget everything I said previously and lets focus on one aspect of the problem:
You have a Mambo site with a link to a URL that is not a component or module of Mambo. Lets say that page is test.php. On this page, how would I check if the user is logged in or not?
Or.... should I really think about making the time to turn this into a component so that it is installed within Mambo where I can easily check if a user is registered or not.
Guess what I am basically trying to find out is the process Mambo uses to check if a user is logged in or not. Checking if they are registered is simple... but are they currently logged in.
Thank again for your help - every little bit helps me look at the problem from a different view. |
| |
01.04.2005, 22:51
|
#6 (permalink)
| | Expert Mamber
Join Date: Nov 2004
Posts: 328
| Re: Building Event Registration Module, but need an assist An "easy" way to do it, is to put it in a wrapper or something like that called from the private side of the website. But it will be weak, I'm far from being a hacker and already thought a way to hack it... is someone knows the actual name of your file will be able to access it.
There is probably a simper way to do it, for someone who underestands the system a bit more from the inside...
If you find something, please post it.
S. |
| |
02.04.2005, 16:41
|
#7 (permalink)
| | Junior Mamber
Join Date: Oct 2004 Location: Milwaukee, WI
Posts: 31
| Re: Building Event Registration Module, but need an assist how about this hacked version of the wrapper component http://mamboforge.net/projects/wrapper-login/
"Modification of the original Mambo Wrapper. Adds options to log an external site by Mambo wrapper. Like an expanded wwlogin module, integrated inside original Wrapper."
That should pass the Mambo login information to your Event Manager. The wrapper is an ok solution most of the time, but it is not a substitute for a real Mambo component. Don't get me wrong, it can be done and it can be done well but a full component is always better. Of course it definitely is not easier.
You may also want to check out the external bridge hacks available at http://www.nuy.info for other examples of how to do it. Basically what those hacks do is check if a user exisits in the foreign user table. If the user exists the user is logged in. If not then the user is added to the foreign user table then logged in. |
| |
02.04.2005, 22:26
|
#8 (permalink)
| | Expert Mamber
Join Date: Nov 2004
Posts: 328
| Re: Building Event Registration Module, but need an assist I have found a piece of code that might help you right where I sent you at the begining
global $database;
global $my;
$user = '';
$post = '';
$task = '';
if ($my->username != '')
$user = $my->username;
else
$user = 'Visitor';
aparently the variable you are looking for is $my. This little thing looks up the name of the user and if it is null gives back "visitor". Now, how to use it in your system... that is another storie.
S. |
| |
03.04.2005, 10:06
|
#9 (permalink)
| | Mamber
Join Date: Apr 2004
Posts: 121
| Re: Building Event Registration Module, but need an assist Once you have access to the DB, look into the sessions table and check the userid value against 0. A value that's higher than zero is a logged in user.
Think that's what you needed? |
| |
04.04.2005, 21:51
|
#10 (permalink)
| | Baby Mamber
Join Date: Apr 2005
Posts: 10
| Re: Building Event Registration Module, but need an assist Thanx to everyone for your insight - but still battling with this one. I guess I need to further clarify what I am seeking.
The username in a file outside of the Mambo construct. I see that Mambo writes most of the variables to a global array which is easy enough to pick apart and I can see if a user is actually logged in from the mos_session table. The username will exist there - along with the session_id and a userid > 0. But the sticker is that I need the username first before checking if the user is logged in.
I am working my way through the functions that Mambo uses to login a user and see if I can follow the path - somewhere along the line a number of functions should be called to set [my] =>. Right now when I echo the global array, [my] is NULL.
Wrapper idea... hmmm. I will be incorporating an ecommerce ability to register for various classes online, so want this module to stand alone. I just feel that I have a better sense of control on what is happening this way. From what I understand, the wrapper may present some vunerabilities that I do not wish to incorporate. Maybe I am not understanding the concept well enough.
Man.... one of these days I need to hire someone so I can offload some of this other stuff. I've got to much work coming in and not enough time to learn everything I need to know. These little things kill the schedule. |
| | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT +2. The time now is 15:13. | | | |