ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

functional C# class/component to upload to my DC space via explicit FTP over TLS

<< < (9/10) > >>

kyrathaba:
Awesomeness... :)

I've gotten the following example working.  I'm able to use the form's post method to add new data to the database and then refresh the webpage to update the html table with the added data (I added Renegade and hamradio's data solely using the web-form's post action):



Project files developed using XAMPP are attached.

Fantastic!

Mouser, don't you think that what I'm wanting to do with 'highScore' data from the game I'm developing falls along the lines of what this example accomplishes?  Basically, I could have my game app programmatically use such a form post-action to send its data to an online database, right?

For instance, couldn't I replace...

$_POST['MyUsrName'];

with...

$_POST[183];

or

$_POST["Ben Franklin"];

as long as in place of the variable I'm using the type of value the database is expecting (int, string, etc)?

Deozaan:
Mouser, don't you think that what I'm wanting to do with 'highScore' data from the game I'm developing falls along the lines of what this example accomplishes?  Basically, I could have my game app programmatically use such a form post-action to send its data to an online database, right?-kyrathaba (May 14, 2011, 10:13 PM)
--- End quote ---

I know that was directed at mouser, but yeah, I do think that's basically what you want.

But you probably also want some sort of verification that it's coming from the game or that the score is legitimate so people don't just type in their own $_POST[189135105313546843]; to give themselves a cheater high score.

kyrathaba:
Excellent point, Deozaan, and easy to do.  Thanks.

kyrathaba:
Let's say I have a C# desktop WinForms application that wants to submit a 'DC_username' and 'User_website' just like the php code does in my above example.  How can the C# app silently (in other words, without requiring the user to type in these values on a form) send these to my update.php page so that it is indistinguishable from the form submit, as far as the php is concerned?

For example, I put the following code in a button's click event, in a C# test program.  It adds a row to the HTML table on my .../addressBook.php page, but both fields are blank:


--- ---            string URI = "http://localhost/addressBook/update.php";

            WebClient wc = new WebClient();
            NameValueCollection NC = new NameValueCollection();
            NC.Add("sampleUserName","sampleWebsiteURL");
            byte[] response = wc.UploadValues(URI,NC);
            string responseString = Encoding.ASCII.GetString(response);
            MessageBox.Show(responseString);



The update.php page is expecting to receive POST data like this:


--- --- $Usr = $_POST['MyUsrName'];
$UsrUrl = $_POST['MyUsrWebsite'];

Is there some way I need to change the format of the data I'm passing into NC above?  Obviously, my update.php page is receiving something, or it wouldn't update the HTML table with blank values.  I need need to figure out how to make my C# app send data in a way that the php recognizes it as the two post variables shown above, right?

worstje:
Give me a few minutes to edit my JottiQ code to remove some passwords and other stuff you don't need, and you'll have a sample. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version