Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

External Website

H3 Hax
Registered User
Join date: 31 Aug 2007
Posts: 1
01-21-2009 07:45
Hi,

I'm looking to get some help with external websites. I would like to pay avatars in exchange for visiting my website, clicking on an ad or points for a purchase.
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
01-21-2009 11:51
You'll need to do some scripting and database stuff on your server. Common configurations use PHP and MySQL, although there are lots of other possibilities.

The first challenge you've got to address is figuring out which avatar is associated with the person clicking stuff on your site. Unfortunately, you can't really do that accurately unless you require the person to login to your site.

(You could alternatively use a parcel media hack in-world to figure out IP addresses, and compare that to the IP addresses of website user... but that requires the user to be in SL at the same time, and would fail miserably for people behind a router, as they'd be sharing one IP address.)

Once you've figured that hurdle out, you just need to store a list of who clicked or used what on your website, and then report that back into SL to a payment object. The object could either 'poll' your server periodically using HTTP requests, or you could use email or XMLRPC. (Or, if you can wait a bit, use the HTTP server stuff that's still in beta I think.)
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
01-21-2009 14:13
Somehow this post has inspired the thought in me "what if there was server-side LSL for http servers?" -- totally crazy?!? well suspend disbelief for a moment -- remember that JavaScript has been used server-side (ref particularly John Resig's work and the Mozilla/Netscape stuff); and, yes, no doubt additional events and library additions would be needed; and, of course, simulators would have to add a communications protocol, but given all of that were possible, it's fun to ask... what if?

/esc

BTW I've had less than 8 hours sleep in the last 72 hours, so I'm probably just high on endorphins.
_____________________
http://slurl.com/secondlife/Together
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
01-21-2009 16:22
Now that's an idea I could really get into. Not for any particularly practical purpose... but just because it's crazy enough to be worth trying! :-)

Implementable in Python I guess? Never done much with it, but might be fun.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-22-2009 03:14
That's basically what the HTTP-In feature will do, only the "server' has to be a Second Life simulator rather than any arbitrary old machine you've got hooked up to the Internet. Let's see if it still looks as desirable shortly after HTTP-In goes live, eh? ;)
Ryak Ulrik
Registered User
Join date: 8 Jan 2009
Posts: 4
01-23-2009 05:56
Couldn't you just pass the avatar name to your website using httprequest, then once they complete some event on your website, pass it back into a script with some payment information, use w-hat to grab their key, and pay them?

I'm still relatively new to LSL, but I don't see why this wouldn't work...in fact I've developed and used something similar. mine works a little differently(see below) but I'm sure you can do it the way you are talking about.



below:
don't have the code here, but if you find me in game I'd be glad to share it with you. I have a script that uses httprequest to pass the avatar name into my web page and store it into my DB (you could use a session variable pretty easily here). Once certain events are run, the DB updates that avatars record with a new balance(a simple 'int' DB column that starts at 0, and is incremented based on whatever you have them do on your website). Then, in game, the user has a kiosk that allows him/her to view their balance, and withdraw any money owed to them.
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
01-23-2009 06:29
I'd recommend using the UUID rather than name, since you can detect that in-world just as easily. It lets you avoid the w-hat query too.

The problem is determining that the person controlling the avatar is the same as the person doing stuff on your website. However, if you lead them to your website using a URL given to them in-world, then the URL could be encoded with the avatar's name/UUID, which can be stored as session data. Their activity could then be logged for the duration of the browser session.

It's not an ideal solution, because sessions can expire, and people might forget to use a URL provided in-world. (Although you could probably make something prominently visible saying "you are currently earning Lindens as (avatar name)";). There is the slightly security implication though that somebody could create fake linkers to your site, and make unwitting users earn Lindens on their behalf... although you could avoid that by negotiating a unique session key to be encoded into each URL too.
Ryak Ulrik
Registered User
Join date: 8 Jan 2009
Posts: 4
01-23-2009 08:24
From: Pedro McMillan
I'd recommend using the UUID rather than name, since you can detect that in-world just as easily. It lets you avoid the w-hat query too.

The problem is determining that the person controlling the avatar is the same as the person doing stuff on your website. However, if you lead them to your website using a URL given to them in-world, then the URL could be encoded with the avatar's name/UUID, which can be stored as session data. Their activity could then be logged for the duration of the browser session.

It's not an ideal solution, because sessions can expire, and people might forget to use a URL provided in-world. (Although you could probably make something prominently visible saying "you are currently earning Lindens as (avatar name)";). There is the slightly security implication though that somebody could create fake linkers to your site, and make unwitting users earn Lindens on their behalf... although you could avoid that by negotiating a unique session key to be encoded into each URL too.

There ya go, much more direct way than mine. Still learning a bit here.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-23-2009 08:59
Or simply make the "sign-up" process occur in-world. Give the avatar a (temporary) password via llInstantMessage() that they can use to login to your website using their SL resident name. Meanwhile you've communicated to your web server and told it to prepare for resident "Joe Blow" with key "12341234-1234-1234-1234-123412341234" and temporary password "1xH84Yi2". Most of this can be behind the scenes. As far as the user is concerned, they touch a prim and get a URL and a password.