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 | |
$query = $db->prepare('SELECT * FROM `users` WHERE `ID` = :ID: AND `email` = :email: ORDER BY ID DESC LIMIT 0,1;'); | |
$query->execute(array(':ID:' => '3', ':email:' => '[email protected]')); | |
$result = $query->fetchAll(PDO::FETCH_ASSOC); | |
?> |
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
<p id="myElem1" class="classExample">My First paragraph</p> | |
<p id="myElem2" class="classExample">My Second paragraph</p> | |
<script> | |
if(!document.querySelectorAll){ // If the user does not have querySelectorAll() | |
var classExample = document.getElementsByClassName('classExample'); // Get all the elements with class "classExample" | |
}else{ // Otherwise do it the HTML5 way | |
var classExample = document.querySelectorAll('.classExample'); | |
} | |
for(i=0; i<classExample.length; i++) {// Cycle through them |
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 | |
// Check if input is alphanumeric (letters and numbers) | |
ctype_alnum('abcdef1234'); // This returns TRUE | |
ctype_alnum('£%^&ab2'); // This on the otherhand returns FALSE | |
// check if input is alpha (letters) | |
ctype_alpha('dssfsdf'); // returns TRUE | |
ctype_alpha('12345dssfsdf'); // Returns FALSE | |
?> |
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 | |
function validEmail($email){ | |
// Check the formatting is correct | |
if(filter_var($email, FILTER_VALIDATE_EMAIL) === false){ | |
return FALSE; | |
} | |
// Next check the domain is real. | |
$domain = explode("@", $email, 2); | |
return checkdnsrr($domain[1]); // returns TRUE/FALSE; |
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 | |
class Weather { | |
public $lat, $long, $weather, $location; | |
private $weather_data, $location_data; | |
| |
public function __construct($lat=0.0, $long=0.0){ | |
$this->lat = (float) $lat; | |
$this->long = (float) $long; | |
} | |
|
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
package hellowrold; | |
/** | |
* | |
* @author Mike | |
*/ | |
public class Main { | |
/** | |
* @param args the command line arguments |
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 | |
$t->mentions(); | |
?> |
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 | |
// Coded by Mike Rogers (http://www.fullondesign.co.uk/) 1st October 2010. | |
function shorten($url, $qr=NULL){ | |
if(function_exists('curl_init')){ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_URL, 'http://goo.gl/api/shorten'); | |
curl_setopt($ch, CURLOPT_POST, TRUE); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, 'security_token=null&url='.urlencode($url)); |
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
<meta name="msapplication-task" content="name=Projects;action-uri=http://www.fullondesign.co.uk/projects/;icon-uri=http://www.fullondesign.co.uk/favicon.ico"/> |
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
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <!– Pull the jQuery base from Google, it has CDN so it should be a little faster. –> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$("form input, form input, form textarea").css('color', '#484848'); | |
$("form .submit").css('color', '#000'); | |
$("form label").hover(function () { | |
$("#infobox").html($(this).attr('title')); | |
}); | |
$("form input, form input, form textarea").focus(function () { | |
if($(this).val() == $(this).attr('title')){ |