Skip to content

Instantly share code, notes, and snippets.

View TheDefinitionist's full-sized avatar

Thielicious TheDefinitionist

View GitHub Profile
@TheDefinitionist
TheDefinitionist / htaccessCRUD.class.php
Created October 21, 2017 20:35 — forked from lcherone/htaccessCRUD.class.php
PHP .htaccess CRUD class
<?php
/**
* .htaccess writer CRUD class
*
* @author Lawrence Cherone
* @version 1.00
*/
class htaccessCRUD
{
public $file;
@TheDefinitionist
TheDefinitionist / htaccess
Created October 21, 2017 12:27 — forked from philsinatra/htaccess
Starter htaccess file
# htaccess starter template
# v20121004 htaccessbook.com/changelog
# Enable mod_rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
# Enable symbolic links
Options +FollowSymLinks
@TheDefinitionist
TheDefinitionist / check_user.php
Last active December 2, 2016 14:08
Checks if user already exists. If not, it inserts the user only one time.
<?php
try {
$con = new PDO("mysql:host=localhost;","root","");
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$username = "John Doe";
$password = "abc123";
// CREATE
@TheDefinitionist
TheDefinitionist / import_export_to_csv.sql
Last active December 6, 2016 19:31
Imports CSV data into MySQL and exports it again
-- import
CREATE DATABASE IF NOT EXISTS import_csv;
USE import_csv;
CREATE TABLE IF NOT EXISTS persons (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`firstname` TEXT NOT NULL,
`lastname` TEXT NOT NULL,
`age` INT NOT NULL
);
LOAD DATA INFILE 'data.csv'