473,803 Members | 4,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending data form a vb program too a mysql DB

Hello, as this falls under both VB and PHP I have posted this into two
newsgroups (this is the first time I've done this so if it is mucked up
then I'm sorry).

Anyway I want to make some simple games with in VB 6.0 and then I want
the highscores to go to the server (which uses PHP and MySQL). And if
its possible I would also like the highscores to be viewable on the
program AND on my site.

PHP Part:
I think I need to set MySQL up so it can be accesssed from outside of
the server, but I'm not sure.

Thanks, James.

Nov 14 '06 #1
10 2303
James wrote:
Hello, as this falls under both VB and PHP I have posted this into two
newsgroups (this is the first time I've done this so if it is mucked
up then I'm sorry).

Anyway I want to make some simple games with in VB 6.0 and then I want
the highscores to go to the server (which uses PHP and MySQL). And if
its possible I would also like the highscores to be viewable on the
program AND on my site.

PHP Part:
I think I need to set MySQL up so it can be accesssed from outside of
the server, but I'm not sure.
Are you saying that your VB apps are installed on the users machines,
but that you want the high-scores to be saved on the mySQL database
residing on your web-server?

If so, write a php-script that takes i.e. username and highscore as
params, and make that phpscript do the db-writing on the server.

From vb, use the XmlHttp object or one of its siblings to POST
the data to this php-script on the server.

To view the high-scores, use the same principle. (Do it from php, and
when your vb client needs it, Use HTTP).

--
Dag.

Nov 14 '06 #2

"Dag Sunde" <me@dagsunde.co mwrote in message
news:45******** *************** @news.wineasy.s e...
>
From vb, use the XmlHttp object or one of its siblings to POST
the data to this php-script on the server.

To view the high-scores, use the same principle. (Do it from php, and
when your vb client needs it, Use HTTP).
Dag, how much data is reasonable to move back and forth using the XmlHttp object
in VB6? Is it pretty much limited to a few parameters like name, rank, and
serial number, or can you move a list of stuff? It sounds just right for OP's
needs, but I'm curious about other situations. I suppose I could try moving more
data with a series of calls or something?

Nov 14 '06 #3
Steve Gerrard wrote:
"Dag Sunde" <me@dagsunde.co mwrote in message
news:45******** *************** @news.wineasy.s e...
>>
From vb, use the XmlHttp object or one of its siblings to POST
the data to this php-script on the server.

To view the high-scores, use the same principle. (Do it from php, and
when your vb client needs it, Use HTTP).

Dag, how much data is reasonable to move back and forth using the
XmlHttp object in VB6? Is it pretty much limited to a few parameters
like name, rank, and serial number, or can you move a list of stuff?
It sounds just right for OP's needs, but I'm curious about other
situations. I suppose I could try moving more data with a series of
calls or something?
If you use the "GET", it is limited to the max-length of the URL...

In Internet Explorer, this is 2,083 bytes, so I guess it is something
similar in the XMLHttp-object too.

If you use "POST" on the other hand, it is up to the server.
In IIS, the maximum number of bytes for one form variable is
approx. 102,399 bytes. To overcome this, you just send
several fields (variables) with the same name. IIS (ASP)
will then see them as an array you can loop thru.

I frequently send (POST) 500K via the xmlhttp object to an
ASP script running on IIS 5.0...

So if my POST'ed data look like this:
//PseudoJavascrip t
sData = "xmlData=" + escape("102399B ytesOfData")
sData = sData + "&xmlData=" + escape("another 102399BytesOfDa ta")

xmlReq.open("PO ST", "Receiver.a sp", true);
xmlReq.onreadys tatechange = xmlSendBidCallb ack;
xmlReq.setReque stHeader( "Content-Type",
"applicatio n/x-www-form-urlencoded");
xmlReq.send( sData );

My Receiver.asp will assemble it like this:

//VBS fragment..
Dim xmlData
Dim i
for i = 1 to Request.Form("X mlData").Count
xmlData = xmlData & Request.Form("X mlData")(i)
next

--
Dag.

Nov 14 '06 #4
Um, wouldnt doing it like that give a major vulnerability so users can
cheat by going to http://mysite.com/highscores.php?score=23&name=me or
is that not how you meant :S.

Thanks, James.

Nov 14 '06 #5
Dag Sunde wrote:
Steve Gerrard wrote:
>"Dag Sunde" <me@dagsunde.co mwrote in message
news:45******* *************** *@news.wineasy. se...
>>>
From vb, use the XmlHttp object or one of its siblings to POST
the data to this php-script on the server.

To view the high-scores, use the same principle. (Do it from php,
and when your vb client needs it, Use HTTP).

Dag, how much data is reasonable to move back and forth using the
XmlHttp object in VB6? Is it pretty much limited to a few parameters
like name, rank, and serial number, or can you move a list of stuff?
It sounds just right for OP's needs, but I'm curious about other
situations. I suppose I could try moving more data with a series of
calls or something?

If you use the "GET", it is limited to the max-length of the URL...

In Internet Explorer, this is 2,083 bytes, so I guess it is something
similar in the XMLHttp-object too.

If you use "POST" on the other hand, it is up to the server.
In IIS, the maximum number of bytes for one form variable is
approx. 102,399 bytes. To overcome this, you just send
several fields (variables) with the same name. IIS (ASP)
will then see them as an array you can loop thru.

I frequently send (POST) 500K via the xmlhttp object to an
ASP script running on IIS 5.0...

So if my POST'ed data look like this:
//PseudoJavascrip t
sData = "xmlData=" + escape("102399B ytesOfData")
sData = sData + "&xmlData=" + escape("another 102399BytesOfDa ta")

xmlReq.open("PO ST", "Receiver.a sp", true);
xmlReq.onreadys tatechange = xmlSendBidCallb ack;
xmlReq.setReque stHeader( "Content-Type",
"applicatio n/x-www-form-urlencoded");
xmlReq.send( sData );

My Receiver.asp will assemble it like this:

//VBS fragment..
Dim xmlData
Dim i
for i = 1 to Request.Form("X mlData").Count
xmlData = xmlData & Request.Form("X mlData")(i)
next
Forgot!

The response from these calls has no limit in its response...
(Except for timeout issues...)

So if you send a short request like "getHiscores.as p?limit=all",
and that results in a .responseText being 900K lonk, that
is not a problem, and no special consideration needs to be made.

--
Dag.
Nov 14 '06 #6
James54321 wrote:
Um, wouldnt doing it like that give a major vulnerability so users can
cheat by going to http://mysite.com/highscores.php?score=23&name=me or
is that not how you meant :S.
That can be avoided by letting the VB-App log in to the web-app first,
using the same principle and with a buildt-in MD5 or SHA1 encrypted
password first. Let the login return a sessionID, and then use that
id as a parameter in all subsequent calls.

--
Dag.

Nov 14 '06 #7

Dag Sunde wrote:
James54321 wrote:
Um, wouldnt doing it like that give a major vulnerability so users can
cheat by going to http://mysite.com/highscores.php?score=23&name=me or
is that not how you meant :S.

That can be avoided by letting the VB-App log in to the web-app first,
using the same principle and with a buildt-in MD5 or SHA1 encrypted
password first. Let the login return a sessionID, and then use that
id as a parameter in all subsequent calls.

--
Dag.
Won't doing that mean that I have to use the browser in VB or IE or
something like that meaning that the user will see whats going on?

Nov 14 '06 #8
James54321 wrote:
Dag Sunde wrote:
>James54321 wrote:
>>Um, wouldnt doing it like that give a major vulnerability so users
can cheat by going to
http://mysite.com/highscores.php?score=23&name=me or is that not
how you meant :S.

That can be avoided by letting the VB-App log in to the web-app
first, using the same principle and with a buildt-in MD5 or SHA1
encrypted password first. Let the login return a sessionID, and then
use that id as a parameter in all subsequent calls.

--
Dag.

Won't doing that mean that I have to use the browser in VB or IE or
something like that meaning that the user will see whats going on?
Nope...
:-)

Add "Microsoft XML, v3.0" (or higher) to references in a vb project.

Put a textbox and a command buttom on the form,
and set the textbox multiline property to true
and make it about an inch high.

Paste this code:

Option Explicit

Private xmlHttp As MSXML2.xmlHttp

Private Sub Command1_Click( )

Set xmlHttp = New MSXML2.xmlHttp
xmlHttp.Open "POST", "http://dagsunde.com/pages/Reverse.asp", False
xmlHttp.SetRequ estHeader "Content-Type",
"applicatio n/x-www-form-urlencoded"
xmlHttp.Send "testString =" & Text1.Text

If xmlHttp.readySt ate = 4 Then
If xmlHttp.Status = "200" Then
Text1.Text = xmlHttp.respons eXML.xml
Else
MsgBox "Something went wrong...", vbCritical, "ResponseXM L
error"
End If
End If

End Sub
And run...
(My server will respond, and if you don't use a http-sniffer
or some other tool, you will not see whats going over the line).

--
Dag.
Nov 14 '06 #9

"Dag Sunde" <me@dagsunde.co mwrote in message
news:45******** *************** @news.wineasy.s e...
Dag Sunde wrote:
>Steve Gerrard wrote:
>>Dag, how much data is reasonable to move back and forth using the
XmlHttp object in VB6?

If you use the "GET", it is limited to the max-length of the URL...

If you use "POST" on the other hand, it is up to the server.
In IIS, the maximum number of bytes for one form variable is
approx. 102,399 bytes. To overcome this, you just send
several fields (variables) with the same name. IIS (ASP)
will then see them as an array you can loop thru.

I frequently send (POST) 500K via the xmlhttp object to an
ASP script running on IIS 5.0...

So if my POST'ed data look like this:
//PseudoJavascrip t
sData = "xmlData=" + escape("102399B ytesOfData")
sData = sData + "&xmlData=" + escape("another 102399BytesOfDa ta")
The response from these calls has no limit in its response...
(Except for timeout issues...)

So if you send a short request like "getHiscores.as p?limit=all",
and that results in a .responseText being 900K lonk, that
is not a problem, and no special consideration needs to be made.
Ooh, I like it, 100K seems like decent amount to be able to post, and it looks
like sending multiple blocks is not much more work. I have been ducking away
from doing some of this, but the time is rapidly approaching. Thanks for the
answers and the examples and the "oh it is really no trouble at all" breezy
attitude. I'm sure there will be a little swearing along the way, but I feel
much more confident about making it work.

From the example in your other post:
<?xml version="1.0"?>
<root>
<rev_string>.uo yknahT</rev_string>
</root>
Nov 15 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4453
by: Nomen Nescio | last post by:
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most part, the scripts were created with http://phpcodegenie.sourceforge.net/
2
2510
by: Grady | last post by:
Help. I need to create a simple database that tracks equipment arrivals (and departures) at my facility. What I want is to create a simple form, which the receptionist could fill out, every time someone delivers something at the front door. The form would simply have a place to put the time/date, delivery method, addressee, and a brief description. Once the receptionist filled it out and hit enter it would create a new record and then...
0
1717
by: phil | last post by:
I am having a problem with the C api with prepared statements, the data recorded in the database does not match the data I am sending. It seems to be some sort of bit shifted version of the data, and I have no idea why. I am including code I have been using to test this, followed by the output in the database. I am using mysql version 4.1.12, I have tried this on multiple servers, remote and local.
3
5774
by: eieiohh | last post by:
MySQL 3.23.49 PHP 4.3.8 Apache 2.0.51 Hi All! Newbie.. I had a CRM Open Source application installed and running. Windows Xp crashed. I was able to copy the contents of the entire hard drive onto a USB External Hard Drive. I have to assume I also copied the data. I
7
2688
by: D. Patrick | last post by:
I need to duplicate the functionality of a java applet, and how it connects to a remote server. But, I don't have the protocol information or the java source code which was written years ago. So, I used a packet sniffer and saw the protocol (TCP), the port, IP address, etc. All is good. I tried 2 different versions of .NET code to duplicate the requests to the remote server. Again, I used the packet sniffer and my packets seemed...
2
2483
by: drakorq | last post by:
I got stuck on this, and it would be really great if anybody could point me in the right direction. I was trying setting up these scripts following instructions in a book from 2003, so I thought maybe some of the code might be outdated. Basically this is what Is supposed to happen: 1.- Display a form, enter details into fields and click submit. 2.- After having clicked on submit you're redirected to another page that will display the...
0
1799
by: vladimir.plotnikov | last post by:
Hello! I have problem: I have IPB forum installed. After search in IPB (search takes about 3-4 seconds for post table about 300 000 records) mysql shows "Sending Data" status and takes about 3-5 minutes. I tested with PHP 5.2, PHP 4.4, PHP 4.2.3 - with same results. I switched from MySQL 4.2.18 to 4.2.21 and 4.2.22 with same result.
15
2313
by: colin | last post by:
Hi, Im familiar with c,c++ etc, and Ive spent a week trying to write my first app in c# it works reasonably well, but im having difficulty getting to grips with inter thread signalling etc. I have read all about delegates, event handlers, Invoke methods etc, however they all seem to have undesribale side effects as I have tried them. The hardest part of the aplication is on exit, well I gues I could just
7
9848
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to achieve this. Thanks
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.