Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

PHP help?

Seemok Capalini
Registered User
Join date: 4 May 2007
Posts: 17
05-24-2009 04:29
Hi there.
I'm currently working on a project that stores all kinds of parameters and eventually output a script to the user containing those parameters. At first I was just dumping everything to chat, but since it was too large for a single line it didnt seem the qway to go (people would need to disable timestamps etc.) So im trying to do it via httprequest, which i've seen done in other applications. I managed to send the data to a basic php script on my server and echo it back to the object, but thats about as far as my php knowledge goes. I'd imagine I need to write the data to a file that contains the rest of the script to display, and also somehow make sure each user gets a unique link containing their key etc. Is there anyone who is willing and able to assist me with the php side of this project?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-24-2009 06:45
From: Seemok Capalini
Hi there.
I'm currently working on a project that stores all kinds of parameters and eventually output a script to the user containing those parameters. At first I was just dumping everything to chat, but since it was too large for a single line it didnt seem the qway to go (people would need to disable timestamps etc.) So im trying to do it via httprequest, which i've seen done in other applications. I managed to send the data to a basic php script on my server and echo it back to the object, but thats about as far as my php knowledge goes. I'd imagine I need to write the data to a file that contains the rest of the script to display, and also somehow make sure each user gets a unique link containing their key etc. Is there anyone who is willing and able to assist me with the php side of this project?

no need to disable timstamps... use newline characters to move the begining off the object say, or even use comment wrappers to contain breaks in the stream...

if you are sure you want to use php, instead of having it reflect the variables you feed it, instead make a page that takes preconfigured variables and builds the content within the php, and then have the script spit out the URL to that script along with all a reference list to chat and let the use open that url to get a script spit at them...

eg
script builds url http://some.com/script.php?ABCDEF
where abcdef are the options the php script reads and replaces with code segments to return

granted it's not very updateable but it'll save you from dealing with SQL just yet.

you could also save each option as a flat file, so that the php can read those. but at that point you might as well take the time and use SQL to store them.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Seemok Capalini
Registered User
Join date: 4 May 2007
Posts: 17
05-24-2009 14:14
From: Void Singer
no need to disable timstamps... use newline characters to move the begining off the object say, or even use comment wrappers to contain breaks in the stream...

With newline character I assume you mean "\n". Which I use allready, but when dumping the info (either by speaking the string or speaking llDumpList2String(data,"\n";); ) The string is cut off before the end.
What do you mean by 'comment wrappers'?

If I can avoid the script being dependent on remote server i prefer to do so
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-24-2009 15:46
if you copy the output of the following script from the chat window to a script it'll run, even with the name of the original object or timestamp in the middle of it. (it's just the default hello avatar script) a double beginning newline, and a trailing one gives whitespace around the script to be copied
CODE

/*
this is a wrapped comment
but it could just as well be
an object name with a time
stamp, or some other mess
*/

default{
state_entry(){
llOwnerSay( "\n\ndefault\n{\n state_entry()\n {\n "
+ "llSay(0, \"Hello, Avatar!\";);\n }\n\n/*" );
llSleep( 0.1 );
llOwnerSay( "\n*/\n\n touch_start(integer total_number)\n {"
+ "\n llSay(0, \"Touched.\";);\n }\n}\n" );
}
}


I only recently found out they they finally instituted multiline comments so don't feel bad.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
05-24-2009 18:12
From: Seemok Capalini
If I can avoid the script being dependent on remote server i prefer to do so

If it turns out that you do end up needing remote storage, you might want to take a look at stuff like this: http://aubretec.com/products/sldb/

I prefer to roll my own storage, but SLDB is free, and looks pretty easy to set up and use.


.
_____________________
Seemok Capalini
Registered User
Join date: 4 May 2007
Posts: 17
05-25-2009 16:47
From: Void Singer
if you copy the output of the following script from the chat window to a script it'll run, even with the name of the original object or timestamp in the middle of it. (it's just the default hello avatar script) a double beginning newline, and a trailing one gives whitespace around the script to be copied
CODE

/*
this is a wrapped comment
but it could just as well be
an object name with a time
stamp, or some other mess
*/

default{
state_entry(){
llOwnerSay( "\n\ndefault\n{\n state_entry()\n {\n "
+ "llSay(0, \"Hello, Avatar!\";);\n }\n\n/*" );
llSleep( 0.1 );
llOwnerSay( "\n*/\n\n touch_start(integer total_number)\n {"
+ "\n llSay(0, \"Touched.\";);\n }\n}\n" );
}
}


I only recently found out they they finally instituted multiline comments so don't feel bad.



Now THAT is something NOBODY knew:P

Thanx a lot this should do it:P
Seemok Capalini
Registered User
Join date: 4 May 2007
Posts: 17
05-25-2009 16:48
From: RobbyRacoon Olmstead
If it turns out that you do end up needing remote storage, you might want to take a look at stuff like this: http://aubretec.com/products/sldb/

I prefer to roll my own storage, but SLDB is free, and looks pretty easy to set up and use.


.


Unfortunately Luc forgot about mac ppl:(
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
05-25-2009 18:39
From: Seemok Capalini
Unfortunately Luc forgot about mac ppl:(
I don't think I understand why you'd say that, since I don't see anything on that page that is OS-specific in any way, but let me say that I'm happy you found a solution :)


.
_____________________
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-25-2009 19:19
I don't get it either. MySQL, PHP, and even Apache should work fine on the Mac OS. I seem to recall that configuration of them might not be all that simple compared to other OSs, but it's certainly possible.
Seemok Capalini
Registered User
Join date: 4 May 2007
Posts: 17
05-26-2009 04:51
From: Hewee Zetkin
I don't get it either. MySQL, PHP, and even Apache should work fine on the Mac OS. I seem to recall that configuration of them might not be all that simple compared to other OSs, but it's certainly possible.


Ooops, thats me judging a downloadlink by it's .zip extension:P
thanks for making me look closer!