tags:

views:

288

answers:

3

Here is the situation:

I have a mediawiki installation, and a few additional server-side scripts that require more resources and were already written in a different language (python). The python code will be very loosely coupled with the mediawiki code (only called by clicking on a link here or there)

What I would like is that when a GET or POST command is sent to the server to execute a python script, I would like to check to see if a user is already logged in to mediawiki. If not, I would like to just redirect them to the mediawiki login page.

Any ideas? There are several articles on integrating mediawiki with other PHP frameworks like drupal and forum software, but that is more than i need.

What is the best way to do this? -check for cookies somehow (is this secure?) -does the mediawiki db keep track of who is logged in?

Thanks

A: 

You can use the MediaWiki API to get the userinfo and parse that in XML.

Jon
Ok, I see this, but the problem is that the API takes the user name as an argument. How could I prevent someone from spoofing the name? Basically, I'm assuming that I need to do 2 things:1) Find out which user is attempting to use the service2) Find out if this user has legitimately logged on this session
Bill Zimmerman
Jon
A: 

All you need to do is essentially forward the session, cookies and all, to the API as if it's the user querying.

How would one go about doing that? I can access the API directly and see my login info, but if I access it via PHP, it shows me as not being logged in (anonymous user id "0"). How do I forward the session, cookies, etc. to the API via PHP to show the user's info?

TerranRich
A: 

hello, I also have the very same doubt. Is it that you solved this problem?? I'd be very thankful if you could please help me... =)

fladeisn