topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday November 11, 2025, 12:11 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Recent Posts

Pages: prev1 ... 91 92 93 94 95 [96] 97 98 99 100 101 ... 122next
2376
Pretty darn snazzy!

I've just used it to send a few software reviews from DC to my Kindle.  Very nice!
2377
Okay, through experimentation and browsing some of the documentation, I've been able to:

(a) create a database containing a single table, using phpMyAdmin
(b) created a single table
(c) populated that table with five rows, consisting of three fields each: ID, DC username, and DC user's website URL

Then, I wrote a PHP/XHTML file to pull data from the database and display it.

The result is shown here, and I've attached the MySql database and my PHP code as a zip.  Am I on the right track?

dcUsersViaPHP.png

I've I'm not mistaken, this example is not much less complex than what I want to do with my game's highscores.  At least, as far as processing data within the while( ) loop in the PHP code.  Reckon I'd just need a bit more code in order to allow a user to submit data from my desktopApp game...
2378
Yeah, actually! :)

I'm coding a PHP-driven address book that'll use a webpage interfaced with a database to pull data from and push data to the pertinent table in a database...
2379
Thanks.




My first PHP program:

helloWorld_php.png
2380
Look okay for what I'll need, just to begin learning and to complete the PHP lessons in Programming School?

XAMPPstatus.png
2381
Thanks, folks!  Installing ............. 63% ......
2382
Do I want to install the three services shown in this setup screen?  Or will each be activated 'as needed' if I don't make them services?  In short, I don't mind installing them as services if they'll avoid headaches as I learn PHP.  But, if the differences would be transparent to me, I'd just soon not install them as services.

XAMPPoptions.png

2383
Ah, I get it!  Yeah, I've been making it way harder than it is.  I keep thinking in terms of files because

(a) you'd send me a "file" via email
(b) my desktop apps deal with "files"

But all the webpage script needs is the data that's in the files.  Sweet.

So the database you'd eventually create would only be for my game's highscore data, right?  And later, if I had another project that needed such web-reciprocity, it'd use a different database (understanding, of course, that it might be possible that some apps could share certain databases, depending on circumstances).
2384
This database would hold the submitted files?
2385
So, how would this work, mouser?  I have to get some PHP working on XAMP, then submit it to you for proofing/approval, and then it goes in some special directory on the DC server?  Or can the script run within a subidrectory of my own DC webspace?
2386
Okay, I'm convinced. 

Unfortunately, this is going to mean delaying releasing this app.  What I really want to do is spend some time in the next few weeks working through the Stage 2 C# assignments in the Programming School.  But now it looks like I'll have to break away long enough to figure out how to do the PHP I need for Highscores submission, collating, and reporting in a webpage.

Shouldn't be that hard, once I understand the syntax of PHP.  Basically, each 'highscore.dat' file just contains a single line of text, such as these three examples, and the program splits them into 'highscore' and 'userWhoAchievedThisHighscore' using the semicolon character as a delimeter:

10500;mouser
8755;kyrathaba
12200;worstje

When it saves a 'highscore' on disk, it encrypts it first, so the user(s) of the game can't peek.
2387
Yeah, I'm very desktopApp-centric in my thinking, because that's all I've every done.  It would be better if the server did it all.  Is there some sort of free desktop app that I could use in conjunction with developing such a script, just to test the script and know that it will work once uploaded to a server?  Or can I just tinker with scripts, uploading them to one of my subdirectories and testing them directly?
2388
Here's my application in its current incarnation (screenshot).  I want to add a menu item "Share my highscore", or something to that effect.  It should allow the user to upload the small (20-50 byte) file containing their highscore to a designated /incoming/ directory on DC.  I would have another utility program that allows me to scan that particular online folder and download all such files currently residing their, opening each, retrieving username and highscore, and compiling an HTML file showing a listing of the game's users and their highscores in descending order.

Would something like this (modified slightly) work?  I realize there has be a complimentary PHP script residing on the server...

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>

postViaPHP.png
2389
Mouser, I promise to look into PHP.  In the meantime, worstje, I'd be very grateful for your ugly code ;)  I promise never to share/re-post it anywhere. 
2390
Thanks, wraith.  Yes, and I have the know-how to encrypt a password in my app.  I wouldn't put it in raw.  But I understand that it's better, probably to use some other file-submission method.

Let me ask this: does DC have a server-side script I could reference from the html code in a webpage, so that a user could upload a small (few bytes) binary file to a designated /incoming/ directory of my webspace?
2391
Only concern I got is how are you going to keep people from using a .net disassembler to see the password?

