-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
* Watch My Domains Server v3.0 Demo / Standard / Professional Edition
* Installation and setup
* Copyright 2010-2018, Softnik Technologies.
* https://softnik.com/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

System Requirements
-------------------

Linux / Windows / Mac OS X System

SSH (Secure Shell) access or Cron job management

Web Server (Apache is recommended)

PHP 5.3.x, 5.4.x, 5.5.x, 5.6x, 7

PHP mb_string module and PHP curl

PHP:PDO Extension

MySQL 5.x

ionCube Loader 4.6 or greater installed on server (only for demo and Standard 
Editions, not required for Professional Edition)

Basic knowledge of Linux, SSH, crontab, server installation, etc.


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
If you are updating an earlier installation.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Overwrite the existing files by unzipping / uploading into the same folder.


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
QUICK 2 Minute Installation
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Step-1
Unpack the ZIP into your web folder
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Unpack the contents of the wmdsed-xx-xx-xx.zip into a folder on your web server. 
Make sure that it is web-accessible.

Make sure that you have access to a MySQL database. You should have the database 
name, a valid user name and a password.


Step-2
Edit config.php
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

If you are installing for the first time, copy or rename the file 
config-sample.php to config.php.

Open config.php at the root of the base folder and add the database name, user 
name and password. Save the config file.


Step-3
Run and Test the application
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

At this point you should be able to see the application interface at

http://www.example.com/wmdsed30/

You can click the '+" button to add domains.

If your installation is outside a secure corporate / office network, please 
make sure that the installation is password protected. You can password protect
the application from the 'User Admin' screen or use Apache htaccess.


Step-4
Add a cron entry for processing the lookup queue
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

The application processes the lookup queue using the runq.php script. So this 
should be executed at periodic intervals. You can do this using a cron job.

Here is a sample crontab entry.

* * * * * php /home/softnik/public_html/wmdsed30/runq.php >/dev/null 2>&1

OR

* * * * * wget -q -O /dev/null "http://www.example.com/wmdsed30/runq.php?key=xxxx" >/dev/null 2>&1

Note: You can use PHP cli (as in the example directly above) or use wget / lynx etc
to run the cron script. If you are using PHP, remember to set the correct path to 
the script.

If you use wget or lynx you should also specify a CLI authentication key (CLI Key).
This is available from the 'Authentication' tab in 'Application Settings'. Replace
the xxxx in the example above with your CLI key. This is not required when you use 
PHP command line.

Please note that the above entry executes the script every minute. This is important
because the queue processor needs frequent control to prevent doing too many and / 
or too less lookups. Every time you execute the above script it will only do very 
small number of optimized lookups and exit quickly. If you set the cron to run once
an hour the application will not be able to process even 300 lookups in a day. So
make sure that the cron executes every minute.

If the installation folder is password protected using htaccess, use the following 
(required only for wget / lynx)

* * * * * wget -q -O /dev/null --user xxxxxxx --password 'xxxxxx' "http://www.example.com/wmdsed30/runq.php?key=xxxx" >/dev/null 2>&1

Make sure that you insert the url, username and password accurately.

Here is a crontab entry that uses Lynx instead of wget...

* * * * * lynx -dump http://www.example.com/wmdsed30/runq.php?key=xxxx >/dev/null 2>&1


Windows Task Scheduler
----------------------

In Windows systems you can use the Task Scheduler to run the script. Run the 
following (Start > Run) to create a task. Make sure that you edit the paths as 
required.

schtasks /create /sc minute /mo 1 /tn "SED Queue Processor" /tr "c:\wamp\bin\php\php5.5.121\php.exe c:\wamp\www\runq.php"

The above will create a task that will execute the runq.php script every minute.

Once disadvantage of the above method is that the Windows command window will
popup every time the task is run. You can prevent that using a VBS script
and a batch file.

1. Create a batch (.bat) file containing the action. Let us call this runq.bat,
it should contain something like...

c:\wamp\bin\php\php5.5.121\php.exe c:\wamp\www\runq.php

2. Create a VBS file that runs the batch file. We will call this runq.vbs, it
should contain...

Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "c:\wamp\www\runq.bat" & Chr(34), 0
Set WinScriptHost = Nothing

3. Now create the task that runs the vbs script.

First delete any task you created earlier and then create a new task.

schtasks /delete /tn "SED Queue Processor"

schtasks /create /sc minute /mo 1 /tn "SED Queue Processor" /tr "c:\wamp\www\runq.vbs"


Enabling automatic domain whois lookups
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

You can automatically do lookups on domains that haven't been checked recently.
To do this, simply add an extra parameter to the runq.php script, like so

http://www.example.com/wmdsed30/runq.php?auto=30

The above will add all domains that haven't been checked within the last 30 days
to the whois lookup queue.  

The following cron job entry

* * * * * wget -q -O /dev/null "http://www.example.com/wmdsed30/runq.php?auto=90&key=xxxx" >/dev/null 2>&1

OR

* * * * * php /home/softnik/public_html/wmdsed30/runq.php auto=90 >/dev/null 2>&1

will ensure that all your domains are refreshed every 90 days.

Remember to use this wisely. Doing too many lookups will cause your server's 
outbound IP to get banned. We recommend looking up domains every 60-90 days or 
so.

Note: Please don't make two separate cron entries for enabling automatic refresh
with runq.php. You just need to add the "?auto=xx" to your existing entry for
runq.php.


Generating Daily, Weekly or Monthly Email Summary Reports
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

First, copy sample script at lib/php/custom/expiry-report-sample.php  to another file 
in the same folder. Edit the file to include the actual "to" email address and name.

Second, use the 'Application Settings' to specify your email settings. On a normal 
web server, the 'default' send method will work. So you will only need to specify 
the "from" address and name.

---

To schedule your reports, you should add a second entry to the cron job list.

If you have your report script saved at, say, lib/php/custom/ereport.php, you
can use the following cron job entry to run it daily at mid-night.

0 0 * * * php /home/softnik/public_html/wmdsed30/lib/php/custom/ereport.php >/dev/null 2>&1

OR

0 0 * * * wget -q -O /dev/null "http://www.example.com/wmdsed30/lib/php/custom/ereport.php?key=xxxx" >/dev/null 2>&1

Please note that the first two entries in the line above is different ( 0 0 instead
of * * ). 

To make it run weekly, use

0 0 * * 0 php /home/softnik/public_html/wmdsed30/lib/php/custom/ereport.php >/dev/null 2>&1

OR

0 0 * * 0 wget -q -O /dev/null "http://www.example.com/wmdsed30/lib/php/custom/ereport.php?key=xxxx" >/dev/null 2>&1

To make it run monthly, use

0 0 1 * * php /home/softnik/public_html/wmdsed30/lib/php/custom/ereport.php >/dev/null 2>&1

OR

0 0 1 * * wget -q -O /dev/null "http://www.example.com/wmdsed30/lib/php/custom/ereport.php?key=xxxx" >/dev/null 2>&1
