What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Sending data to online forms

Pages: (2): « First [ 1 ] 2 » Last »
Sending data to online forms
Author: Message:
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. Sending data to online forms
Now, I am creating something, something special, but I have run into a spot of bother. I want to send data from a Plus! script to a form online, which will then add data to a database. Problem is, this is something I really do not understand and I want it secure. I am confused about sending data from a script into <input> fields online. So if anyone has any basic examples or any tips to make sure it is secure it would really help :).

Thanks :).
07-24-2006 11:22 AM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: Sending data to online forms
take a look at this
http://shoutbox.menthix.net/showthread.php?tid=63...d=694150#pid694150

its a bit more complex than you want... but its still an example of POST'ing data
[Image: dt2.0v2.png]      Happy Birthday, WDZ
07-24-2006 11:27 AM
Profile PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Sending data to online forms
You can't send the data to <input> fields, you have to send it to the php whatever script directly, using preferably POST.

code:
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", postaddress, true);
http.send (postdata);


Something like that.

Securing it, could only be done by using SSL, but you need a server that can handle SSL traffic.

This post was edited on 07-24-2006 at 11:36 AM by Ezra.
[Image: 1-0.png]
             
07-24-2006 11:27 AM
Profile PM Web Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. RE: Sending data to online forms
Well Ezra, a real example would help a lot, just something to point to a script online and send a PostAddress variable to it. I then can work my way into things by myself :).
07-24-2006 11:40 AM
Profile PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Sending data to online forms
Well, that one kinda worked already...

code:
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", "http://www.absorbation.com/script.php", true);
http.send ("The data you want to sent...");


That can be retrieved with the php GET_RAW_POST_DATA function.

code:
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", "http://www.absorbation.com/script.php", true);
http.send ("?name=absorbation&status=online");


This can be retrieved simply by using $_POST['name'] and $_POST['status']

EDIT:
http://www.w3schools.com/ajax/ajax... Also read that, tells you about the xmlhttprequest functions

This post was edited on 07-24-2006 at 11:48 AM by Ezra.
[Image: 1-0.png]
             
07-24-2006 11:46 AM
Profile PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Sending data to online forms
quote:
Originally posted by Ezra
code:
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", "http://www.absorbation.com/script.php", true);
http.send ("?name=absorbation&status=online");


That snippet seems to bear more resemblance to a GET request, where vars are in the URL.
[Image: spartaafk.png]
07-24-2006 12:05 PM
Profile PM Web Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. RE: Sending data to online forms
I am having some slight trouble, what is wrong here? :P

My index.php file: ($con varible is missing for obvious reasons)

code:
$value= mysql_real_escape_string($_POST['value']);
mysql_query("insert into personalmessages values('','1','$value','time')");
mysql_close($con);

And my script code:

code:
function OnEvent_MyPsmChange(NewPsm)
{
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", "http://bananaphone.absorbation.com/index.php", true);
http.send ("?username=absorbation?password=password?feild=psm?value=testing");
}

I know it is sending something, as every time I change my personal message the database has a value added to it. The problem is, it is not adding the $value variable, any ideas why? :)
07-24-2006 12:06 PM
Profile PM Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
RE: Sending data to online forms
quote:
Originally posted by absorbation

I know it is sending something, as every time I change my personal message the database has a value added to it. The problem is, it is not adding the $value variable, any ideas why? :)
Could it be because you have

http.send ("?username=absorbation?password=password?feild=psm?value=testing");

And the script is expecting field?
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
07-24-2006 12:11 PM
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Sending data to online forms
quote:
Originally posted by absorbation
code:
function OnEvent_MyPsmChange(NewPsm)
{
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", "http://bananaphone.absorbation.com/index.php", true);
http.send ("?username=absorbation?password=password?feild=psm?value=testing");
}


Only the first variable should have a question mark the next should have an ampersand (&)

code:
?username=absorbation&password=password&feild=psm&value=testing


EDIT: searching a little about it, I don't think you need that first questionmark.

code:
username=absorbation&password=password&feild=psm&value=testing


Should do the trick

This post was edited on 07-24-2006 at 12:16 PM by Ezra.
[Image: 1-0.png]
             
07-24-2006 12:13 PM
Profile PM Web Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. RE: Sending data to online forms
quote:
Originally posted by Dempsey
Could it be because you have
http.send ("?username=absorbation?password=password?feild=psm?value=testing");
And the script is expecting field?

Nope, I am not currently using that variable, what I have posted is the whole of my code, apart from the $con variable. I am just trying to receive the $value variable at the moment :).

quote:
Originally posted by Ezra

Only the first variable should have a question mark the next should have an ampersand

Still not picking it up :(:

code:
http.send ("?username=absorbation&password=password&feild=psm&value=testing");

And your question mark idea still does not pick up the variable. I am beginning to think it is a problem with index.php? :P

This post was edited on 07-24-2006 at 12:21 PM by absorbation.
07-24-2006 12:15 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On