Account Balance
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
03-18-2005 14:01
I believe I already know the answer to this but I've been surprised by clever LSL coders in the past.
Is there a way to keep track of an avatar's account balance, aside from logging in as them and looking?
I ask this, as we are using an alt in our group as a bank account. I don't want to share passwords, because that would be a violation of the ToS and open the owner up to theft (of L$ and US$ by credit card) and loss of privacy. In order to assure that the alt owner is on the up and up we need a way to verify the balance of the account beyond taking their word for it.
I was hoping I could find something on the secondlife.com leaderboard that would report an avatar's standing like it does in the SL leaderboard but I was unsuccessful.
Any creative ideas?
~Ulrika~
_____________________
Chik-chik-chika-ahh
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-18-2005 15:03
Well, the cheap solution would be to start the count at whereever your intrepid alt is now, then set up a system of ATMs that interface with a central server every time money is put in, taken out, etc.
Granted, this would not keep track of payments made directly to the alt without using the system, but I believe it would keep valid track of credits and debits if you worked at it.
Personally, I would use llEmail to handle the whole thing. I've a system that does this (email and central server) stuff reasonably, but it's usually a touch hard to understand unless it's in-world, working.
_____________________
---
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
03-18-2005 19:18
From: Jeffrey Gomez Well, the cheap solution would be to start the count at whereever your intrepid alt is now, then set up a system of ATMs that interface with a central server every time money is put in, taken out, etc. Yes. This is exactly what we do right now. We have vendors transfer money to the avatar and send an email to a server. For withdrawal, we were thinking of creating a withdrawl ATM where we simply say how much we transferred into a GOM ATM out loud and it sends an email to our server. The problem is, that it's not automatic. One could forget to use the withdrawal ATM or steal money and no one would know. I was hoping there would be some way of automatically reporting the account balance of an avatar at login with a script. I know the amount is available in the "leaders board" in SL. Is there a way to get to that with LSL? ~Ulrika~
_____________________
Chik-chik-chika-ahh
|
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
|
03-18-2005 19:24
Sorry. No.
|
Jsecure Hanks
Capitalist
Join date: 9 Dec 2003
Posts: 1,451
|
03-18-2005 20:37
If you really wanted to be complex, you could make a PHP script that logs into the second life account area, then extracts your current balance from your account details.
|
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
|
03-19-2005 00:44
From: Jsecure Hanks If you really wanted to be complex, you could make a PHP script that logs into the second life account area, then extracts your current balance from your account details. Just for a laugh, I did it with curl and awk in a bash script Happy to send it to whomever wants it - you'll have to write the bit that sends it to SL, all it does is output a number --Jack Lambert
_____________________
---------------------------- Taunt you with a tree filled lot? hahahahahahaha. Griefer trees! Good lord you're a drama queen. Poor poor put upon you.
-Chip Midnight
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
03-19-2005 20:05
From: Jack Lambert Just for a laugh, I did it with curl and awk in a bash script
Happy to send it to whomever wants it - you'll have to write the bit that sends it to SL, all it does is output a number
--Jack Lambert Jsecure and Jack -- this is perfect! Send me that script Jack. I have a trained Unix monkey here at home and he'll be more than happy to wrangle it for me. You can either post it here or email it to me at [email]Ulrika.Zugzwang@gmail.com[/email]. Thank you so much!  ~Ulrika~
_____________________
Chik-chik-chika-ahh
|
Foolish Frost
Grand Technomancer
Join date: 7 Mar 2005
Posts: 1,433
|
03-20-2005 12:41
Ulrika Zugzwang has a trained Unix monkey at home...
<Bwaaaahahaha>
...
Hmnnn...
...
I have no idea why that's funny...
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
03-21-2005 23:08
I think you might be pulling my leg concerning getting curl to work. I've spent some time looking into this with some success, however I can't get my "/account/transactions.php" page to load. It might have something to do with the JavaScript on that page but I'm not sure.
I have, however, been successful in logging in and grabbing the community page using the following command:
curl --cacert cacert.pem -L -b cookies.txt -c cookies.txt 'https://secondlife.com/account/login.php?type=second-life-account&nextpage=/account/transactions.php' -d 'form[username]=FIRST&form[lastname]=LAST&form[password]=PASSWORD'
Has anyone had any success in using curl to fetch "https://secondlife.com/account/transactions.php"?
~Ulrika~
_____________________
Chik-chik-chika-ahh
|
Jsecure Hanks
Capitalist
Join date: 9 Dec 2003
Posts: 1,451
|
03-22-2005 00:56
Ulrika, build a PHP script that opens a connection to this website on Port 80, then submits your login details to the server. Store any cookies it sends back in PHP variables, and use these to access the transactions page. It's going to need multiple HTTP requests and the scraping of a lot of HTML, but it's entirely possible and should not take more than 1-2 seonds to get the goods if built. If you get really stuck, make me an offer and I'll code it for you 
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
03-22-2005 13:18
From: Jsecure Hanks Ulrika, build a PHP script that opens a connection to this website on Port 80, then submits your login details to the server. Store any cookies it sends back in PHP variables, and use these to access the transactions page. Technically, this is what curl is doing. It should keep the cookies and use them for subsequent requests within the same connection. However, it is not working for me. Hmm. I think I've hit the limit of my abilities. I did so want to impress. I'll have to kick this one up to my expert (sorry, no money for you yet).  I really do think it's that pesky JavaScript at the head of all those pages. ~Ulrika~
_____________________
Chik-chik-chika-ahh
|
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
|
03-24-2005 19:29
From: Ulrika Zugzwang I think you might be pulling my leg concerning getting curl to work. I've spent some time looking into this with some success, however I can't get my "/account/transactions.php" page to load. It might have something to do with the JavaScript on that page but I'm not sure.
I have, however, been successful in logging in and grabbing the community page using the following command:
-- SNIP --
~Ulrika~ Hi Ulrika, sorry it's taken so long for me to respond. I kind of forgot about the forums for a while  You forgot a few hidden fields in your curl statement... From: someone curl --cacert cacert.pem -c cookies.txt -b cookies.txt -L "https://secondlife.com/account/login.php?type=second-life-account&nextpage=/account/transactions.php" -d "[form]username=USERNAME&form[lastname]=LASTNAME&form[password]=PASSWORD&form[type]=second-life-login&form[nextpage]=/account/transactions.php&form[persistent]=y"
That one works for me...results in the transactions page. cURL and OpenSSL are magical  --Jack Lambert edit - incidentally, javascript is basically just text with curl, it shouldn't ever affect things...I've done some *extremely* complicated things with cURL and it handles it beautifully (land and automated tier management anyone? ) ... see below for php example
_____________________
---------------------------- Taunt you with a tree filled lot? hahahahahahaha. Griefer trees! Good lord you're a drama queen. Poor poor put upon you.
-Chip Midnight
|
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
|
03-24-2005 20:03
That reminds me... If your PHP host supports libcurl, you can perform the same kind of thing with PHP... <? function checkbal() { $url = "https://secondlife.com/account/login.php?type=second-life-account&nextpage=/account/transactions.php";
$post_options = "[form]username=USERNAME&form[lastname]=LASTNAME&form[password]=PASSWORD&form[type]=second-life-login&form[nextpage]=/account/transactions.php&form[persistent]=y";
$test= curl_init(); // (put in some error checking)
// Set the curl options curl_setopt($test, CURLOPT_POST, 1); curl_setopt($test, CURLOPT_POSTFIELDS, $post_options); curl_setopt($test, CURLOPT_URL, $url);
// exec it $result= curl_exec($test);
// close it curl_close($test);
// do something with contents... return $result; } ?>
You can learn a bit more on the PHP libcurl page ... Note that you're quite likely to need more options, such as CURLOPT_VERIFYHOST or something... --Jack Lambert
_____________________
---------------------------- Taunt you with a tree filled lot? hahahahahahaha. Griefer trees! Good lord you're a drama queen. Poor poor put upon you.
-Chip Midnight
|
Rathe Underthorn
Registered User
Join date: 14 May 2003
Posts: 383
|
03-24-2005 20:16
Hi Ulrika, I posted a script I wrote to do this a few weeks ago on IRC in #secondlife. Feel free to use or modify it. http://www.metaadverse.com/slxls.php.txtRathe Underthorn MetaAdversewww.metaadverse.com
|
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
|
03-24-2005 20:23
Aha, nice work Rathe. Thanks for sharing  --Jack Lambert
_____________________
---------------------------- Taunt you with a tree filled lot? hahahahahahaha. Griefer trees! Good lord you're a drama queen. Poor poor put upon you.
-Chip Midnight
|
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
|
03-24-2005 23:37
Wow! Thank you Jack and Rathe!  You have been of great assistance. ~Ulrika~
_____________________
Chik-chik-chika-ahh
|