Skip to content

Instantly share code, notes, and snippets.

-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Feb 16, 2023 at 10:12 AM
-- Server version: 8.0.29
-- PHP Version: 8.1.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
<?php
// Database credentials
$_servername = "localhost";
$_username = "root";
$_password = "";
$_dbname = "location_db";
// Create connection
$_conn = @new mysqli($_servername, $_username, $_password, $_dbname);
<?php
$a = 5;
$b = 2;
// status after evaluation
// initaial 5,2
$a = $a + $b; // 7,2
$b = $a - $b; // 7,5
$a = $a - $b; // 2,5
<?php
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($multi_dimensional_array));
$flat_array = iterator_to_array($it, false); // second parameter to preserve keys [default = true]
<?php
/*
##########################################################################
# PHP Benchmark Performance Script #
# © 2010 Code24 BV #
# #
# Author : Alessandro Torrisi #
# Company : Code24 BV, The Netherlands #
# Date : July 31, 2010 #
# version : 1.0 #
@viralgh
viralgh / githubPostReceive.php
Last active August 29, 2015 14:18
Git-hub Web hook - PHP
<?php
// Content Type: application/json
$time = time();
$secret = '<your-secret-here>';
$headers = getallheaders();
$hubSignature = @$headers['X-Hub-Signature'];
@viralgh
viralgh / a2test.php
Created February 19, 2015 09:21
Check if there is any issue with server session settings for early expiration
<?php
ob_start();
echo 'Session Cookie: ';
if( isset($_COOKIE[session_name()]) )
{
echo 'Present; Content: ' . $_COOKIE[session_name()] . '<br>';
if( session_id() == '')
{
echo 'Session not started; starting session<br>';
session_start();
$(function() { // shorthand for $(document).ready()
// get all checkboxes
var allCheckboxes = $(".perk:checkbox");
// group them by name for later
var groups = {};
allCheckboxes.each(function() {
groups[this.name] || (groups[this.name] = []);
groups[this.name].push(this);