This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".checkbox").change(function() { | |
if(this.checked) { | |
//Do stuff | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This function loops through the $_POST global and returns parameters that can be used in | |
* a PDO statement directly. Note : For this function to work properly the | |
* PDO::ATTR_EMULATE_PREPARES should be set to "false" | |
* like so "$conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false)". | |
* @param Array $exclude This is an array of keys in $_POST that you want the function to ignore | |
* @return Array The function returns an array that can be used as parameters for the PDO statement | |
*/ | |
function get_params($exclude = array()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$company = $conn->prepare('SELECT `id`, `name`, `name_lang2`, `is_active`, `sort_order` FROM `companies`' ); | |
$company -> execute(); | |
$count = $company->rowCount(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PDO Prepared statements | |
try { | |
$conn = new PDO('mysql:host=localhost;dbname=myDatabase', $username, $password); | |
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$stmt = $conn->prepare('SELECT * FROM myTable WHERE id = :id'); | |
$stmt->execute(array('id' => $id)); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Connect to database using PDO | |
try { | |
$conn = new PDO('mysql:host=localhost;dbname=myDatabase', $username, $password); | |
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
} catch(PDOException $e) { | |
echo 'ERROR: ' . $e->getMessage(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PHP SECURE FILE DOWNLOAD | |
// Put the Files in a directory that is not publically accessible.. maybe outside document root or set correct permissions | |
if (!$_SESSION["authenticated"]) { | |
// If not authenticated then send back to the login page | |
$host = $_SERVER["HTTP_HOST"]; | |
$path = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\"); | |
header("Location: http://$host$path/login.php?err=true"); | |
exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/bainternet/My-Meta-Box |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'type' => 'post', | |
'child_of' => 0, | |
'parent' => '', | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'hide_empty' => 1, | |
'hierarchical' => 1, | |
'exclude' => '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Multiple videos in Lightbox / Overlay | |
Dependencies: | |
http://releases.flowplayer.org/js/flowplayer-3.2.12.min.js | |
http://cdn.jquerytools.org/1.2.6/all/jquery.tools.min.js | |
The CSS | |
<style> | |
.overlay { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic HTML Form | |
<form id="contact-form" class="span7 cf" action="" method="post"> | |
<div id="status"> | |
</div> | |
<legend>Leave us a message</legend> | |
<span class="col3 first"> | |
<input type="text" id="name" name="name" placeholder="Name"> | |
</span> |