PHP Classes

File: libs/ip_protect.php

Recommend this page to a friend!
  Classes of Olaf Lederer   Backup4WP   libs/ip_protect.php   Download  
File: libs/ip_protect.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Backup4WP
Backup and restore your WordPress website
Author: By
Last change:
Date: 10 months ago
Size: 485 bytes
 

Contents

Class file image Download
<?php
include_once 'func.php';

if ( isset(
$_SERVER['HTTP_X_REQUESTED_WITH'] ) && ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) ) {


   
$str = 'order deny,allow
    deny from all

    # whitelist your own IP address
    allow from '
.$_SERVER['REMOTE_ADDR'];

   
$savePath = MYBACKUPDIR.'.htaccess';

    if (
file_exists($savePath)) die('exists');

   
$handle = fopen($savePath, 'w+');
    if (
fwrite($handle, $str) === FALSE) {
        echo
'error';
    } else {
        echo
'okay';
    }
   
fclose($handle);
}