I need a desktop application that logs in to a web site and downloads a backup file and then saves it using a naming convention that gives us a set of rotating backups.
The backup file is a MySQL dump from phpMyAdmin. The php script that creates the file already exists and your app needs to log in to our web site and download a text file called cmbak.sql.
You will provide your own database for testing as ours is a production system with confidential data.
The app will log in by posting a user name and password to an html form. The app will allow us to change the URL, userid and password used. See example login form in detailed requirements below.
The backup file will be downloaded from a URL that can be changed in the app. See example php backup script in detailed requirements below.
The app will be written in C# and source code provided so we can change it later. Although I'll probably come back to you for any changes.
It will be a basic GUI that runs automatically every day at a time that can be changed in the app. It will also have a button to run the backup manually.
The PC we use it on will have the app added to the windows startup menu (no need to run as a service).
After a backup file is downloaded it will be saved to a folder named "c:\bak" and this folder name can be changed in the app. The file is saved using conditions and naming conventions defined in detailed requirements below.
Any parameters that can be changed in the app must be saved so the app remembers them if closed and re-opened.
After the app is created we'll need approx 1 week to test it.
Let me know if you have questions or need clarification on anything.
## Deliverables
I need a desktop application that logs in to a web site and downloads a backup file and then saves it using a naming convention that gives us a set of rotating backups.
The backup file is a MySQL dump from phpMyAdmin. The php script that creates the file already exists and your app needs to log in to our web site and download a text file called cmbak.sql.
You will provide your own database for testing as ours is a production system with confidential data.
The app will log in by posting a user name and password to an html form. The app will allow us to change the URL, userid and password used. See example login form below.
The backup file will be downloaded from a URL that can be changed in the app. See example php backup script below.
The app will be written in C# and source code provided so we can change it later. Although I'll probably come back to you for any changes.
It will be a basic GUI that runs automatically every day at a time that can be changed in the app. It will also have a button to run the backup manually.
The PC we use it on will have the app added to the windows startup menu (no need to run as a service).
After a backup file is downloaded it will be saved to a folder named "c:\bak" and this folder name can be changed in the app. The file is saved using the following conditions and naming conventions:
On 1st day of month: save backup file as [login to view URL] where YYYY is the current year and MM is the current month. If the file already exists it is over written. So we get a permanent archive of monthly backups.
On Sunday's: save backup file as [login to view URL] where W is the current week of the month (1 to 5). If the file already exists it is over written. So we get 4 or 5 weekly rotating backups going back 1 month.
Every day: save backup file as [login to view URL] where DDD is the current day (mon, tue, wed etc). If the file already exists it is over written. So we get 7 rotating daily backups going back 1 week.
Date conditions are not mutuially exclusive, e.g. on the first day of the month that is a sunday 3 files are written.
Any parameters that can be changed in the app must be saved so the app remembers them if closed and re-opened.
The html form for the login page looks like this:
<form action="" method="post" name="frmCampaign" id="frmCampaign">
<p>User ID<br>
<input name="txtUserid" type="text" id="txtUserid" value=""></p>
<p>Password<br>
<input name="txtUserpw" type="password" id="txtUserpw" value=""></p>
<p><input type="submit" name="Submit" value="Submit"></p>
</form>
The php that creates the backup file looks something like this (untested example code):
<?php
session_start();
if($_SESSION["myusername"] == ''){
header("location:[login to view URL]");
}
$this->db = mysql_connect ("[login to view URL]", "sqluserid", "pass")
$command = "mysqldump --opt --skip-extended-insert --complete-insert --host=[login to view URL] --user=sqluserid --password=pass mydb > /var/users/myuserid/[login to view URL]";
system($command);
$write_physical=system($command);
$file = "/var/users/myuserid/[login to view URL]";
$fh = fopen($file, 'r') or die('Could not open file!');
$data = fread($fh, filesize($file)) or die('Could not read file!');
fclose($fh);
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=[login to view URL]");
header("Pragma: no-cache");
header("Expires: 0");
print ("$header\n$data");
?>
After the app is created we'll need approx 1 week to test it.
Let me know if you have questions or need clarification on anything.