Tag Archive for check

How To Check .Net Framework Version Installed

// Copy and paste that line of JavaScript code to IE Address bar and press ENTER key

javascript:alert(navigator.userAgent)

source

js jQueryLoader – check if $ is undefined, then load jquery with pure javascript if needed

/* I used to use (!$) or ($ == undefined) but that doesn't work sucka! */

if (!window.jQuery) {
	var jqscript = document.createElement('script');
	jqscript.setAttribute("type", "text/javascript");
	jqscript.setAttribute("src", "<a href="http://code.jquery.com/jquery.min.js");" >http://code.jquery.com/jquery.min.js");</a>
	document.getElementsByTagName("head")[0].appendChild(jqscript);
};

source

Cross domain file check

$imgfile="<a href="http://www.crossdomain.com/image.jpg";" >http://www.crossdomain.com/image.jpg";</a>
try
{
	$k=@file_get_contents($imgfile);

} catch (Exception $e) {
	$k=false;
}

if($k!=false)
{
	$result .= "<img src='$imgfile'>";
	
}
else
{
	$result.="no image file";
}

source

HTTP Proxy Checker

#!/bin/bash
# HTTP Proxy Server's IP Address (or URL)
proxy_server=$1

# HTTP Proxy Server's Port Number
port=$2

# We're trying to reach this url via the given HTTP Proxy Server
# (http://www.google.com by default)
url="http://www.google.com"

# Timeout time (in seconds)
timeout=20

# We're fetching the return code and assigning it to the $result variable
result=`HEAD -d -p <a href="http://$proxy_server:$port" >http://$proxy_server:$port</a> -t $timeout $url`

# If the return code is 200, we've reached to $url successfully
if [ "$result" = "200 OK" ]; then
echo "1 (proxy works)"
# Otherwise, we've got a problem (either the HTTP Proxy Server does not work
# or the request timed out)
else
echo "0 (proxy does not work or request timed out)"
fi

source

rm -i `plutil -s *.plist | grep 'plist:' | sed 's/://g'`

source

PHP isValidEmail

<?php
// FUNCTION: isValidEmail( $email )
//
// return wether an email is valid.
//
// This is a hard core check cause we check the domain and we even check
// that the email is not one of the disposable email places.
//
// undisposable.net is a great service!
// tells wether or not the email you are getting
// is a mailinator or other disposable address
//
// Sorry but when a client pays 40,000 Euros for a web campaign
// they want real email addresses.
//
function isValidEmail( $email )
{
// first thing to do is
// lets strip out the domain cause we are going to check the domain
$domainname= explode("@",$email);
$checkdomain= $domainname[1];

// check if the filter works, then check that the domain is real
if( filter_var( $email , FILTER_VALIDATE_EMAIL) &&
checkdnsrr( $checkdomain ) )
{
// ok it seems that we have real email address
// now lets see if the email is in the disposable
// email address lists.

$url  = "http://www.undisposable.net/services/php/";
$url .= "isDisposableEmail/?email=".addslashes($email);
$res = @file_get_contents($url);
$uns = @unserialize($res);
if($uns['stat']=='ok')
{
return ( $uns['email']['isdisposable'] != "yes" );
}
else
{
return false;
}
}
else
{
return false;
}
}
?>

source

ubuntu version check

lsb_release -a

source

array_keys_exist

function array_keys_exist($keyArray, $array) {
foreach($keyArray as $key) {
if(!array_key_exists($key, $array))
return false;
}

return true;
}

source

Standardize URL String

// this function processes a URL that 'should' be a full url (http://something.com/dfsdfs/)
// and makes sure it contains the correct format to be included into a href attribute
function processURLString($urlString) {
$urlString = trim($urlString);

if($urlString) {
$urlString = preg_replace('/https?:///', '', $urlString);
$urlString = trim($urlString);
$urlString  = 'http://'.$urlString;
}

return $urlString;
}

source

Check for a numeric value

function isNumber( _str,isInt)
{
var str,num;
str = String(_str);
if( isNaN( str ) )return false;
num = eval( str );
if( isInt==null )return true;
else if( isInt )if( num!=parseInt(num) )return false;
return true;
}

source