Saturday, August 28, 2010

x video download script

PHP Code:
$id = $_GET["id"];
if(isset(
$id)) $id = "?id=$id"; $cat = $_GET["cat"];
if(isset(
$cat)) $cat = "?cat=$cat"; $search = $_GET["search"];
if(isset(
$search)) $search = "?search=$search"; $page = file_get_contents("http://hot.wap4mob.com/$id$cat$search"); $look = array(); $look[0] = 'hot.wap4mob.com'; $look[1] = 'Hot.wap4mob.com'; $look[2] = 'Hot.wap4mob.Com'; $look[3] = 'Hot.Wap4Mob.Com'; $look[4] = 'wap4mob.com'; $look[5] = 'Wap4Mob.Com'; $look[6] = 'wap4mob'; $page = str_replace($look,$_SERVER['SERVER_NAME'],$page);
$look[0] = '/<\/script>/is'; $look[1] = '/<\/a>/'; $look[2] = '/<\/a>/'; $look[3] = '/<\/a>/'; $look[4] = '/<\/a>/'; $look[5] = '/<\/a>/'; $look[6] = '/<\/a>/'; $page = preg_replace($look,'',$page);

echo 
$page; ?>

Saturday, August 7, 2010

mcrypt based encrytpion/decrypt if it is instal on ur sver

mcrypt based encrytpion/decrypt if it is instal on ur sver

PHP Code:
######################################################### function encrypt($input)
{
    
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
    
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
    
$textkey = 'ZTlhZGY';
    return 
base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, hash('sha256',$textkey,TRUE), $input, MCRYPT_MODE_ECB, $iv));
} 
######################################################### function decrypt($input)
{
    
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
    
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
    
$textkey = 'ZTlhZGY';
    return 
trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, hash('sha256',$textkey,TRUE), base64_decode($input), MCRYPT_MODE_ECB, $iv));
} 
#########################################################  

include very easy

Special to reuse code in different folders
Code function:

PHP Code:
function inc ($inc) { $result = count(explode ("/",$_SERVER['PHP_SELF']))-2;
switch(
$result){
case 
'0':$inc='';break;
case 
'1':$inc='../';break;
case 
'2':$inc='../../';break;
case 
'3':$inc='../../../';break;
case 
'4':$inc='../../../../';break;
case 
'5':$inc='../../../../../';break;
                   }
return 
"$inc";
}  
Example:
PHP Code:
$inc = inc(inc);
include_once(
$inc."/config.php");  

Quick fix for validating images

Quick fix for validating images on ready.mobi

"Specify the width and height of images in pixels as attributes of the IMG element. This allows devices to leave space for the images when they arrive, which means that pages don't have to be re-drawn several times"


PHP Code:
function img($file){
list(
$width, $height) = getimagesize($file); $count = strrpos ($file, 'http://');
if(
$count){ $n=1; $alt  = str_replace('http://','', $file); $alt = explode('/',$alt); $alt  = $alt[0]; $alt = explode('.',$alt); $alt  = $alt[0];
}
else{ 
$n=2; $alt = explode('/',$file); $alt  = $alt[count($alt)-1]; $alt = explode('.',$alt); $alt  = $alt[0];
}
echo 
".$file."' width='".$width."' height='".$height."' alt ='".$alt."'/>";
} 
?>
Example:
PHP Code:
img('tools/logo.gif');//my pictures img('http://waperos.net/tools/logo.gif');//external url ?>
Results:

HTML Code:
logo
logo 

easy redirect

PHP Code:
/*
Using

if(getbrowsername($_SERVER["HTTP_USER_AGENT"])=="WML"){
// redirect WML
}else{
// redirect HTML
}

*/
function getbrowsername($brow){ $browser=substr(trim($brow),0,4);
if( 
$browser=="noki" ||   // Nokia phones and emulators $browser=="eric" ||   // Ericsson WAP phones and emulators $browser=="sams" ||     // Samsung $browser=="sage" ||     // Sagem $browser=="mot-" ||     // Motorola $browser=="sony" ||     // SonyEricsson $browser=="winw" ||   // WinWAP browser $browser=="leno" ||   // Lenovo browser $browser=="lg-b" ||   // LG browser $browser=="mozi" ||   // Mozilla browser $browser=="oper") $br = "WML";
return 
$br;
}