• 0

Need some help with a script.


Question

Hey guys, on my site DominateDominion.com I am trying to have a table that updates every day. Basically, I play a game called League of Legends and they have a map called Dominion. There is no ranked mode for dominion, but I was given some files that can get the players elo. I have a note pad where I type in the person's usernamer whos elo I want to find out, then I run a batch file, and open results.txt and it gives the players elo. The guy who gave me the files said all I need for it to update on my site automatically each day was a script where it dumps all the users from the site to a file, runs the batch file, then sends the update back to the server. So how could I do this? I'm don't know any programming or anything at all. Where should I start looking?

Link to comment
Share on other sites

Recommended Posts

  • 0

To have a script executed once per day you need a scheduled task / cronjob.

If programming is needed, then you'll need to post a copy of the code this person has given to you, along with any relevant code from your website and hope someone here has some free time to help you integrate it.

Your site appears to be running wordpress, so thats a good start, we know you've got PHP available.

Link to comment
Share on other sites

  • 0

To have a script executed once per day you need a scheduled task / cronjob.

If programming is needed, then you'll need to post a copy of the code this person has given to you, along with any relevant code from your website and hope someone here has some free time to help you integrate it.

Your site appears to be running wordpress, so thats a good start, we know you've got PHP available.

I can do it manually as well. But it's not a script he gave me. Or maybe it is. He sent me like 4 files.

Link to comment
Share on other sites

  • 0

Can you post the files in a zip file on here? Or are they sensitive...

Well he told me he doesn't want me sharing them around a lot. But he knows i'm trying to get it on my site which he is fine with. Sooo... :\

BTW, i'm willing to pay someone if they want to do this for me.

Link to comment
Share on other sites

  • 0

Ok, just so the whole community can help out: the OP has a Windows executable, called by a batch script with a couple of arguments, that returns the results of the query into results.txt.

If you have a Windows server for your webhosting, as theblazingangel said, you can set the batch script up on a scheduled task. From there it's easy to write a PHP file that pulls the results from the text file to display it on your site.

....but I guess the main question is, do you use a Windows server for your hosting?

Link to comment
Share on other sites

  • 0

Ok, just so the whole community can help out: the OP has a Windows executable, called by a batch script with a couple of arguments, that returns the results of the query into results.txt.

If you have a Windows server for your webhosting, as theblazingangel said, you can set the batch script up on a scheduled task. From there it's easy to write a PHP file that pulls the results from the text file to display it on your site.

....but I guess the main question is, do you use a Windows server for your hosting?

Errrmmm. I don't know honestly. I use bluehost.com to host my site.

Link to comment
Share on other sites

  • 0

Errrmmm. I don't know honestly. I use bluehost.com to host my site.

Create a file called whatever.php containing this:

<?php echo $_SERVER['SERVER_SOFTWARE']; ?>

Upload it to your server, go to dominatedominion.com/whatever.php, copy the output and post it here.

Link to comment
Share on other sites

  • 0

Create a file called whatever.php containing this:

<?php echo $_SERVER['SERVER_SOFTWARE']; ?>

Upload it to your server, go to dominatedominion.com/whatever.php, copy the output and post it here.

It says Apache.

Link to comment
Share on other sites

  • 0

You're pretty screwed in that case... unless you get a Windows hosting account.

...or you can get the [uncompiled] source code of the .exe file from the guy who gave you the files (doubtful).

Link to comment
Share on other sites

  • 0

You're pretty screwed in that case... unless you get a Windows hosting account.

...or you can get the [uncompiled] source code of the .exe file from the guy who gave you the files (doubtful).

Is there a way I could do it manually then?

Link to comment
Share on other sites

  • 0

You could modify the batch script (.bat file) to upload results.txt to your server upon completion, and then setup the scheduled task on your own PC... as for how, maybe someone else can help. My command line knowledge only really extends as far as Linux.

Link to comment
Share on other sites

  • 0

The easiest solution i cna think of is uploading results.txt to drop box then getting your site to read the results, i believe there is two ways to do this.

1. edit th bat file to copy the results to your dropbox folder (hell maybe the exe will run from the dropbox folder i dont know check!) then schedule the file to run

2. have 2 bat files one runs the bat file the second uploads to your dropbox

Of cause your computer needs to be on at the time of the schedule

Someone here was uploading a folder with a bat file.

http://forums.dropbox.com/topic.php?id=18137

Link to comment
Share on other sites

  • 0

Just saying that would be the easiest solution as of now, if it is uploaded by schedule then the text file is included its doneas for commandline:

