|
|
Justin |
|
|
Posts: 15,017
Gender:  Male
Posts Per Day: 6.74
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 18 hours
Location: Tallassee, AL
Age: 21
|
There's been a few requests for a Member API for external applications to see member information and all. I've finally built it. It uses Session ID's, so you MUST have it installed and working, and the users must be logged in with SIDs. I've enabled SID-only login available here since it was implemented basically. It's more secure, and it's better to use. That out the way, here's how to use it. It's simple, all you must do is pass the sid to the script via HTTP and it'll return the entire member data (except for password and admin passcode). You may also use it by doing a require('API.pl') in any other Perl script, then by calling the actual routines. HTTP MethodAPI.pl?sid-sessionid/ This information can be found in the users cookie (cookieprefix_session). Let the external application get this cookie, and then call the script and it'll return a list of values, like so:
|
Code
<?xml version="1.0" encoding="ISO-8859-1"?>
<user>
<id>admin</id>
<snurl><a href="v-memberpanel/a-view/u-admin/" rel="nofollow" onclick="target='_parent';">admin</a></snurl>
<lastvisit>1169526813</lastvisit>
<rndsid>-260239|1169577389</rndsid>
<lastactive>1169577389</lastactive>
<option2></option2>
<pmnew>0</pmnew>
<msn>msn</msn>
<email>justin@eblah.com</email>
<option1></option1>
<posts>87</posts>
<lng>Romanian</lng>
<personaltxt>Personal Message</personaltxt>
<registered>1093208407</registered>
<location><script>asdf</location>
<timezone>-6</timezone>
<dateformat>F j, Y, g:ia</dateformat>
<dob>4/25/1986</dob>
<skype>skype</skype>
<siteurl>http://www.site.com</siteurl>
<sn>admin</sn>
<md5upgrade>1</md5upgrade>
<sitename>Sitename</sitename>
<admintxt>Admin Text &</admintxt>
<avatar>Green_Monster.gif</avatar>
<yim>yahoo</yim>
<pmcnt>450</pmcnt>
<lastpost>1168494636</lastpost>
<icq>icq</icq>
<blockedusers>1X|</blockedusers>
<sex>1</sex>
<aim>aim</aim>
<sig>Sergio Tinè</sig>
<avatarsize>65|50</avatarsize>
<lastpm>1166911982</lastpm>
</user> |
|
The external application can then decode this information by splitting the first from the second (: ). The first being the variable, the second being the value of it. Not too difficult. It'll be split by a \n, or a new line. It should be pretty easy to code in PHP or anything else. require('API.pl')This is the same as E-Blah's methods, just call the routine. Get the userid (which is then added to variable $username) by passing the SID to the GetUserID routine, example:
Then the $username variable will have the userid. You can then run the GetMemberID routine, which will get the data you need from the user's data file, example:
Then you'll have a hash reference of the data, which can be accessed in this manner:
|
Code
$memberid{$username}{'userid_variablename'} |
|
So if you wanted the user's sn, do:
|
Code
$memberid{$username}{'sn'} |
|
In the same way, you can get other MemberID's through this method. It should be straight forward to just about anyone with a little knowledge of Perl, it's nothing big.  Enjoy!
|
| I do installs for $25 and upgrades for $20.Technical support is always free. Donate to E-Blah! My Websites: Revolution Reality (My Blog) | MinistryTalk.com | Portfolio"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV  |
|
| Revision History (5 edits; 3 reasons shown) |
| Justin - March 4, 2008, 2:24am | | Justin - March 4, 2008, 2:08am | | Justin - January 23, 2007, 12:50pm | | |
|
|
|
|
|
Mike Brazier |
| January 15, 2007, 12:16pm |
|
|
Posts: 60
Gender:  Male
Posts Per Day: 0.06
Reputation: 100.00%
Reputation Score: +2 / -0
Time Online: 2 days 8 hours 36 minutes
Location: Birmingham
Age: 33
|
Thanks Justin, I will install 10.2 on my test server and have a mess around. I assumed you weren't going to bother with this, thanks for doing this.
Mike. |
|
|
|
|
|
Justin |
| January 23, 2007, 12:57pm |
|
|
Posts: 15,017
Gender:  Male
Posts Per Day: 6.74
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 18 hours
Location: Tallassee, AL
Age: 21
|
|
|
|
|
|
goober99 |
|
E-Blah Member 
Posts: 8
Posts Per Day: 0.01
Time Online: 4 hours 57 minutes
|
Does this also work for E-Blah SQL? |
|
|
|
|
|
Justin |
|
|
Posts: 15,017
Gender:  Male
Posts Per Day: 6.74
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 18 hours
Location: Tallassee, AL
Age: 21
|
|
|
|
|
|
goober99 |
|
E-Blah Member 
Posts: 8
Posts Per Day: 0.01
Time Online: 4 hours 57 minutes
|
I'm planning on writing a web application that integrates with the E-Blah Member system, so visitors to my website don't have to have a separate user name/password for the different parts of the site. I guess my question should have been, "If E-Blah SQL does not currently support the Member API (obviously no), do you plan for it to in the future?" |
|
|
|
|
|
Justin |
|
|
Posts: 15,017
Gender:  Male
Posts Per Day: 6.74
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 18 hours
Location: Tallassee, AL
Age: 21
|
|
|
|
|
|
JonathanW |
| September 6, 2008, 7:12am |
|
E-Blah Member 
Posts: 1
Posts Per Day: 0.50
Time Online: 22 minutes
|
Hello
This looks great. However, I have never written anything in Perl and am struggling with how to use it. I can program in other languages (C++,VB etc) but not Perl. Does anyone have an example of this in use that they could post which would get me started. As background information, we use E-Blah on our church website and would like to add a files page to the website, but only want people to be able to download the file if they are logged on. The files we want to host are MP3 recordings of the service. I have tried including them in a post, but the post is becoming too long and it would be much better in a web page.
Please help me if you can.
Thanks
Jonathan |
|
|
|
|
|
|