PHP Classes

File: ajax/save.php

Recommend this page to a friend!
  Classes of Ákos Nikházy   PHP Have I Been Pwned API Search   ajax/save.php   Download  
File: ajax/save.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Have I Been Pwned API Search
Check if email addresses are in the HIBP database
Author: By
Last change: Update of ajax/save.php
Date: 1 year ago
Size: 629 bytes
 

Contents

Class file image Download
<?php
/*
    save.php - saves a log file
   
    This software created by Ákos Nikházy

*/
session_start();

require_once(
'../req/settings.php');

header('Content-Type: application/json');

if(empty(
$_SERVER['HTTP_X_REQUESTED_WITH']))
    exit(
json_encode(array('status' => 'error')));

if(
$passwordProtection && !isset($_SESSION['login']))
{

    exit(
json_encode(array('status' => 'error')));
   
}

if(isset(
$_POST['data']))
{

   
file_put_contents ('../reports/'.date('Y-m-d_G-i-s').'.json',$_POST['data']);
    exit(
json_encode(array('status' => 'done')));
   
}

exit(
json_encode(array('status' => 'error')));
?>