http://graph.facebook.com?id=POST_URL
<?php | |
function wp_signon( $credentials = '', $secure_cookie = '' ) { | |
if ( empty($credentials) ) { | |
if ( ! empty($_POST['log']) ) | |
$credentials['user_login'] = $_POST['log']; | |
if ( ! empty($_POST['pwd']) ) | |
$credentials['user_password'] = $_POST['pwd']; | |
if ( ! empty($_POST['rememberme']) ) | |
$credentials['remember'] = $_POST['rememberme']; | |
} |
<?php | |
// Max Integer | |
define('MAX', 1000000); | |
// Create An Array Till MAX | |
$original = range(1, MAX); | |
// Shuffle The Array While Preserving Keys | |
$shuffle = $original; | |
shuffle_assoc($shuffle); |
Utility.send_exception_to_ga = function() | |
{ | |
if(true || window.settings && window.settings.debug) | |
{ | |
return; | |
} | |
var gOldOnError = window.onerror; | |
window.onerror = function(message, url, line) { | |
var e_obj = [ | |
"_trackEvent" |
<?php | |
function is_pair($open, $close) | |
{ | |
if($open == '(' && $close == ')') return true; | |
elseif($open == '{' && $close == '}') return true; | |
elseif($open == '[' && $close == ']') return true; | |
return false; | |
} | |
function balance($test) | |
{ |
<?php | |
/* | |
Sample expected output: | |
getPrimes(5); ⇒ array(2, 3) | |
getPrimes(10); ⇒ array(2, 3, 5, 7) | |
*/ | |
function getPrimes($n) | |
{ | |
if ($n <= 0) throw new InvalidArgumentException("positive integer required"); |
<?php | |
function factorial_iterative($n) | |
{ | |
$k = 1; | |
for($i = $n; $i > 1; $i--) | |
{ | |
$k *= $i; | |
} | |
return $k; |
<?php | |
$countries = array( 'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antarctica', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegowina', 'Botswana', 'Bouvet Island', 'Brazil', 'British Indian Ocean Territory', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', 'China', 'Christmas Island', 'Cocos (Keeling) Islands', 'Colombia', 'Comoros', 'Congo', 'Congo, the Democratic Republic of the', 'Cook Islands', 'Costa Rica', 'Cote d\'Ivoire', 'Croatia (Hrvatska)', 'Cuba', 'Cyprus', 'Czech Republic', 'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'East Timor', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Falkland Islan |
<?php | |
function get_ip() { | |
foreach ( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) { | |
if ( array_key_exists( $key, $_SERVER ) === true ) { | |
foreach ( explode( ',', $_SERVER[$key] ) as $ip ) { | |
$ip = trim( $ip ); | |
if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) { | |
return $ip; | |
} | |
} |