Skip to content

Instantly share code, notes, and snippets.

@mcorkum
mcorkum / cu-gallery.php
Last active February 18, 2016 15:01
Plugin Script Enqueue
$query = "INSERT INTO tableName VALUES (DEFAULT,'$fullname', '$email', '$comment')";
or:
$query = "INSERT INTO tableName (fullname, email, comment) VALUES ('$fullname', '$email', '$comment')";
$sql = "INSERT INTO feedback (name, email, comment) VALUES ('$fn', '$em', '$comm')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$query = "INSERT INTO feedback (name, email, comment) VALUES ('$fn', '$em', '$comm')";
if (mysqli_query($conn, $query)) {
echo "New record created successfully";
} else {
echo "Error: " . $query . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
function handleComments() {
global $conn;
$success = false;
$err = "";
if(isset($_POST["send"])) {
//echo "you have pressed submit </br>";
if (!empty($_POST["fullname"])) {
$fn = sanitize_input($_POST["fullname"]);
//echo "You have entered your name. </br>";
include("db-connect.php");
include("handle-form.php");
$errors = handleComments();
$(document).ready(function(){
function getRandomPosition(element) {
var x = 400;
var y = 400;
var randomX = Math.floor(Math.random()*x+50);
var randomY = Math.floor(Math.random()*y-200);
return [randomX,randomY];
}
window.onload = function() {
@mcorkum
mcorkum / emit-musk.php
Last active August 10, 2016 13:34
MUSK
<?php
/*
Plugin Name: Emit Musk
Plugin URI: https://mantelope.io
Description: Adds musk to your content.
Version: 9,000,000,000.7684728 ½
Author: Industry
Author URI: https://mantelope.io
License: Yes.
*/
$secret_iv = '3434977318554001';
$iv = substr( hash( 'sha256', $secret_iv ), 0, 16 );
$file_contents = get_file_contents( 'file_to_decrypt.aes' );
$output = openssl_decrypt( base64_decode( $file_contents ), 'AES128', $key, 0, $iv);
file_put_contents( 'file_to_decrypt.pdf' );
@mcorkum
mcorkum / give-export.php
Created November 14, 2018 18:18
Add custom meta to export
<?php
/**
* Add custom metadata to the columns for export
*
* @param array $data Current data in the export
* @param array $payment Array containing payment metadata
*
* @return array $data - Modified data
*/
function add_data_to_export( $data, $payment ) {