Uploading data via POST -- username?

Questions and discussions on development tools for WarcraftRealms
Locked
Wincefish
Posts: 2
Joined: Wed Jan 07, 2009 9:53 am

Uploading data via POST -- username?

Post by Wincefish »

I'm looking at the POST form on the Upload page to try and make simple Perl script to upload census scans. (I figure it will be simpler and more portable than UniUploader. And yes, if I can get it to work, I'll definitely open source it.)

In the POST form there are "name" fields for the Census file ("userfile") and the Killing Fields file ("bg_file"), but there don't seem to be any field for a WarcraftRealms username.

I'm guessing you're doing this with cookies right now, but is there any way to expose the username as a field in the POST form? Or is it already exposed, but just not used in the Upload script?

User avatar
Rollie
Site Admin
Posts: 4783
Joined: Sun Nov 28, 2004 11:52 am
Location: Austin, TX
Contact:

Post by Rollie »

You'll want to tie into the uniupload area instead.

URL: http://www.warcraftrealms.com/uniupload.php

POST variables:

CensusPlus - The Census data
WR_KillingFields - Killing fields data
user - your WR username
pw - your WR password
phpbb:phpinfo()

Kosh
Census Taker
Posts: 84
Joined: Sun Jul 01, 2007 2:59 am
Location: Somewhere on or near Earth

Post by Kosh »

Seeing the POST variables documented inspired me to whip up a script to compress & upload my own file. I was about to dig up how to do it in PHP when I remembered that the trusty old curl could submit as well as fetch URLs. I can post the shell script later if anyone is interested, but the username / password part of the upload doesn't seem to be working. Here's the relevant command:

Code: Select all

curl -F CensusPlus=@CensusPlus.lua.gz -F user=Kosh -F pw=**password** http://www.warcraftrealms.com/uniupload.php
, and here's the output I'm receiving:

Code: Select all

Looking for file
IP&#58; *.*.*.*<br>
United States<br>
*.*.*.* - us - 
File appears to be valid, checking your version number.
Checking your file
Found CensusPlus Database
Found CensusPlus Info Data
Found Version Number => Version&#58; 4.2.0 <Found> Locale&#58; US <=
Attempting to make entry

Getting User/pass
Username &#58; Kosh<=
Sorry, unable to determine login.  Either no login was supplied or login/password not found.
Version check complete!

Thank you for submitting your file!
It will be processed soon and the data will be added to all listed data!

Looking for WR_KillingFields
No file found
The only things modified are the password & IP address. Note that it did properly handle a gzipped file.

So, even though it seems to have found my username, it didn't like it or didn't find the password. Is it possible one or both of them are looking for variables with a different name?

User avatar
Rollie
Site Admin
Posts: 4783
Joined: Sun Nov 28, 2004 11:52 am
Location: Austin, TX
Contact:

Post by Rollie »

No, it is looking for either 'pw' or 'password'.

I have added an output for the password if you also pass in the variable test=1 also.

Hopefully that will help you figure out the problem =)
phpbb:phpinfo()

Kosh
Census Taker
Posts: 84
Joined: Sun Jul 01, 2007 2:59 am
Location: Somewhere on or near Earth

Post by Kosh »

Thanks, that helped me uncover a stupid error on my part (unescaped special characters). :oops:

Now that I've fixed that, I am now seeing the following at the end of the response:

Code: Select all

Error => Unable to query &#58; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 on line&#58; 285 of /home/wrlogin/public_html/uniupload.php

User avatar
Rollie
Site Admin
Posts: 4783
Joined: Sun Nov 28, 2004 11:52 am
Location: Austin, TX
Contact:

Post by Rollie »

Hmm... can you email me, rollie (at) warcraftrealms.com and get me more info on your post?
phpbb:phpinfo()

Kosh
Census Taker
Posts: 84
Joined: Sun Jul 01, 2007 2:59 am
Location: Somewhere on or near Earth

Post by Kosh »

Sorry, didn't check back until now; I can email you if you still want me to, but the same error occurred either with or without "test=1" (which doesn't surprise me, since that shouldn't have any effect on the SQL you're assembling).

Note that a later submission (using the same curl code) was successful, and shows up in my "updates" list (it's the one at Feb 01, 09 01:41:18).

If you weren't working on the PHP script before that time, then I suppose it's just a transitory glitch.

Locked