Fetch .json file #Javascript
function fetchJSONFile(path, callback) {
    var httpRequest = new XMLHttpRequest();
    httpRequest.onreadystatechange = function() {
        if (httpRequest.readyState === 4) {
            if (httpRequest.status === 200) {
                var data = JSON.parse(httpRequest.responseText);
                if (callback) callback(data);
            }
        }
    };
    httpRequest.open('GET', path);
    httpRequest.send(); 
}

fetchJSONFile('file.json', function(data){
	// Do something with Data
    console.log(data);
});
Mod_Security Error Response body too large #Server
# Mod_Security Error Response body too large
# Domains > domain.com > Apache & nginx Settings > Additional directives for HTTPS
<IfModule mod_security2.c>
    SecResponseBodyLimit 546870912
</IfModule>
,,,,
Pdo Query for noobs #PHP
<?php
// Set
global $pdo;
if (isset($pdo)) {return;} 
mysqli_report(MYSQLI_REPORT_STRICT);
$pdo = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME);
// Set the PDO::ATTR_EMULATE_PREPARES Attribute to false
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
if (mysqli_connect_errno()) {		
  die(sprintf("Connect failed: %s\n", mysqli_connect_error()));
}
// Prepared Statements
$firstname = "bruce";
$sql = "SELECT * FROM users WHERE firstname =:fname ;";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(":fname", $firstname);
$stmt->execute();
if(!$result = $stmt->fetch(PDO::FETCH_OBJ)){
    echo "Credentials do no match";
} else {
    echo"Id: ".$result->id. " Name: ".$result->firstname." ".$result->lastname;
}
// Prepared Statements With Parameterized Query
$firstname = "jeff";
$sql = "SELECT * FROM users WHERE firstname = ?";
$stmt = $pdo->prepare($sql);
$stmt->bind_param("s", $firstname);
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows === 0) exit('No rows');
while($row = $result->fetch_assoc()) {
    echo"Id: ".$row['id']. " Name: ".$row['firstname']." ".$row['lastname'];
}
  Cssgradient.io
  metatags.io
get http headers values #PHP
<?php 			
// GET HTTP HEADERS VALUES
// SINGLE VALUE - Replace XXXXXX_XXXX with the name of the header you need in UPPERCASE (and with '-' replaced by '_')
$headerStringValue = $_SERVER['HTTP_XXXXXX_XXXX'];
echo $headerStringValue;
// GET ALL HEADERS			
$headers = apache_request_headers();
foreach ($headers as $header => $value) {
    echo "$header: $value <br />\n";
} ?>
  jquery-confirm.js
Trim Input Whitespace #Javascript
/* trim-whitespace-input.js*/
$('.no-spaces-field').keyup(function() {
  $(this).val($(this).val().replace(/ +?/g, ''));
});
,,,,
  Photomosh.com
Force Https the easy way #Html
<!-- Force https -->
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
   https://gaudaire-thor.com/

A WordPress theme made for the Artist Jean-Gaudaire Thor, fully responsive and mobile friendly, design provided by my teammate Check Ca!. You can view it live here.

No more items to load