Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Aug 25, 2019 1:28 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: What code to use when posting data to a website?
PostPosted: Wed Sep 05, 2012 5:36 am 
Offline

Joined: Sat May 19, 2007 6:01 am
Posts: 300
In my software I will have users registered on a website.
Users shall update their own data as well as automatic data will be updated on the server.

Here is my idea of how it will be done:

1. Use IsConnected to check is the user is online.

2. Use either POST data or to send a form data.

Dim http As New HTTPSocket
http.Get("www.myDomain.com/updateData.asp?USER=123&PASSWORD=123&FiddleData=123", 30)


Or the form...

Dim form As Dictionary
Dim socket1 As New HTTPSocket

// create and populate the form object
form = New Dictionary
form.Value("USER") = "123"
form.Value("PASSWORD") = "123"
form.Value("FIDDLEDATA") = "123"

// setup the socket to POST the form
socket1.SetFormData(form)
socket1.Post("http://www.myformlocation.com/form.asp")


My question here is, how would you do it...??
When writing this post, I think the second choice looks better.... and I will try that alternative. However, I need to prepare the server for these things!!


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Wed Sep 05, 2012 9:03 am 
Offline

Joined: Sat May 19, 2007 6:01 am
Posts: 300
Dim n as NetworkInterface

//Get the NetworkInterface object for the selected item
'n = System.GetNetworkInterface(Me.listIndex)
n = System.GetNetworkInterface

//Get the MAC Address
Window1.MacAddressField.Text = n.MACAddress
//Get the IP Address
Window1.IPAddressField.Text = n.IPAddress
//Get the Subnet Mask
Window1.SubnetMaskField.Text = n.SubnetMask


This is from the Reference Guide and the MAC Address isn't working... I know, it's a network question, but I was thinking of separating users using the MAC Address... So, to put all relevant code belonging to the same issue it's might possible to ask here...(??)

I put this code in app.open and IP + SubNet is working, not MAC! Silly and annoying...
What am I missing???

***
EDIT:
me.text = System.GetNetworkInterface.MACAddress
me.text = System.GetNetworkInterface(0).MACAddress

These two alternatives, to an empty textField, doesn't work as well... ??? Why is that!?
I use the latest copy of REALbasic, 2012 r something.


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Wed Sep 05, 2012 9:26 am 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
This works for me RB2012 R1, Mac:
Dim n as NetworkInterface
Dim i as Integer
Dim mString as string

For i = 0 to System.NetworkInterfaceCount-1
n = System.GetNetworkInterface(i)
mString = mString + "Network interface number "+Str(i)+" has the MAC address "+ n.MACAddress +EndOfLine
Next

msgbox mString

_________________
%Invalidforumsignatureexception% user signature not found


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Wed Sep 05, 2012 9:45 am 
Offline

Joined: Sat May 19, 2007 6:01 am
Posts: 300
me.text = System.GetNetworkInterface(1).MACAddress


Shouldn't be zero, should be one!!
Then it's working! Thank you!!

***
But then again, is that different from different computers!? I'm using broadband network, which is USB in my laptop...
Maybe the zero is for the network card, the Ethernet kind...

So... if I'm using the MAC Address to detect a computer, maybe this person connect to Internet using LAN at work and mobile broadband on the road and then will end up with different MAC Addresses...!?

I never thought of that...
Well, I'll leave that for now.


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Thu Sep 06, 2012 1:25 pm 
Offline

Joined: Wed Sep 17, 2008 2:45 pm
Posts: 220
MAC-adresses are unique to each networkdevice. Theoretically.

Never forget that MAC spoofing is very easy, so don't be sure that every record will be different.

_________________
My native language is not English.


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Wed Sep 12, 2012 9:34 am 
Offline

Joined: Sat May 19, 2007 6:01 am
Posts: 300
I understand and see the limit.

Everything running http is reasonable insecure.
I'd prefer https... even if it also has it lack of trust. But much more work to break.

Using MAC was a way to try to differ a user from another in a logging function.
If I have two computers with the same broadband I think it will show as the same MAC.

It's not so important. It can still be little useful. However, to bear in mind the limit.

When its working, I'd love to have code in a RB project speak to server. Neat!!


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Wed Sep 12, 2012 9:50 am 
Offline

Joined: Sat May 19, 2007 6:01 am
Posts: 300
Works beautiful!!
Data inserted in database!!

Only one problem... When submitting data (ie "Push here to publish") the RB program freeze...
It seems as there is a time-out that never expire!?
What's the deal!?

I use the FORM code, posted above.


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Thu Sep 13, 2012 5:21 am 
Offline

Joined: Sat May 19, 2007 6:01 am
Posts: 300
Taken from the documentation.
Quote:
HTTPSocket.Post ( URL as String, TimeOut as Integer ) As String

How is that done in code!?
Quote:
socket1.Post("http://www.domain.com/dev/insert.asp") <-- working
socket1.Post("http://www.domain.com/dev/insert.asp", 5) <-- not working
socket1.Post("http://www.domain.com/dev/insert.asp", 5) as String <-- not working


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Thu Sep 13, 2012 9:36 am 
Offline

Joined: Sat May 19, 2007 6:01 am
Posts: 300
Quote:
1. 2012-09-12 16:45:38 ... 00:1E:10:1F:AA:49

2. 2012-09-13 01:36:50 ... 00:1E:10:1F:1F:81

3. 2012-09-13 08:39:13 ... 00:1E:10:1F:82:A0

4. 2012-09-13 16:32:12 ... 00:1E:10:1F:2C:0E


Here is another interesting thing... I get different MAC Addresses each time I connect! As you can see, the first four parts are similar, but there is a different end each time.

It makes MAC Address even more insecure!! Even if it's only one user/ computer on a hidden URL and knowing it's me, it's not safe at all!!


Top
 Profile  
Reply with quote  
 Post subject: Re: What code to use when posting data to a website?
PostPosted: Fri Sep 14, 2012 8:41 am 
Offline

Joined: Wed Sep 17, 2008 2:45 pm
Posts: 220
Eclipse wrote:
Quote:
1. 2012-09-12 16:45:38 ... 00:1E:10:1F:AA:49

2. 2012-09-13 01:36:50 ... 00:1E:10:1F:1F:81

3. 2012-09-13 08:39:13 ... 00:1E:10:1F:82:A0

4. 2012-09-13 16:32:12 ... 00:1E:10:1F:2C:0E


Here is another interesting thing... I get different MAC Addresses each time I connect! As you can see, the first four parts are similar, but there is a different end each time.

It makes MAC Address even more insecure!! Even if it's only one user/ computer on a hidden URL and knowing it's me, it's not safe at all!!



This is not normal, every networkcard has its own MAC adress, so, I guess this is a bug in RS?

_________________
My native language is not English.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group