Need 3 changes in a MySql Script

Job ID: 31525322

Budget: $8 – $15 USD

Need 3 changes in a SQL Script

Users will add the IP address to a database using this link
The database is a *.db file

http://<ipaddr>/autoadd?username=username>&password=password

1. After the IP is written in the database at the same time the IP is written into the /etc/iptables/rules.v4' file

The current problem is, you can add the same IP multiple times into the database and the same IP is written multiple times in the /etc/iptables/rules.v4' file

We need to solve:

- Check if the IP already exists in the database,
if the IP addres is the same "do nothing"

- If there is a new IP:
delete the old IP from the database and add the new IP into the database
- as well we need to delete the old IP in the /etc/iptables/rules.v4 and add the new IP into /etc/iptables/rules.v4

2. If the account from an user is expired in the database we need to delete his IP from the database and delete it from the file and from /etc/iptables/rules.v4

I prefer a freelancers from Ukraine and Russia

Thanks
Related categories: PHP SQL MySQL Database Administration