To follow up on ham's point -- you'd be insane to try to save high scores by embedding ftp login credentials in your public app

Sorry guys, didn't realize.  That's one thing I value most highly about DC; gaining the benefit of others' expertise.
2392
Or, the program could invoke the user's default email client to have them send their obfuscated highscore file to me.
2393
I don't know how to write server-side scripts.  I guess I could just put up a submission form on a webpage and then have the program direct the user to that form to submit a file via by posting.
2394
I tried the following code in a console program, and received this error message:
The remote server returned an error: (530) Not logged in.

Code: C# [Select]
  1. static void Main(string[] args) {
  2.  
  3.             // Get the object used to communicate with the server.
  4.             FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://kyrathaba.dcmembers.com/testbed/test.txt");
  5.             request.Method = WebRequestMethods.Ftp.UploadFile;
  6.  
  7.             request.Credentials = new NetworkCredential("kyrathaba", "substitutedForActualPasswordInThisForumPost");
  8.  
  9.             // Copy the contents of the file to the request stream.
  10.             StreamReader sourceStream = new StreamReader("test.txt");
  11.             byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
  12.             sourceStream.Close();
  13.             request.ContentLength = fileContents.Length;
  14.  
  15.             Stream requestStream = request.GetRequestStream();
  16.             requestStream.Write(fileContents, 0, fileContents.Length);
  17.             requestStream.Close();
  18.  
  19.             FtpWebResponse response = (FtpWebResponse)request.GetResponse();
  20.  
  21.             Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
  22.  
  23.             response.Close();
  24.  
  25.             Console.WriteLine("Press a key to end program...");
  26.             Console.ReadKey();
  27.         }
2395
Thanks for the possible help.  Looks like the project hasn't been updated since Feb. 2008, and that was has been done is mostly focused on SMTP/POP.  The only FTP related stuff I could find, so far, was:

Code: C# [Select]
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Indy.Sockets.Web {
  7.     class FTP {
  8.     }
  9. }

I'll keep looking through the download and documentation, though, just to be thorough.
2396
I have no problem doing this via Filezilla, but I need to figure out how to upload a file to my little corner of DC programmatically, from within my C# applications.  I've tried various things, from FTP classes I've both found and rolled myself, and using HttpWebRequest.  I also read about the winhttp.dll library, which some people say works whereas the internal C# stuff is not always robust (however, I have no experience with that library's functions).

The reason I need to be able to do this programmatically is that I've coded a game.  That game records the highscore, and updates that value whenever a player beats the previous high score.  I want the program to be able to upload the highscore.dat file (which contains not only the highscore, but also the name of the player who scored it) to a specific directory under http://kyrathaba.dcmembers.com

Does anyone have any working C# code that they've used successfully to upload a file to their DC webspace?  I know that DC uses explict FTP over TLS.  Perhaps the methods I've attempted aren't sophisticated enough to negotiate that.  At any rate, it'd be a real boon (not just to my current project, but also to future ones) if I could find a class or component that allows me this functionality.

I have used the code show here before successfully, on a non FTPES site, but can't get it to work here.
2397
General Software Discussion / Re: Software recommendations for writers
« Last post by kyrathaba on May 13, 2011, 05:59 PM »
Hmm, ChapterByChapter looks useful.  Has anyone used it?

I'm wanting to write a couple of different books for Kindle.  Think I'll start them in ImmersEd, then import them into CbC.  Hmm...

CbC automates or great facilitates these tasks:

  • renumbering chapters
  • search/replace within chapters
  • easy chapter revisions
2398
GooGooGaaGaa
PrattleRattle
MeSee-Say"Hay!" (Jar-Jar-Binks suggested this one...)
MonkeyHear-MonkeySay
SpunkyStarter
BabbleBooster
2399
General Software Discussion / Re: Software recommendations for writers
« Last post by kyrathaba on May 11, 2011, 04:47 PM »
Read another software tip in a magazine today: ImmersEd from www.tajuta.com, that seems to extend the uncluttered writing environment with a few nifty gadgets, that can be helpful when writing, gotta start testing though.

Nice find, Ath!  Tried ImmersEd and LOVE it!  Will use this for the roughing-out of my book-for-Kindle.
2400
Developer's Corner / Re: Code Samples from Microsoft
« Last post by kyrathaba on May 08, 2011, 07:42 AM »
Can you add your own samples to it (locally, I mean; not in the cloud)?
Pages: prev1 ... 91 92 93 94 95 [96] 97 98 99 100 101 ... 122next