Skip to content

Instantly share code, notes, and snippets.

View DigitalDesignerOnline's full-sized avatar

DigitalDesigner DigitalDesignerOnline

View GitHub Profile
@DigitalDesignerOnline
DigitalDesignerOnline / ContactForm.md
Created October 28, 2020 19:27 — forked from patotoma/ContactForm.md
secure php contact form

Secured PHP Contact Form

<?php
  if(isset($_POST['submit'])){
    $name = htmlspecialchars(stripslashes(trim($_POST['name'])));
    $subject = htmlspecialchars(stripslashes(trim($_POST['subject'])));
    $email = htmlspecialchars(stripslashes(trim($_POST['email'])));
    $message = htmlspecialchars(stripslashes(trim($_POST['message'])));
    if(!preg_match("/^[A-Za-z .'-]+$/", $name)){
@DigitalDesignerOnline
DigitalDesignerOnline / export_csv.php
Created November 13, 2017 04:33 — forked from janschoepke/export_csv.php
MySQL CSV Export via PHP (PHP7 ready)
<?php
/* vars for export */
// database record to be exported
$db_record = 'XXX_TABLE_NAME_XXX';
// optional where query
$where = 'WHERE 1 ORDER BY 1';
// filename for export
$csv_filename = 'db_export_'.$db_record.'_'.date('Y-m-d').'.csv';
// database variables
@DigitalDesignerOnline
DigitalDesignerOnline / dl-file.php
Created October 25, 2017 18:58 — forked from hakre/dl-file.php
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
<?php
/*
Plugin Name: Custom Registration
Description: Updates user rating based on number of posts.
Version: 1.1
Author: Tristan Slater w/ Agbonghama Collins
Author URI: http://kanso.ca
*/