Mahmoudi_Mihans
New Member
سلام
من یه فایل دارم که زمانی که دیکد کردم اپلود میکنم تو سایت سایت بالا دیگه نمیاد و صفحه سفید هست
دیوونه شدم ولی وارد نیست ببینم مشکل کد چیه میزارم چک کنید اساتید محترم
من یه فایل دارم که زمانی که دیکد کردم اپلود میکنم تو سایت سایت بالا دیگه نمیاد و صفحه سفید هست
دیوونه شدم ولی وارد نیست ببینم مشکل کد چیه میزارم چک کنید اساتید محترم
PHP:
<?php
function fd2ed( $str )
{
$tmp = split( "/", $str );
$dd = ( integer );
$mm = ( integer );
$yy = ( integer );
$sh = converts2xdate( $dd, $mm, $yy );
$sd = $sh[2];
$sm = $sh[1];
$sy = $sh[0];
$date = mktime( "0", "0", "0", $sm, $sd, $sy );
if ( file_exists( "zone.txt" ) )
{
$zone_time = implode( "", file( "zone.txt" ) );
}
if ( !$zone_time )
{
$zone_time = 0;
}
$date = $date - $zone_time * 3600;
return $date;
}
function fd2a( $str )
{
$tmp = split( "/", $str );
$dd = ( integer );
$mm = ( integer );
$yy = ( integer );
$tmp = split( "-", $str );
$tmp1 = split( ":", $tmp[1] );
$hour = $tmp1[0];
$minute = $tmp1[1];
$a = array( );
$a['d'] = $dd;
$a['m'] = $mm;
$a['y'] = $yy;
$a['hour'] = $hour;
$a['minute'] = $minute;
return $a;
}
function fd2t( $str )
{
$tmp = split( "-", $str );
$dte = fd2ed( $tmp[0] );
$tmp1 = split( ":", $tmp[1] );
$hour = $tmp1[0];
$minute = $tmp1[1];
$dte += $hour * 3600 + $minute * 60;
return $dte;
}
function farsinum( $data, $la = "fa" )
{
if ( $la != "fa" )
{
return $data;
}
$newstr = "";
$i = 0;
for ( ; $i <= strlen( $data ); ++$i )
{
$str = $data[$i];
$nstr = $str;
if ( $str == "0" )
{
$nstr = str_replace( "0", "&1776;", $str );
}
if ( $str == "1" )
{
$nstr = str_replace( "1", "&1777;", $str );
}
if ( $str == "2" )
{
$nstr = str_replace( "2", "&1778;", $str );
}
if ( $str == "3" )
{
$nstr = str_replace( "3", "&1779;", $str );
}
if ( $str == "4" )
{
$nstr = str_replace( "4", "&1780;", $str );
}
if ( $str == "5" )
{
$nstr = str_replace( "5", "&1781;", $str );
}
if ( $str == "6" )
{
$nstr = str_replace( "6", "&1782;", $str );
}
if ( $str == "7" )
{
$nstr = str_replace( "7", "&1783;", $str );
}
if ( $str == "8" )
{
$nstr = str_replace( "8", "&1784;", $str );
}
if ( $str == "9" )
{
$nstr = str_replace( "9", "&1785;", $str );
}
$newstr .= $nstr;
}
return $newstr;
}
function rial2dollar( $num, $def, $up )
{
if ( !$def )
{
$def = 10000;
}
$vahed = $def;
if ( ( integer ) == 0 )
{
$str = @file_get_contents( "http://download.finance.yahoo.com/d/quotes.csv?s=USDIRR=X&f=sl1d1t1c1ohgv&e=.csv" );
if ( !$str )
{
$vahed = $def;
}
else
{
$vahed = getbet( "\",", ",\"", $str );
$vahed = $vahed * 1;
}
}
$ret = dollar_currency( $num / $vahed * 1 );
return $ret;
}
function txt2link( $text )
{
$text = ereg_replace( "[^<>[:space:]]+[[:alnum:]/]", "<a href=%22http:/0/%22>\\0</a>", $text );
return $text;
}
function dollar_currency( $num )
{
$num = number_format( $num, 0, ".", "," );
$num = str_replace( ".", "/", $num );
return $num;
}
function currency( $num )
{
$num = number_format( $num, 0, ".", "," );
return $num;
}
function table_top( $blocktitle, $w )
{
global $WebTemplate;
global $toph;
global $both;
global $root;
global $direction;
global $ab1;
global $ab2;
global $ab3;
global $ab4;
global $ab5;
global $ab6;
global $ab7;
global $ab8;
global $ab9;
global $ac1;
global $ac2;
global $ac3;
global $ac4;
global $ac5;
global $ac6;
global $ac7;
global $ac8;
global $ac9;
global $ac10;
return "<div style='width:{$w}'>".build_table( "top", $blocktitle, $toph, $both, $root, $direction, "templates/{$WebTemplate}", array( $ab1, $ab2, $ab3, $ab4, $ab5, $ab6, $ab7, $ab8, $ab9 ), array( $ac1, $ac2, $ac3, $ac4, $ac5, $ac6, $ac7, $ac8, $ac9, $ac10 ) );
}
function table_bot( )
{
global $WebTemplate;
global $toph;
global $both;
global $root;
global $direction;
global $ab1;
global $ab2;
global $ab3;
global $ab4;
global $ab5;
global $ab6;
global $ab7;
global $ab8;
global $ab9;
global $ac1;
global $ac2;
global $ac3;
global $ac4;
global $ac5;
global $ac6;
global $ac7;
global $ac8;
global $ac9;
global $ac10;
return "<div style='width:{$w}'>".build_table( "bot", $title, $toph, $both, $root, $direction, "templates/{$WebTemplate}", array( $ab1, $ab2, $ab3, $ab4, $ab5, $ab6, $ab7, $ab8, $ab9 ), array( $ac1, $ac2, $ac3, $ac4, $ac5, $ac6, $ac7, $ac8, $ac9, $ac10 ) )."</div>";
}
function build_table( $type = "full", $title, $toph = 25, $both = 0, $root = "", $direction, $dir = "", $images = "", $colors = "" )
{
if ( file_exists( "{$dir}/{$images['0']}" ) && $images[0] )
{
$img1 = "<img border='0' src='{$root}/{$dir}/{$images['0']}'>";
}
else
{
$img1 = "";
}
if ( file_exists( "{$dir}/{$images['1']}" ) && $images[1] )
{
$img2 = "background='{$root}/{$dir}/{$images['1']}'";
}
else
{
$img2 = "";
}
if ( file_exists( "{$dir}/{$images['2']}" ) && $images[2] )
{
$img3 = "<img border='0' src='{$root}/{$dir}/{$images['2']}'>";
}
else
{
$img3 = "";
}
if ( file_exists( "{$dir}/{$images['3']}" ) && $images[3] )
{
$img4 = "background='{$root}/{$dir}/{$images['3']}'";
}
else
{
$img4 = "";
}
if ( file_exists( "{$dir}/{$images['4']}" ) && $images[4] )
{
$img5 = "background='{$root}/{$dir}/{$images['4']}'";
}
else
{
$img5 = "";
}
if ( file_exists( "{$dir}/{$images['5']}" ) && $images[5] )
{
$img6 = "background='{$root}/{$dir}/{$images['5']}'";
}
else
{
$img6 = "";
}
if ( file_exists( "{$dir}/{$images['6']}" ) && $images[6] )
{
$img7 = "<img border='0' src='{$root}/{$dir}/{$images['6']}'>";
}
else
{
$img7 = "";
}
if ( file_exists( "{$dir}/{$images['7']}" ) && $images[7] )
{
$img8 = "background='{$root}/{$dir}/{$images['7']}'";
}
else
{
$img8 = "";
}
if ( file_exists( "{$dir}/{$images['8']}" ) && $images[8] )
{
$img9 = "<img border='0' src='{$root}/{$dir}/{$images['8']}'>";
}
else
{
$img9 = "";
}
$top = "<table dir=ltr border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='111111' heigth='100%' width='100%'><tr><td bgcolor='{$colors['0']}' height='{$toph}'>{$img1}</td><td bgcolor='{$colors['1']}' {$img2} width='98%' height='{$toph}' style='color:{$colors['9']}' dir='{$direction}'> {$title}</td><td bgcolor='{$colors['2']}' dir='rtl' height='{$toph}'>{$img3}</td></tr><tr><td bgcolor='{$colors['3']}' {$img4}></td><td height='100%' bgcolor='{$colors['4']}' {$img5} width='98%' valign='top' dir='{$direction}'>";
$bot = "</td><td height='100%' bgcolor='{$colors['5']}' {$img6}></td></tr><tr><td height='100%' bgcolor='{$colors['6']}' valign='top' height='9'>{$img7}</td><td bgcolor='{$colors['7']}' {$img8} width='98%' height='{$both}'></td><td bgcolor='{$colors['8']}' height='9' valign='top'>{$img9}</td></tr></table>";
if ( $type == "full" )
{
return $top.$bot;
}
if ( $type == "top" )
{
return $top;
}
if ( $type == "bot" )
{
return $bot;
}
}
function menu_pach( $table, $dbname, $RSconn, $site_id, $la )
{
$query2 = "select distinct topcode from {$table} where site_id='{$site_id}' and la='fa'";
$result2 = mysql_db_query( $dbname, $query2, $RSconn );
while ( $RS2 = mysql_fetch_array( $result2 ) )
{
$tcode = $RS2['topcode'];
$query = "select * from {$table} where topcode='{$tcode}' and site_id='{$site_id}' and la ='{$la}' order by code";
$result = mysql_db_query( $dbname, $query, $RSconn );
$i = 0;
do
{
if ( $RS = mysql_fetch_array( $result ) )
{
++$i;
$id = $RS['id'];
$code = $RS['code'];
$topcode = $RS['topcode'];
if ( $i < 10 )
{
$s = "0{$i}";
}
else
{
$s = $i;
}
if ( $topcode == "00" )
{
$topcode = "";
}
$s = $topcode.$s;
if ( $code != $s )
{
$query = "update {$table} set code='{$s}' where id='{$id}'";
mysql_db_query( $dbname, $query, $RSconn );
}
}
} while ( 1 );
}
$query2 = "select code from {$table} where site_id='{$site_id}' and la='{$la}'";
$result2 = mysql_db_query( $dbname, $query2, $RSconn );
while ( $RS2 = mysql_fetch_array( $result2 ) )
{
$code = $RS2['code'];
$query3 = "select count(*) as cnt from {$table} where topcode='{$code}' and la='{$la}' and site_id='{$site_id}'";
$result3 = mysql_db_query( $dbname, $query3, $RSconn );
$RS3 = mysql_fetch_array( $result3 );
$cnt = ( integer );
$query3 = "update {$table} set bin='{$cnt}' where code='{$code}' and la='{$la}' and site_id='{$site_id}'";
mysql_db_query( $dbname, $query3, $RSconn );
}
}
function ymdate( $str )
{
$tmp = split( "/", $str );
return $tmp[0]."/".$tmp[1];
}
function date_int( $la = "fa", $t = "" )
{
if ( !$t )
{
$t = time( );
}
if ( $la == "fa" )
{
$ny = 1300 + ( integer );
$nm = ( integer );
$nd = ( integer );
}
else
{
if ( file_exists( "zone.txt" ) )
{
$zone_time = implode( "", file( "zone.txt" ) );
}
if ( !$zone_time )
{
$zone_time = 0;
}
$t = $t + $zone_time * 3600;
$ny = ( integer );
$nm = ( integer );
$nd = ( integer );
}
if ( $nd < 10 )
{
$nnd = "0{$nd}";
}
else
{
$nnd = $nd;
}
if ( $nm < 10 )
{
$nnm = "0{$nm}";
}
else
{
$nnm = $nm;
}
if ( $ny < 10 )
{
$nny = "0{$ny}";
}
else
{
$nny = $ny;
}
$cdate = "{$nny}/{$nnm}/{$nnd}";
return $cdate;
}
function date_combo( $la = "fa", $fields = "", $date = "" )
{
if ( trim( $date ) == "//" )
{
$date = "";
}
if ( !$fields )
{
$fields[0] = "day";
$fields[1] = "month";
$fields[2] = "year";
}
if ( !$date )
{
if ( $la == "fa" )
{
$ny = ( integer );
$nm = ( integer );
$nd = ( integer );
}
else
{
$ny = ( integer );
$nm = ( integer );
$nd = ( integer );
}
}
else
{
$tmp = split( "/", $date );
$nd = ( integer );
$nm = ( integer );
$ny = ( integer );
}
$str = "<sel"."ect size='1' name='{$fields['0']}'>";
$i = 1;
for ( ; $i <= 31; ++$i )
{
if ( $nd == $i )
{
$c = "selected";
}
else
{
$c = "";
}
if ( $i < 10 )
{
$j = "0{$i}";
}
else
{
$j = $i;
}
$str .= "<option {$c} value={$j}>{$j}</option>";
}
$str .= "</select><se"."lect size='1' name='{$fields['1']}'>";
$i = 1;
for ( ; $i <= 12; ++$i )
{
if ( $nm == $i )
{
$c = "selected";
}
else
{
$c = "";
}
if ( $i < 10 )
{
$j = "0{$i}";
}
else
{
$j = $i;
}
$str .= "<option {$c} value={$j}>{$j}</option>";
}
$str .= "</select><se"."lect size='1' name='{$fields['2']}'>";
$i = $ny - 5;
for ( ; $i <= $ny + 5; ++$i )
{
if ( $ny == $i )
{
$c = "selected";
}
else
{
$c = "";
}
if ( $i < 10 )
{
$j = "0{$i}";
}
else
{
$j = $i;
}
$str .= "<option {$c} value={$j}>{$j}</option>";
}
$str .= "</select>";
return $str;
}
function get_from_ini( $file )
{
$cpsettings = file_get_contents( $file );
$tmp = split( "\n", $cpsettings );
$i = 0;
for ( ; $i < count( $tmp ); ++$i )
{
$tmp2 = str_replace( "\r", "", $tmp[$i] );
$tmp1 = split( "=", $tmp2 );
$var = trim( $tmp1[0] );
$var = str_replace( "\$", "", $var );
$val = str_replace( "'", "", trim( $tmp1[1] ) );
$val = str_replace( "\"", "", $val );
if ( $var && $val )
{
eval( "global \$".$var.";" );
eval( "\$".$var."=\"".$val."\";" );
}
}
}
function pgsel( $page = 1, $num, $perpage = 10, $pgsper = 10, $perfix = "", $pgperfix = "&page=" )
{
$str = "";
if ( !$perpage )
{
$perpage = 10;
}
$PageCount = ceil( $num / $perpage );
if ( $PageCount < $num / $perpage )
{
$PageCount = $PageCount + 1;
}
if ( $page == 0 )
{
$page = 1;
}
$from = ( $page - 1 ) * $perpage;
$to = $perpage;
if ( 1 < $PageCount )
{
$allpage = ceil( $page / $pgsper );
$thispage = ( $allpage - 1 ) * $pgsper;
$nextpage = $thispage + $pgsper;
if ( $num < $nextpage )
{
$nextpage = $num;
}
if ( $PageCount < $nextpage )
{
$nextpage = $PageCount;
}
$str = "<p dir='{$direction}' align='center'>";
if ( 1 < $thispage )
{
$lastpg = $thispage - 1;
$str .= "<a href='{$perfix}".$pgperfix."1'><<</a> ";
$str .= "<a href='{$perfix}".$pgperfix."{$lastpg}'>...</a> ";
}
$i = $thispage + 1;
for ( ; $i <= $nextpage; ++$i )
{
if ( $page == $i )
{
$str .= "<b>{$i}</b> ";
}
else
{
$str .= "<a href='{$perfix}".$pgperfix."{$i}'>{$i}</a> ";
}
}
$i = $nextpage + 1;
if ( $nextpage < $PageCount )
{
$str .= "<a href='{$perfix}".$pgperfix."{$i}'>...</a> ";
$str .= "<a href='{$perfix}".$pgperfix."{$PageCount}'>>></a> ";
}
$str .= "</p>";
}
return array( $from, $to, $str, $PageCount );
}
function fext( $sFileName )
{
$sTmp = $sFileName;
while ( $sTmp != "" )
{
$sTmp = strstr( $sTmp, "." );
if ( $sTmp != "" )
{
$sTmp = substr( $sTmp, 1 );
$***t = $sTmp;
}
}
return strtolower( $***t );
}
function php_mysql_query( $dbname, $query, $RSconn )
{
$sp = strpos( $query, "INSERT" );
$query = substr( $query, $sp, strlen( $query ) - $sp );
$querys = array( );
$querys = split( "INSERT INTO", $query );
$i = count( $querys ) - 1;
for ( ; -1 < $i; --$i )
{
$q = "INSERT INTO".trim( $querys[$i] );
$q = substr( $q, 0, strlen( $q ) - 1 );
mysql_db_query( $dbname, $q, $RSconn );
}
}
function resizeconvert( $tmpfile, $filetype, $formats, $widths, $heights, $outfiles = "" )
{
if ( $filetype == "image/jpeg" || $filetype == "image/pjpeg" || $filetype == "image/gif" || $filetype == "image/x-png" || $filetype == "image/png" )
{
$data = fread( fopen( $tmpfile, "rb" ), filesize( $tmpfile ) );
$src_image = imagecreatefromstring( $data );
$w = split( "[,]", $widths );
$h = split( "[,]", $heights );
$f = split( "[,]", $formats );
$outfile = split( "[,]", $outfiles );
$dimg = array( );
$img = array( );
$width = imagesx( $src_image );
$height = imagesy( $src_image );
$i = 0;
for ( ; $i < count( $f ); ++$i )
{
if ( $w[$i] == "orginal" )
{
$w[$i] = $width;
}
if ( $h[$i] == "orginal" )
{
$h[$i] = $height;
}
if ( $w[$i] && $width < $height )
{
$w[$i] = $h[$i] / $height * $width;
}
else
{
$h[$i] = $w[$i] / $width * $height;
}
$dimg[$i] = imagecreatetruecolor( $w[$i], $h[$i] );
imagecopyresized( $dimg[$i], $src_image, 0, 0, 0, 0, $w[$i], $h[$i], $width, $height );
ob_start( );
if ( $f[$i] == "gif" )
{
imagegif( $dimg[$i] );
}
if ( $f[$i] == "png" )
{
imagepng( $dimg[$i] );
}
if ( $f[$i] == "jpg" )
{
imagejpeg( $dimg[$i] );
}
$img[$i] = ob_get_contents( );
ob_end_clean( );
if ( !$outfile[$i] )
{
continue;
}
else if ( $img[$i] )
{
$handle = @fopen( @$outfile[$i], "w" );
$ok = @fwrite( @$handle, @$img[$i] );
if ( !$ok )
{
$outfile[$i] = "";
}
@fclose( @$handle );
}
else
{
$outfile[$i] = "";
}
}
if ( !$outfiles )
{
return $img;
}
else
{
return $outfile;
}
}
else
{
return false;
}
}
function second2minute( $second )
{
if ( ceil( $second / 60 ) == $second / 3600 )
{
$d = "00";
$m = $second / 60;
}
else
{
$m = ceil( $second / 60 ) - 1;
$d = $second - $m * 60;
if ( $d == 60 )
{
$d = "00";
++$m;
}
}
if ( strlen( $m ) == 1 )
{
$m = "0{$m}";
}
if ( strlen( $d ) == 1 )
{
$d = "0{$d}";
}
return "{$m}.{$d}";
}
function get_ip_list( )
{
$tmp = array( );
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && strpos( $_SERVER['HTTP_X_FORWARDED_FOR'], "," ) )
{
$tmp += explode( ",", $_SERVER['HTTP_X_FORWARDED_FOR'] );
}
else if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
{
$tmp[] = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
$tmp[] = $_SERVER['REMOTE_ADDR'];
return $tmp;
}
function generate_barcode( $barnumber, $file )
{
include_once( "forms/admin/class/barcode.php" );
$encode = "CODE39";
$bar = new barcode( );
if ( $bar == false )
{
exit( $bar->error( ) );
}
$bar->setsymblogy( $encode );
$bar->setheight( 50 );
$bar->setscale( 1 );
$bar->sethexcolor( "000000", "FFFFFF" );
$return = $bar->genbarcode( $barnumber, "png", $file );
if ( $return == false )
{
$bar->error( true );
}
}
function encodehtml( $sHTML )
{
$sHTML = ereg_replace( "&", "&", $sHTML );
$sHTML = ereg_replace( "<", "<", $sHTML );
$sHTML = ereg_replace( ">", ">", $sHTML );
return $sHTML;
}
function resize_image( $importf, $typ, $exportf, $w, $h )
{
if ( $w && $h )
{
list( $width, $height ) = getimagesize( $importf );
$nh = $h / $height;
$nw = $w / $width;
if ( $nh < $nw )
{
$z = $nh;
}
else
{
$z = $nw;
}
if ( 1 < $z )
{
$z = 1;
}
$newwidth = $width * $z;
$newheight = $height * $z;
$thumb = imagecreatetruecolor( $newwidth, $newheight );
if ( $typ == "image/x-png" )
{
$source = imagecreatefrompng( $importf );
}
if ( $typ == "image/png" )
{
$source = imagecreatefrompng( $importf );
}
if ( $typ == "image/gif" )
{
$source = imagecreatefromgif( $importf );
}
if ( $typ == "image/pjpeg" )
{
$source = imagecreatefromjpeg( $importf );
}
if ( $typ == "image/jpeg" )
{
$source = imagecreatefromjpeg( $importf );
}
imagecopyresized( $thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height );
if ( "" < $exportf )
{
if ( $typ == "image/x-png" )
{
imagepng( $thumb, $exportf );
}
if ( $typ == "image/png" )
{
imagepng( $thumb, $exportf );
}
if ( $typ == "image/gif" )
{
imagegif( $thumb, $exportf );
}
if ( $typ == "image/pjpeg" )
{
imagejpeg( $thumb, $exportf );
}
if ( $typ == "image/jpeg" )
{
imagejpeg( $thumb, $exportf );
}
}
else
{
if ( $typ == "image/x-png" )
{
imagepng( $thumb );
}
if ( $typ == "image/png" )
{
imagepng( $thumb );
}
if ( $typ == "image/gif" )
{
imagegif( $thumb );
}
if ( $typ == "image/pjpeg" )
{
imagejpeg( $thumb );
}
if ( $typ == "image/jpeg" )
{
imagejpeg( $thumb );
}
}
}
}
function date4show( $str )
{
$tmp = split( "/", $str );
return $tmp[2]."/".$tmp[1]."/".$tmp[0];
}
function build_page_name( $pattern, $site, $la, $cat, $code, $ext )
{
$str = $pattern;
$str = str_replace( "SITE", $site, $str );
$str = str_replace( "LA", $la, $str );
$str = str_replace( "CAT", $cat, $str );
if ( $code )
{
$str = str_replace( "CODE", ",{$code}", $str );
}
else
{
$str = str_replace( "CODE", "", $str );
}
if ( $ext )
{
$str = str_replace( "EXT", ".{$ext}", $str );
}
else
{
$str = str_replace( "EXT", "", $str );
}
return $str;
}
function request_link( )
{
$url = $_SERVER['REQUEST_URI'];
$tmp = split( "[/]", $url );
$file = $tmp[count( $tmp ) - 1];
$rootlink = "http://".$_SERVER['HTTP_HOST'].str_replace( $file, "", $url );
$rootlink = $rootlink.$file;
return $rootlink;
}
function rootlink( )
{
$url = $_SERVER['REQUEST_URI'];
$tmp = split( "[/]", $url );
$file = $tmp[count( $tmp ) - 1];
$rootlink = "http://".$_SERVER['HTTP_HOST'].str_replace( $file, "", $url );
return $rootlink;
}
function mysql_time( $tm )
{
return date( "Y-m-d H:i:s", $tm );
}
function emdate( $format, $tm )
{
if ( file_exists( "zone.txt" ) )
{
$zone_time = implode( "", file( "zone.txt" ) );
}
if ( !$zone_time )
{
$zone_time = 0;
}
$tm = $tm + $zone_time * 3600;
return date( $format, $tm );
}
function getpagetitle( $str )
{
return getbet( "<title>", "</title>", $str );
}
function getbet( $str1, $str2, $str )
{
$x1 = strpos( $str, $str1 );
if ( $x1 )
{
$x2 = strpos( $str, $str2, $x1 + 1 );
$getbet = substr( $str, $x1 + strlen( $str1 ), $x2 - $x1 - strlen( $str1 ) );
}
else
{
$getbet = "";
}
return $getbet;
}
function ipinfo( $ip )
{
if ( substr( $ip, 0, 3 ) != "192" && substr( $ip, 0, 3 ) != "127" )
{
$ipstr = @implode( "", @file( @"http://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&searchtext={$ip}" ) );
$str = $ipstr;
$str1 = "netname:";
$str2 = "\n";
$netname = getbet( $str1, $str2, $str );
$str1 = "descr:";
$str2 = "\n";
$description = getbet( $str1, $str2, $str );
$str1 = "country:";
$str2 = "\n";
$country = getbet( $str1, $str2, $str );
$str1 = "phone:";
$str2 = "\n";
$phone = getbet( $str1, $str2, $str );
$str1 = "address:";
$str2 = "\nphone";
$address = getbet( $str1, $str2, $str );
$address = str_replace( "address:", "", $address );
$address = str_replace( "\n", " - ", $address );
$address = trim( $address );
$isp = getbet( "-", "-", $netname );
$isp = $isp." - ".$description;
$isp = trim( $isp );
if ( $isp == "-" )
{
$isp = "Unknown";
}
if ( $phone == "" )
{
$phone = "Unknown";
}
if ( $address == "" )
{
$address = "Unknown";
}
if ( $country == "Unknown" )
{
$cctld = "-";
}
else
{
$cctld = strtoupper( $country );
}
$ipinfo['isp'] = $isp;
$ipinfo['country'] = $country;
$ipinfo['address'] = $address;
$ipinfo['phone'] = $phone;
$ipinfo['cctld'] = $cctld;
return $ipinfo;
}
}
function cinfo( )
{
$agent = " ".$_SERVER['HTTP_USER_AGENT'];
$browser = "Unknown";
if ( strpos( $agent, "Opera" ) )
{
$browser = "Opera";
$bicon = "opera";
}
if ( strpos( $agent, "Opera 3" ) )
{
$browser = "Opera 3";
$bicon = "opera";
}
if ( strpos( $agent, "Opera 4" ) )
{
$browser = "Opera 4";
$bicon = "opera";
}
if ( strpos( $agent, "Opera 5" ) )
{
$browser = "Opera 5";
$bicon = "opera";
}
if ( strpos( $agent, "Opera 6" ) )
{
$browser = "Opera 6";
$bicon = "opera";
}
if ( strpos( $agent, "MSIE 6" ) )
{
$browser = "Microsoft IE 6";
$bicon = "ie";
}
if ( strpos( $agent, "MSIE 5" ) )
{
$browser = "Microsoft IE 5";
$bicon = "ie";
}
if ( strpos( $agent, "MSIE 4" ) )
{
$browser = "Microsoft IE 4";
$bicon = "ie";
}
if ( strpos( $agent, "MSIE 3" ) )
{
$browser = "Microsoft IE 3";
$bicon = "ie";
}
if ( strpos( $agent, "Mozilla/5" ) || strpos( $agent, "Netscape6" ) )
{
$browser = "Netscape 6";
$bicon = "netscape";
}
if ( strpos( $agent, "Mozilla/4" ) )
{
$browser = "Netscape 4";
$bicon = "netscape";
}
if ( strpos( $agent, "Mozilla/3" ) )
{
$browser = "Netscape 3";
$bicon = "netscape";
}
if ( strpos( $agent, "Firefox" ) )
{
$browser = "FireFox";
$bicon = "netscape";
}
$os = "Unknown";
if ( strpos( $agent, "NT" ) || strpos( $agent, "WinNT" ) )
{
$os = "Windows NT 4";
$oicon = "windows";
}
if ( strpos( $agent, "NT 5" ) || strpos( $agent, "Windows 2000" ) )
{
$os = "Windows 2000";
$oicon = "windows";
}
if ( strpos( $agent, "NT 5.1" ) || strpos( $agent, "Windows XP" ) )
{
$os = "Windows XP";
$oicon = "windows";
}
if ( strpos( $agent, "95" ) || strpos( $agent, "Win95" ) )
{
$os = "Windows 95";
$oicon = "windows";
}
if ( strpos( $agent, "Win 9x 4.90" ) )
{
$os = "Windows ME";
$oicon = "windows";
}
if ( strpos( $agent, "98" ) || strpos( $agent, "Win98" ) )
{
$os = "Windows 98";
$oicon = "windows";
}
if ( strpos( $agent, "Windows 3.1" ) || strpos( $agent, "Win16" ) )
{
$os = "Windows 3.x";
$oicon = "windows";
}
if ( strpos( $agent, "Macintosh" ) || strpos( $agent, "Mac" ) || strpos( $agent, "Macintosh" ) )
{
$os = "Macintosh";
$oicon = "mac";
}
if ( strpos( $agent, "Linux" ) )
{
$os = "Linux";
$oicon = "linux";
}
if ( strpos( $agent, "Unix" ) || strpos( $agent, "sunos" ) || strpos( $agent, "X11" ) )
{
$os = "Unix";
$oicon = "sun";
}
if ( strpos( $agent, "WebTV" ) || strpos( $agent, "AOL_TV" ) )
{
$os = "Web TV";
$oicon = "webtv";
}
$cinfo = array( );
$cinfo['browser'] = $browser;
$cinfo['browser_icon'] = $bicon;
$cinfo['os'] = $os;
$cinfo['os_icon'] = $oicon;
return $cinfo;
}
function html2text( $html )
{
$width = 70;
$hr = str_pad( $hr, $width, "+-" );
$search = array( "/\r/", "/[\n\t]+/", "/<script[^>]*>.*?<\\/script>/i", "/<\\/title>/i", "/<h[123456][^>]*>(.+?)<\\/h[123456]>/ie", "/<\\/p>/i", "/"/i", "/>/i", "/</i", "/&/i", "/©/i", "/™/i", "/®/i", "/•/" );
$replace = array( "", "", "", "", "\n", "ucwords(\"\n\n\\1\n\n\")", "\n", "\n", "\n", "\n", "\n", "\n", "\t\t", "\n", "\t*\t", "\n".$hr."\n", "\n\n", "\n", "\t\t\t\t\t", " ", "\"", ">", "<", "&", "(c)", "(tm)", "(R)", "*" );
$text = trim( stripslashes( $html ) );
$text = preg_replace( $search, $replace, $text );
$text = strip_tags( $text );
$text = preg_replace( "/\n[[:space:]]+/", "\n\n", $text );
$text = preg_replace( "/[\n]{3,}/", "\n\n", $text );
$text = wordwrap( $text, $width );
return $text;
}
function getphpself( $n )
{
$phpself = $_SERVER['PHP_SELF'];
$x = strpos( $phpself, "/" );
while ( !true || !strpos( $phpself, "/", $x + 1 ) )
{
$x = strpos( $phpself, "/", $x + 1 );
continue;
break;
}
$lastpos = strlen( $phpself ) - $x - 1;
if ( $n == 1 )
{
return substr( $phpself, 0 - $lastpos );
}
else
{
return "http://".$_SERVER['SERVER_NAME'].str_replace( substr( $phpself, 0 - $lastpos ), "", $phpself );
}
}
function injection_replace( $txtobject )
{
$txtobject1 = strtolower( $txtobject );
str_replace( "'", "&39", $txtobject );
str_replace( "'", "&39", $txtobject );
str_replace( "<", "&60", $txtobject );
str_replace( ">", "&62", $txtobject );
str_replace( "or", "", $txtobject );
str_replace( "delete", "", $txtobject );
str_replace( "update", "", $txtobject );
str_replace( "insert", "", $txtobject );
return $txtobject;
}
function convertx2sdate( $g_d, $g_m, $g_y )
{
global $g_days_in_month;
global $j_days_in_month;
$div = create_function( "\$a, \$b", "return (int) (\$a / \$b);" );
$gy = $g_y - 1600;
$gm = $g_m - 1;
$gd = $g_d - 1;
$g_day_no = 365 * $gy + $div( $gy + 3, 4 ) - $div( $gy + 99, 100 ) + $div( $gy + 399, 400 );
$i = 0;
for ( ; $i < $gm; ++$i )
{
$g_day_no += $g_days_in_month[$i];
}
if ( 1 < $gm && ( $gy % 4 == 0 && $gy % 100 != 0 || $gy % 400 == 0 ) )
{
++$g_day_no;
}
$g_day_no += $gd;
$j_day_no = $g_day_no - 79;
$j_np = $div( $j_day_no, 12053 );
$j_day_no = $j_day_no % 12053;
$jy = 979 + 33 * $j_np + 4 * $div( $j_day_no, 1461 );
$j_day_no %= 1461;
if ( 366 <= $j_day_no )
{
$jy += $div( $j_day_no - 1, 365 );
$j_day_no = ( $j_day_no - 1 ) % 365;
}
$i = 0;
for ( ; $i < 11 && $j_days_in_month[$i] <= $j_day_no; ++$i )
{
$j_day_no -= $j_days_in_month[$i];
}
$jm = $i + 1;
$jd = $j_day_no + 1;
return array( $jd, $jm, $jy );
}
function converts2xdate( $j_d, $j_m, $j_y )
{
global $g_days_in_month;
global $j_days_in_month;
$div = create_function( "\$a, \$b", "return (int) (\$a / \$b);" );
$jy = $j_y - 979;
$jm = $j_m - 1;
$jd = $j_d - 1;
$j_day_no = 365 * $jy + $div( $jy, 33 ) * 8 + $div( $jy % 33 + 3, 4 );
$i = 0;
for ( ; $i < $jm; ++$i )
{
$j_day_no += $j_days_in_month[$i];
}
$j_day_no += $jd;
$g_day_no = $j_day_no + 79;
$gy = 1600 + 400 * $div( $g_day_no, 146097 );
$g_day_no = $g_day_no % 146097;
$leap = true;
if ( 36525 <= $g_day_no )
{
--$g_day_no;
$gy += 100 * $div( $g_day_no, 36524 );
$g_day_no = $g_day_no % 36524;
if ( 365 <= $g_day_no )
{
++$g_day_no;
}
else
{
$leap = false;
}
}
$gy += 4 * $div( $g_day_no, 1461 );
$g_day_no %= 1461;
if ( 366 <= $g_day_no )
{
$leap = false;
--$g_day_no;
$gy += $div( $g_day_no, 365 );
$g_day_no = $g_day_no % 365;
}
$i = 0;
for ( ; $g_days_in_month[$i] + ( $i == 1 && $leap ) <= $g_day_no; ++$i )
{
$g_day_no -= $g_days_in_month[$i] + ( $i == 1 && $leap );
}
$gm = $i + 1;
$gd = $g_day_no + 1;
return array( $gy, $gm, $gd );
}
function shdate( $date )
{
if ( $date == 0 )
{
echo "";
}
else
{
$yy = substr( $date, 0, 4 );
$mm = substr( $date, 5, 2 );
$dd = substr( $date, 8, 2 );
$sh = convertx2sdate( $dd, $mm, $yy );
$sh[2] = substr( $sh[2], 2, 2 );
if ( $sh[1] < 10 )
{
$sh[1] = "0".$sh[1];
}
if ( $sh[0] < 10 )
{
$sh[0] = "0".$sh[0];
}
return $sh[2]."/".$sh[1]."/".$sh[0];
}
}
function farsidate( $dte, $typ )
{
if ( file_exists( "zone.txt" ) )
{
$zone_time = implode( "", file( "zone.txt" ) );
}
if ( !$zone_time )
{
$zone_time = 0;
}
$dte = $dte + $zone_time * 3600;
$lweek = date( "l", $dte );
switch ( $lweek )
{
case "Saturday" :
$fweek = "شنبه";
break;
case "Sunday" :
$fweek = "يكشنبه";
break;
case "Monday" :
$fweek = "دوشنبه";
break;
case "Tuesday" :
$fweek = "سه شنبه";
break;
case "Wednesday" :
$fweek = "چهارشنبه";
break;
case "Thursday" :
$fweek = "پنجشنبه";
break;
case "Friday" :
$fweek = "جمعه";
}
$dd = strftime( "%d", $dte );
$mm = strftime( "%m", $dte );
$yy = strftime( "%Y", $dte );
$sh = convertx2sdate( $dd, $mm, $yy );
$sh[2] = substr( $sh[2], 2, 2 );
if ( $sh[1] < 10 )
{
$sh[1] = "0".$sh[1];
}
if ( $sh[0] < 10 )
{
$sh[0] = "0".$sh[0];
}
$sy = $sh[2];
$sm = $sh[1];
$sd = $sh[0];
$fdate = "{$sd}/{$sm}/{$sy}";
$ftime = date( "H:i", $dte );
$farsidate = "{$fweek} {$fdate} ساعت {$ftime}";
switch ( $typ )
{
case "d" :
$farsidate = "{$sd}";
break;
case "m" :
$farsidate = "{$sm}";
break;
case "y" :
$farsidate = "{$sy}";
break;
case "yy" :
$farsidate = "13{$sy}";
break;
case "t" :
$farsidate = $ftime;
break;
case "w" :
$farsidate = $fweek;
break;
case "s" :
$farsidate = "{$sy}/{$sm}/{$sd}";
break;
case "c" :
$farsidate = "{$sd}/{$sm}/{$sy}";
break;
case "h" :
$farsidate = "{$fweek} {$fdate}";
break;
case "table" :
$farsidate = "{$sd}/{$sm}/{$sy} {$ftime}";
break;
case "db" :
$farsidate = "{$sy}/{$sm}/{$sd}-{$ftime}";
break;
case "standard" :
$fdate = "{$sd}/{$sm}/{$sy}";
$ftime = date( "H:i", $dte );
$farsidate = "{$fweek} {$fdate} ساعت {$ftime}";
}
return $farsidate;
}
function ltr( $st, $typ )
{
$m1 = strpos( $st, "/" );
if ( $m1 )
{
$m2 = strpos( $st, "/", $m1 + 1 );
}
$len = strlen( $st );
$st_y = substr( $st, 0, $m1 );
$st_m = substr( $st, $m1 + 1, $m2 - $m1 - 1 );
$st_d = substr( $st, $m2 + 1, $len - $m2 - 1 );
if ( strlen( $st_y ) == 1 )
{
$st_y = "0".$st_y;
}
if ( strlen( $st_m ) == 1 )
{
$st_m = "0".$st_m;
}
switch ( $typ )
{
case "d" :
$ltr = "{$st_d}";
break;
case "m" :
$ltr = "{$st_m}";
break;
case "y" :
$ltr = "{$st_y}";
break;
case "" :
$ltr = "{$st_d}/{$st_m}/{$st_y}";
}
return $ltr;
}
function http2file( $str )
{
$str = str_replace( "http//", "", $str );
$str = str_replace( "https//", "", $str );
$str = str_replace( "%20", " ", $str );
$strq = array( );
$strq = split( "[?]", $str );
$str = $strq[0];
if ( substr( $str, -1 ) == "/" )
{
$str = substr( $str, 0, strlen( $str ) - 1 );
}
$x1 = strpos( $str, "/", 0 );
while ( $x1 )
{
$x2 = strpos( $str, "/", $x1 + 1 );
if ( !$x2 )
{
$x2 = $x1;
break;
}
else
{
$x1 = $x2;
}
}
return substr( $str, $x2 + 1, strlen( $str ) - $x2 + 1 );
}
function delend( $str )
{
if ( substr( $str, -1 ) == "/" )
{
$str = substr( $str, 0, strlen( $str ) - 1 );
}
$x1 = strpos( $str, "/", 0 );
while ( $x1 )
{
$x2 = strpos( $str, "/", $x1 + 1 );
if ( !$x2 )
{
$x2 = $x1;
break;
}
else
{
$x1 = $x2;
}
}
return substr( $str, 0, $x2 );
}
function browse_dir( $fdir )
{
$tree = array( );
$lev = 0;
$directory = $fdir;
$dht = opendir( $directory );
$dirs = chr( 13 );
while ( true )
{
$w = 0;
$hc = 0;
while ( false !== ( $ft = readdir( $dht ) ) )
{
if ( !( $ft != "." && $ft != ".." ) || !is_dir( $directory.$ft ) || !( strstr( $dirs, chr( 13 ).$directory.$ft."/".chr( 13 ) ) == false ) )
{
$hc = 1;
$directory = $directory.$ft."/";
$dirs .= $directory.chr( 13 );
break;
}
}
if ( $hc == 0 )
{
$directory = delend( $directory )."/";
if ( $directory == delend( $fdir )."/" )
{
break;
}
}
closedir( $dht );
$dht = opendir( $directory );
}
$dirs = str_replace( $fdir, "", $dirs );
$dirs = substr( $dirs, 1, strlen( $dirs ) - 2 );
$dirs = ".".chr( 13 ).$dirs;
$folders = explode( chr( 13 ), $dirs );
unset( $dirs );
return $folders;
}
function mkdirc( $path )
{
$fold = str_replace( "./", "", $path );
$x1 = strpos( $fold, "/" );
$cdir .= substr( $fold, 0, $x1 );
if ( !file_exists( $cdir ) )
{
mkdir( $cdir, 511 );
}
while ( $x1 )
{
$x2 = strpos( $fold, "/", $x1 + 1 );
if ( !$x2 )
{
break;
}
else
{
$cdir .= substr( $fold, $x1, $x2 - $x1 );
if ( !file_exists( $cdir ) )
{
mkdir( $cdir, 511 );
}
$x1 = $x2;
}
}
}
function fmonth( $m )
{
switch ( $m )
{
case 1 :
$fmonth = "فروردين";
break;
case 2 :
$fmonth = "ارديبهشت";
break;
case 3 :
$fmonth = "خرداد";
break;
case 4 :
$fmonth = "تير";
break;
case 5 :
$fmonth = "مرداد";
break;
case 6 :
$fmonth = "شهريور";
break;
case 7 :
$fmonth = "مهر";
break;
case 8 :
$fmonth = "آبان";
break;
case 9 :
$fmonth = "آذر";
break;
case 10 :
$fmonth = "دي";
break;
case 11 :
$fmonth = "بهمن";
break;
case 12 :
$fmonth = "اسفند";
}
return $fmonth;
}
function copy_dir( $src, $des )
{
if ( $src == "" )
{
$src = "./";
}
if ( $des == "" )
{
$des = "./Copy/";
}
$folders = browse_dir( $src );
$i = 0;
for ( ; $i < count( $folders ); ++$i )
{
mkdirc( $des.$folders[$i] );
$dht = opendir( $src.$folders[$i] );
$hd = 0;
while ( false !== ( $ft = readdir( $dht ) ) )
{
if ( !( $ft != "." && $ft != ".." ) || is_dir( $src.$folders[$i].$ft ) )
{
copy( $src.$folders[$i].$ft, $des.$folders[$i].$ft );
}
}
closedir( $dht );
}
$dht = opendir( $src );
while ( false !== ( $ft = readdir( $dht ) ) )
{
if ( !( $ft != "." && $ft != ".." ) || is_dir( $src.$ft ) )
{
copy( $src.$ft, $des.$ft );
}
}
closedir( $dht );
$wizard = "{$src} copied to {$des} successfully";
return $wizard;
}
function move_dir( $fdir, $fmove, $typ )
{
$directory = $fdir;
$moveto = $fmove;
$dht = opendir( $directory );
if ( !file_exists( $moveto ) && $typ != "empty" )
{
mkdir( $moveto, 511 );
}
while ( true )
{
$w = 0;
$gd = 0;
while ( false !== ( $ft = readdir( $dht ) ) )
{
++$w;
if ( !( $ft != "." && $ft != ".." ) )
{
continue;
}
else if ( is_dir( $directory.$ft ) )
{
$gd = 1;
$directory = $directory.$ft."/";
$moveto = $moveto.$ft."/";
if ( !( !!file_exists( $moveto ) || !( $typ != "empty" ) ) )
{
break;
}
else
{
mkdir( $moveto, 511 );
break;
}
}
else if ( $typ != "empty" )
{
$copied = copy( $directory.$ft, $moveto.$ft );
$mes = "Moving '{$directory}.{$ft}' to {$moveto}.{$ft} ... Done !";
if ( $copied )
{
unlink( $directory.$ft );
}
}
else
{
unlink( $directory.$ft );
}
}
closedir( $dht );
if ( $w == 0 )
{
rmdir( $directory );
}
if ( $gd != 1 )
{
rmdir( $directory );
if ( !file_exists( $moveto ) && $typ != "empty" )
{
mkdir( $moveto, 511 );
}
$directory = delend( $directory )."/";
$moveto = delend( $moveto )."/";
if ( $directory == delend( $fdir )."/" )
{
break;
}
}
$dht = opendir( $directory );
}
}
$g_days_in_month = array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
$j_days_in_month = array( 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29 );
include_once( "file/include/mysql.php" );
if ( md5( str_replace( "www.", "", strtolower( $_SERVER['HTTP_HOST'] ) )."alireza_bayat_file_itin_09385812604" )."md5".md5( $_SERVER['SERVER_ADDR']."alireza_bayat_file_itin_09385812604" ) != $mysql_licence )
{
echo "<br /><b>Parse error</b>: parse error, unexpected T_INCLUDE_ONCE in <b>/coms/index.php</b> on line <b>1</b><br />";
exit( );
}
?>