Monday, October 4, 2010
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] = '/; $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:
Example:
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";
}
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"
Example:
Results:
"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."'/>";
} ?>
PHP Code:
img('tools/logo.gif');//my pictures img('http://waperos.net/tools/logo.gif');//external url ?>
HTML Code:
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;
}
Easy birthdate dropdown
PHP Code:
/*
using
echo Birthday("22", "09", "1989");
*/
function Birthday($day="01", $month="01", $year="1980"){$rform = ";$dayval = range('1','31');
foreach ($dayval as $key){
if($key<10){$keyadd = "0$key";
}else{$keyadd = "$key";
}
if($day==$keyadd){$rform .= ";
}else{$rform .= ";
}
}$rform .= " ";$rform .= ";$monthval = array('1'=>'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
foreach ($monthval as $val => $months){
if($val<10){$keyadd = "0$val";
}else{$keyadd = "$val";
}
if($month==$keyadd){$rform .= ";
}else{$rform .= ";
}
}$rform .= " ";$rform .= ";$yearval = range('1950','2009');//you can define range year here from year -> to year
foreach ($yearval as $key){
if($year==$key){$rform .= ";
}else{$rform .= ";
}
}$rform .= "";
return $rform;
}
Easy Paginantion For Lavalair or Maybe For All script ...
PHP Code:
/*
LEGEND
======
$ipp = items_per_pages
$p = $_GET["page"]
$ni = num_items
$np = num_pages
$npc = num_pagesc
$url = like "index.php?action=main&ses=$ses
Using:
echo Paging("$url", $p, $np, $npc, $ipp, $ls, $ni);
*/
if($p=="" || $p<=0)$p=1; $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM tablename")); $ni = $noi[0]; //changable $ipp= 5; $np = ceil($ni/$ipp); $npc = ceil($ni/$ipp);
if(($p>$np)&&$p!=1)$p= $np; $ls = ($p-1)*$ipp;
$sql = "SELECT * FROM tablename ORDER BY orderid DESC LIMIT $ls, $ipp"; $items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0){
while ($item = mysql_fetch_array($items)){
}
}else{
echo "dataEmpty";
}
echo "";
echo Paging("?action=$action&session=$session", $p, $np, $npc, $ipp, $ls, $ni);
// Recall Jump Page if($np>2){ $rets = "; $rets .= ""; $rets .= ""; $rets .= "Jump
"; $rets .= "";
echo $rets;
}
echo "";
PHP Code:
function Paging($pagename, $p, $np, $npc, $ipp, $ls, $ni){ $nav=' ';
if($p<=3){ $px=1; $np=$p+3;
}
if($p>3){ $px=$p-3; $np=$p+3;
}
if($p>=($npc-3)){ $np=$npc;
}
for($jp=$px; $jp<=$np; $jp++){
if($jp==$p){ $nav .= "[$jp] ";
}else{ $nav .= " [$jp] ";
}
}
if($p>1){ $pp = $p-1; $left = "«Prev ";
}
if($p<$np){ $npg = $p+1; $right = "Next»";
}
if($p>4) { $jp=$p-1; $first="«First";
}else{ $first='';
}
if($p<($npc-3)){ $jp=$p+1; $last="Last»";
}else{ $last='';
}
if($ni>$ipp) { $paging = "Page $p of $npc
"; $paging .= "$left $right
$first $nav $last ";
}
if($ipp>$ni){ $paging .= "Page $np of $np";
}else if($ni==0){ $paging .= "Page 0 of 0";
}
return $paging;
}
here is CSS
HTML Code:.paging{
text-align:center;
}
.disable{
background-color: black;
color:#000;
}
here is random in one day.
/*
using
echo $display;
*/
$date = date("d");$myFile = "record.dat";$fh = fopen($myFile, 'r');$theData = fread($fh, 5);fclose($fh);
if($theData==$date){$myFile = "imgrecord.dat";$fh = fopen($myFile, 'r');$theData = fgets($fh);fclose($fh);//display image$display = '.$theData.'" alt="*" border=0 width="281"/>';
}else{$imglist='';//$img_folder is the variable that holds the path to the banner images. Mine is images/tutorials/
// see that you don't forget about the "/" at the end$img_folder = "imgrandom/";mt_srand((double)microtime()*1000);//use the directory class$imgs = dir($img_folder);//read all files from the directory, checks if are images and ads them to a list (see below how to display flash banners)while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))$imglist .= "$file ";
} closedir($imgs->handle);//put all images into an array$imglist = explode(" ", $imglist);$no = sizeof($imglist)-2;//generate a random number between 0 and the number of images$random = mt_rand(0, $no);$image = $imglist[$random];$myFile = "record.dat";$fh = fopen($myFile, 'w') or die("can't open file");$stringData = $date;fwrite($fh, $stringData);fclose($fh);$myFile = "imgrecord.dat";$fh = fopen($myFile, 'w') or die("can't open file");$stringData = $img_folder.$image;fwrite($fh, $stringData);fclose($fh);
}
dont forget to create this file
record.dat [CHMOD 777]
imgrecord.dat [CHMOD 777]
imgrandom [FOLDER]
using
echo $display;
*/
$date = date("d");$myFile = "record.dat";$fh = fopen($myFile, 'r');$theData = fread($fh, 5);fclose($fh);
if($theData==$date){$myFile = "imgrecord.dat";$fh = fopen($myFile, 'r');$theData = fgets($fh);fclose($fh);//display image$display = '.$theData.'" alt="*" border=0 width="281"/>';
}else{$imglist='';//$img_folder is the variable that holds the path to the banner images. Mine is images/tutorials/
// see that you don't forget about the "/" at the end$img_folder = "imgrandom/";mt_srand((double)microtime()*1000);//use the directory class$imgs = dir($img_folder);//read all files from the directory, checks if are images and ads them to a list (see below how to display flash banners)while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))$imglist .= "$file ";
} closedir($imgs->handle);//put all images into an array$imglist = explode(" ", $imglist);$no = sizeof($imglist)-2;//generate a random number between 0 and the number of images$random = mt_rand(0, $no);$image = $imglist[$random];$myFile = "record.dat";$fh = fopen($myFile, 'w') or die("can't open file");$stringData = $date;fwrite($fh, $stringData);fclose($fh);$myFile = "imgrecord.dat";$fh = fopen($myFile, 'w') or die("can't open file");$stringData = $img_folder.$image;fwrite($fh, $stringData);fclose($fh);
}
dont forget to create this file
record.dat [CHMOD 777]
imgrecord.dat [CHMOD 777]
imgrandom [FOLDER]
Subscribe to:
Posts (Atom)