To add new scheduled task:

  • Go to Windows Start Menu > Control Panel > System and Security > Administrative Tools > Schedule Tasks.
  • In the Task Scheduler menu go to Action > Create Basic Task.
  • Give your task a name and click Next.
  • Choose when the task should be run and click Next.
  • For task action, select Start a program and client Next.
  • Browse for WinSCP.exe executable.
  • In Add arguments add appropriate WinSCP command-line parameters to execute the scripting commands you need (typically you will use /script or /command parameters).
    The resulting arguments may look like:
    /command ?option batch abort? ?option confirm off? ?open user:password@example.com? ?put d:\examplefile.txt /home/user/? ?exit?
    Note that the command-line parameter /console was not specified, what makes WinSCP.exe not show the console window, not to disturb you while you are using your workstation.
  • You may want to use /log parameter to turn on session logging to file.
  • When done, click Next, review your options and confirm with Finish.
    source: http://winscp.net/eng/docs/guide_schedule
    O
    f cause it may be different with a host

Link to comment
Share on other sites

  • 0

Alright guys, I talked to the person who gave me the files but i'm a bit confused as to what he is saying. He seems to think this should work though? (I'm thefeedski, he is jabe).

TheFeedski (4:10): Alright, so you know how you told me I just have to get someone to make a script that does whatever

I have ti saved, 1 sec

Ok you said "script where it dumps all the users from the site to a file, runs the batch file, then sends the update back to the server."

Jabe (4:11): yes

TheFeedski (4:11): Ok, so they told me that's easy enough to do if my hosting runs windows.

But they use linux.

So...

Someone said

"you can get the [uncompiled] source code of the .exe file from the guy who gave you the files (doubtful). "

Jabe (4:11): Do you have a database?

TheFeedski (4:12): if you*

Do I have a database?

Jabe (4:12): Yes

TheFeedski (4:12): Uhhh. Maybe? lol

I don't know. :p

Jabe (4:12): Or how are you planning on showing these ranks?

TheFeedski (4:12): I was just wanting them in a table

like highest to lowest.

Jabe (4:12): I assumed you'd have a database of users that people could look at a page and the table would be automatically generated

TheFeedski (4:13): I mean, I have a forum with everyones name.

I mean, they put their LoL account when registering.

Jabe (4:14): What forum software?

TheFeedski (4:14): phpbb

Jabe (4:14): You probably have a database then

TheFeedski (4:15): ah, ok.

Jabe (4:15): So script does...

"select lol_acct from users", dump list to file, execute program, update ratings in DB

Needs an extra column to store ratings first

Then someone can make a page that generates a table of all users

No need to copy files, just update DB

*update and query

He said I have to make sure I have a database first though.

Link to comment
Share on other sites

  • 0

I understand what he's saying, but you need to get results.txt to the server... I'll post something up later tonight that does this. Or if you don't wanna wait, look into this - that's what needs to go at the end of your batch file.

Link to comment
Share on other sites

  • 0

Ok, at the end of your batch script (open it in Notepad), paste this:

ftp -i -n -s:"%~f0"
open dominatedominion.com
user USERNAMEHERE
PASSWORDHERE
cd public_html
literal pasv
binary
put results.txt
disconnect
bye

Then tell us if it's successfully uploaded to http://www.dominated...com/results.txt

If so, we can help you get it from that, to displayed in a table on your website, and then tell you how to automate it. :)

Link to comment
Share on other sites

  • 0

Ok, at the end of your batch script (open it in Notepad), paste this:

ftp -i -n -s:"%~f0"
open dominatedominion.com
user USERNAMEHERE
PASSWORDHERE
cd public_html
literal pasv
binary
put results.txt
disconnect
bye

Then tell us if it's successfully uploaded to http://www.dominated...com/results.txt

If so, we can help you get it from that, to displayed in a table on your website, and then tell you how to automate it. :)

Ok, just so I don't mess anything up. You want me to add that to the end of the batch file then upload JUST the batch file to my hosting? Or do I add that to the batch file and then upload just results.txt?

Link to comment
Share on other sites

  • 0

You just add that to the end of the batch file then run it, if all succeeds it should hopefully upload results.txt onto the server then you just set up a schedule on your computer to automate it.

Btw im curious whats in this text file lol

Link to comment
Share on other sites

  • 0

You just add that to the end of the batch file then run it, if all succeeds it should hopefully upload results.txt onto the server then you just set up a schedule on your computer to automate it.

Btw im curious whats in this text file lol

Ahhh, so the username and password are for my hosting? Not my game user name and password?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.