date("d",$now)) ) { $sql = "update hcounter set today=1,dateline=$now"; $result = mysql_query($sql) or die("invalid query: " . Mysql_error()); } if ( (date("m",$row['dateline'])) <> (date("m",$now)) ) { $sql = "update hcounter set today=1,thismonth=1,dateline=$now"; $result = mysql_query($sql) or die("invalid query: " . Mysql_error()); } if ( (date("y",$row['dateline'])) < (date("y",$now)) ) { $sql = "update hcounter set today=1,thismonth=1,thisyear=1,dateline=$now"; $result = mysql_query($sql) or die("invalid query: " . Mysql_error()); } $result = mysql_query("select * from hcounter") or die("invalid query: " . Mysql_error()); $row=mysql_fetch_array($result); $htoday = $row['today'] ; $hmonth = $row['thismonth'] ; $hyear = $row['thisyear'] ; $htotal = $row['total'] ; //المتواجدون الآن $remote_addr = getenv ("remote_addr"); $sql = "select time from online where ip='$remote_addr'"; $result = mysql_query($sql); if (mysql_num_rows($result)==0){ $sql = "insert into online set ip='$remote_addr', time =now()"; $result = mysql_query($sql); }else{ $sql = "update online set time=now() where ip='$remote_addr'"; $result = mysql_query($sql); } $onlineuserexpireminutes = "60"; $purgeseconds = $onlineuserexpireminutes * 60; $userexpired = strftime("%y-%m-%d %h:%m:%s", time() - $purgeseconds); $sql = "delete from online where time < '$userexpired'"; $result = mysql_query($sql); $onlineusers = mysql_query("select * from online"); $online = mysql_num_rows($onlineusers); //نهاية كود المتواجدون الىن /////////////الوقت والتاريخ/////////// function time_date() { /* //كود التاريخ بالهجري $m = date("m");$y = date("y");$d = date("d"); $dd=date("d");if ($dd=="sat") $dd="السبت";if ($dd=="sun") $dd="الأحد";if ($dd=="mon") $dd="الاثنين";if ($dd=="tue") $dd="الثلاثاء";if ($dd=="wed") $dd="الأربعاء";if ($dd=="thu") $dd="الخميس";if ($dd=="fri") $dd="الجمعة"; if ( $m > 2 ) { $y = $y; $m = $m;} if ($m == 1 || $m == 2) { $y = $y - 1;$m = $m + 12;} $j = intval(365.25 * $y) + intval(30.6001 * ($m + 1)) + $d + 1720994.5; if (date("d / m / y") >= (15 / 10 / 1582)) { $a = intval($y / 100);$b = 2 - $a + intval($a / 4);$jd = $j + $b;} if (date("d / m / y") < (15 / 10 / 1582)) {$jd = $j;} $hh = $jd - 1948437.5;$y = ($hh / 354.3667);$hy = intval($y) + 1;$m = (12 * ($y - intval($y)));$hm = intval($m) + 1;$d = (29.5305 * ($m - intval($m)));$hd = intval($d); if ($hd == 0) {$hd = 30;$hm = $hm - 1;} if ($hm == 0 ) {$hm = 12;$hy = $hy - 1;} // ملخص الدالة $day = $dd." ". $hd."/". $hm."/". $hy. "هـ"; $day .= " "; $day .= date(i) ." : ". Date(g); $day .= " "; $day .= date(a); $day = str_replace('pm','مساءً',$day); $day = str_replace('am','صباحاً',$day); echo "$day"; */ ////////////// $nameday=date("l"); $day=date("d"); $namemonth=date("m"); $year=date("y"); $ampm= date("h:i a"); $ampm = str_replace('pm','مساءً',$ampm); $ampm = str_replace('am','صباحاً',$ampm); switch ($nameday) { case "saturday": $nameday="السبت"; break; case "sunday": $nameday="الأحد"; break; case "monday": $nameday="الاثنين"; break; case "tuesday": $nameday="الثلاثاء"; break; case "wednesday": $nameday="الأربعاء"; break; case "thursday": $nameday="الخميس"; break; case "friday": $nameday="الجمعة"; break; } switch ($namemonth) { case 1: $namemonth="يناير"; break; case 2: $namemonth="فبراير"; break; case 3: $namemonth="مارس"; break; case 4: $namemonth="إبريل"; break; case 5: $namemonth="مايو"; break; case 6: $namemonth="يونيو"; break; case 7: $namemonth="يوليو"; break; case 8: $namemonth="اغسطس"; break; case 9: $namemonth="سبتمبر"; break; case 10: $namemonth="اكتوبر"; break; case 11: $namemonth="نوفمبر"; break; case 12: $namemonth="ديسمبر"; break; } echo "اليوم : $nameday $day $namemonth $year الساعة : $ampm"; } function ads4header() { global $htmlorphp,$adsloop; echo "
"; $sql = "select * from ads where cat=0"; $result = mysql_query ($sql) or die ("query failed"); $looptable = '0'; while ($adss = mysql_fetch_array($result)) { ++$looptable; if($looptable=="$adsloop"){ $tr = ""; $looptable="0"; }else{ $tr = ""; } $nameads = $adss['name']; $imageads = $adss['image']; $urlads = $adss['url']; $visads = $adss['vis']; $i = $adss['adsid']; if ($nameads) { if ($htmlorphp=="1"){ echo "$tr"; }else{ echo "$tr"; } }else{ echo ""; } } echo " "; } function menu() { global $htmlorphp; $sql = "select * from book_cat where sub=0 order by order_cat"; $result = mysql_query($sql); while ($row = @mysql_fetch_array($result)) { if ($htmlorphp=="1"){ $s .= " >> $row[name]
"; }else{ $s .= " >> $row[name]
"; } } $s .= " "; return $s; } //دالة عرض الأقسام بالصفحة الرئيسية function indexcats() { global $htmlorphp,$catsloop; if($catsloop=="1"){$width = "100%";} elseif($catsloop=="2"){$width = "50%";} elseif($catsloop=="3"){$width = "33%";} elseif($catsloop=="4"){$width = "25%";} elseif($catsloop=="5"){$width = "20%";} elseif($catsloop=="6"){$width = "16%";} else{$width = "";} $printcats .= " "; $sql = "select * from book_cat where sub=0 order by order_cat"; $result = mysql_query($sql); $tslsls = '0'; while ($row2 = @mysql_fetch_array($result)) { $numall = mysql_query("select * from book_all where cat='$row2[id]'"); $number = mysql_num_rows($numall); ++$tslsls; if($tslsls=="$catsloop"){ $tslslats = ""; $tslsls="0"; }else{ $tslslats = ""; } if ($row2[image]){ $imageok = " 
"; }else{ $imageok = ""; } if ($row2[describes]){ $describesok = "
$row2[describes]"; }else{ $describesok = ""; } if ($htmlorphp=="1"){ $printcats .= " $imageok $row2[name]$describesok
الكتب $number الزيارات $row2[vis] $tslslats"; }else{ $printcats .= "
$imageok $row2[name]$describesok
الكتب $number الزيارات $row2[vis] $tslslats"; } } $printcats .= " "; return $printcats; } /* function catstext() { global $id,$htmlorphp,$threadsloop,$catsloop; if($catsloop=="1"){$width = "100%";} elseif($catsloop=="2"){$width = "50%";} elseif($catsloop=="3"){$width = "33%";} elseif($catsloop=="4"){$width = "25%";} elseif($catsloop=="5"){$width = "20%";} elseif($catsloop=="6"){$width = "16%";} else{$width = "";} $sql = "select * from book_cat where sub=$id order by order_cat"; $result = mysql_query($sql); $nuc = mysql_num_rows($result); if($nuc > 0){ $printcats .= " "; $tslsls = '0'; while ($row2 = @mysql_fetch_array($result)) { $numall = mysql_query("select * from book_all where cat='$row2[id]'"); $number = mysql_num_rows($numall); ++$tslsls; if($tslsls=="$catsloop"){ $tslslats = ""; $tslsls="0"; }else{ $tslslats = ""; } if ($row2[image]){ $imageok = " 
"; }else{ $imageok = ""; } if ($row2[describes]){ $describesok = "
$row2[describes]"; }else{ $describesok = ""; } if ($htmlorphp=="1"){ $printcats .= " $imageok $row2[name]$describesok
الكتب $number الزيارات $row2[vis] $tslslats"; }else{ $printcats .= "
$imageok $row2[name]$describesok
الكتب $number الزيارات $row2[vis] $tslslats"; } } $printcats .= " "; $printcats .= "
"; } $page = (int) (!isset($_get["page"]) ? 1 : $_get["page"]); $page = ($page == 0 ? 1 : $page); $perpage = $threadsloop; $startpoint = ($page * $perpage) - $perpage; $sql = "select * from book_all where cat=$id order by id desc limit $startpoint,$perpage"; $result = mysql_query($sql); $number2 = mysql_num_rows($result); if($number2 > 0){ $printcats .= " "; $colorcss=1; while ($row = @mysql_fetch_array($result)) { $sql2 = mysql_query("select id,type,size,vis from book_files where id=$row[idfiles]"); $row2 = @mysql_fetch_array($sql2); if($colorcss==1){$color=loopcolor2;}else{$color=lo opcolor1;$colorcss=0;} $ex = $row['ext']; if($row[image] != ""){ $im = "  "; }else{ $im = "  "; } if($row[example] != ""){ $exam = "  "; }else{ $exam = "  "; } if($row[text] != ""){ $tex = "  "; }else{ $tex = "  "; } if($row[text] != ""){ $texh = "  "; }else{ $texh = "  "; } if($row[downloads] != ""){ $down = "  "; }else{ $down = "  "; } if($row[downloads] != ""){ $downh = "  "; }else{ $downh = "  "; } if($row[writerbook] != ""){ $writer = "$row[writerbook]"; }else{ $writer = "  "; } if($row[size] != ""){ $sz = "$row[size]"; }else{ $sz = "  "; } if($ex == "1"){$e = "أكروبات";} elseif($ex == "2"){$e = "وورد";} elseif($ex == "3"){$e = "exe";} elseif($ex == "4"){$e = "  ";} else{$e = "  ";} if ($htmlorphp=="1"){ $printcats .= " "; }else{ $printcats .= " "; $colorcss++; } } $printcats .= " إسم الكتاب المؤلف نبذه مثال صورة حفظ حجم النوع زيارات $row[name] $writer $texh $exam $im $downh $sz $e $row[vis] $row[name] $writer $tex $exam $im $down $sz $e $row[vis] "; ////// بداية كود تعدد الصفحات /////// $pagesnum = @ceil(mysql_num_rows(mysql_query("select `id` from `book_all` where cat ='$id'")) / $perpage); $printcats .= " "; for ($i=1; $i<=$pagesnum; $i++) { if ($i != $page) { if ($htmlorphp=="1"){ $z = ""; }else{ $z = ""; } } else { $z = ""; } $printcats .= "$z"; } $printcats .= " "; } ////// نهاية كود تعدد الصفحات ////// return $printcats; } */ function catstext() { global $id,$htmlorphp,$threadsloop,$catsloop; if($catsloop=="1"){$width = "100%";} elseif($catsloop=="2"){$width = "50%";} elseif($catsloop=="3"){$width = "33%";} elseif($catsloop=="4"){$width = "25%";} elseif($catsloop=="5"){$width = "20%";} elseif($catsloop=="6"){$width = "16%";} else{$width = "";} $sql = "select * from book_cat where sub=$id order by order_cat"; $result = mysql_query($sql); $nuc = mysql_num_rows($result); if($nuc > 0){ $printcats .= " "; $tslsls = '0'; while ($row2 = @mysql_fetch_array($result)) { $numall = mysql_query("select * from book_all where cat='$row2[id]'"); $number = mysql_num_rows($numall); ++$tslsls; if($tslsls=="$catsloop"){ $tslslats = ""; $tslsls="0"; }else{ $tslslats = ""; } if ($row2[image]){ $imageok = " 
"; }else{ $imageok = ""; } if ($row2[describes]){ $describesok = "
$row2[describes]"; }else{ $describesok = ""; } if ($htmlorphp=="1"){ $printcats .= " $imageok $row2[name]$describesok
الكتب $number الزيارات $row2[vis] $tslslats"; }else{ $printcats .= "
$imageok $row2[name]$describesok
الكتب $number الزيارات $row2[vis] $tslslats"; } } $printcats .= " "; $printcats .= "
"; } $page = (int) (!isset($_get["page"]) ? 1 : $_get["page"]); $page = ($page == 0 ? 1 : $page); $perpage = $threadsloop; $startpoint = ($page * $perpage) - $perpage; $sql = "select * from book_all where cat=$id order by id desc limit $startpoint,$perpage"; $result = mysql_query($sql); $number2 = mysql_num_rows($result); if($number2 > 0){ $printcats .= " "; $colorcss=1; while ($row = @mysql_fetch_array($result)) { $text = $row[text]; $text = htmlspecialchars($text); $text = stripslashes($text); $text = str_replace( "<", "<", $text ); $text = str_replace( ">", ">", $text ); $text= str_replace( "\" , "\\", $text); $text= str_replace( "'" , "'", $text); $text= str_replace( "!" , "!", $text); $text= str_replace( "$" , "$", $text); $text= str_replace( "|" , "|", $text); $text= str_replace( "&" , "&", $text); $text= str_replace( '"' , '"', $text); $text = str_replace( "™", "(tm)", $text ); $text = replace($text); $sql2 = mysql_query("select id,type,size,vis from book_files where id=$row[idfiles]"); $row2 = @mysql_fetch_array($sql2); if($colorcss==1){$color=loopcolor2;}else{$color=lo opcolor1;$colorcss=0;} $ex = $row['ext']; if($row[downloads] != ""){ $down = "  "; }else{ $down = "  "; } if($text != ""){ $txx = "$text
"; }else{ $txx = ""; } if($row[downloads] != ""){ $downh = "  "; }else{ $downh = "  "; } if($row[writerbook] != ""){ $writer = "$row[writerbook]"; }else{ $writer = "- - -"; } if ($htmlorphp=="1"){ $printcats .= ""; }else{ $printcats .= ""; $colorcss++; } } $printcats .= " إسم الكتاب المؤلف حفظ زيارات $row[name]
$txx $writer $downh $row[vis] $row[name]
$txx $writer $down $row[vis] "; ////// بداية كود تعدد الصفحات /////// $pagesnum = @ceil(mysql_num_rows(mysql_query("select `id` from `book_all` where cat ='$id'")) / $perpage); $printcats .= " "; for ($i=1; $i<=$pagesnum; $i++) { if ($i != $page) { if ($htmlorphp=="1"){ $z = ""; }else{ $z = ""; } } else { $z = ""; } $printcats .= "$z"; } $printcats .= " "; } ////// نهاية كود تعدد الصفحات ////// return $printcats; } function footer() { global $htoday,$hmonth,$htotal,$online; echo "زوار هذا اليوم $htoday وزوار هذا الشهر $hmonth وإجمالي الزوار $htotal والمتواجدون حاليا $online زائر
"; echo "مكتبة الكتب برمجة bwady.com "; } //*****function for visual basic code****\\ //*************start fuction*************\\ function vbasic($code) { $reserved = array("public", "private", "sub", "dim", "as", "integer", "end", "me", "string", "long", "function", "declare", "lib", "byval", "with", "if", "then", "else", "option", "explicit", "type", "const", "open", "close", "print", "write", "as", "for", "next", "to","exit","on","error","goto"); $numr = count($reserved); $code = str_replace('(', ' ( ', $code); $code = str_replace(')', ' ) ', $code); $code = str_replace('.', ' . ', $code); $code = str_replace("'", " ' ", $code); $code = str_replace('"', ' " ', $code); $code = str_replace(",", " , ", $code); $lines = explode("
", $code); $numl = count($lines); for ($i = 0; $i < $numl; $i++) { $lines[$i] = str_replace("\r", '', $lines[$i]); $words = explode(' ', $lines[$i]); $numw = count($words); $line = ''; for ($j = 0; $j < $numw; $j++) { $b = 0; if($words[$j] == "'") { $line = substr($line, 0, strlen($line) -1) . '' . "'"; for ($m = $j + 1; $m < $numw; $m++) { $line = $line . $words[$m] . ' '; } $line = $line . ""; break; } if ($words[$j] == '"') { $line = substr($line, 0, strlen($line) -1) . $words[$j]; if ($skip == 1) { $skip = 0; } else { $skip = 1; } } else { if ($skip == 0) { for ($k = 0; $k < $numr; $k++) { if (strtolower(trim($words[$j])) == strtolower($reserved[$k])) { $b = 1; $line = $line . '' . $words[$j] . ' '; break; } } if ($b != 1) { $line = $line . $words[$j]; if(trim($words[$j]) != '"') { if(trim($words[$j]) != "'") { $line = $line . ' '; } } } } else { if (trim($words[$j]) == '"') { $line = trim($line) . '"'; } else { $line = $line . $words[$j] . ' '; } } } } $fcode = $fcode . $line . "
\r\n"; } $fcode = str_replace(" ( ", "(", $fcode); $fcode = str_replace(" ) ", ")", $fcode); $fcode = str_replace(" . ", ".", $fcode); $fcode = str_replace(" ' ", "'", $fcode); $fcode = str_replace(" , ", ",", $fcode); return ">> كود visual basic : " . Trim($fcode, "\r\n") . " "; } //***************end function****************\\ //--------------------------------------------\\ //*****function for php code****\\ //********start fuction*********\\ function phpcode($code) { $code = str_replace( "<", "<", $code ); $code = str_replace( ">", ">", $code ); // $code = preg_replace( "/
|
/", "\n", $code ); $code= str_replace( "\" , "\\", $code); $code= str_replace( "'" , "'", $code); $code= str_replace( "!" , "!", $code); $code= str_replace( "$" , "$", $code); $code= str_replace( "|" , "|", $code); $code= str_replace( "&" , "&", $code); $code= str_replace( '"' , '"', $code); $code = str_replace( "™", "(tm)", $code ); $code = stripslashes($code); if (!strpos($code,""; $addedtags=1; } ob_start(); $oldlevel=error_reporting(0); highlight_string($code); error_reporting($oldlevel); if ($addedtags) { $openingpos = strpos($buffer,''); $buffer=substr($buffer, 0, $openingpos).substr($buffer, $openingpos+5, $closingpos-($openingpos+5)).substr($buffer, $closingpos+5); } $buffer = ob_get_contents(); ob_end_clean(); $buffer = str_replace(""", "\"", $buffer); return ">> كود php : " . $buffer . " "; } //***************end function****************\\ //--------------------------------------------\\ //*****function for normal code****\\ //**********start fuction**********\\ function ncode($code) { $code = stripslashes($code); return ">> كود برمجي : " . $code . " "; } function replace($text){ $search = array( '~>~', '~<~', '~"~', '~\(.+?)\~is', '~\(.+?)\~is', '~\(.+?)\~is', '~\[q](.+?)\[/q]~is', '~\[h](.+?)\[/h]~is', '~\~is', '~\(.+?)\ ~is', '~\[left](.+?)\[/p]~is', '~\[right](.+?)\[/p]~is', '~\[justify](.+?)\[/p]~is', '~\[size=([0-9]+?)](.+?)\[/size]~is', '~\(.+?)\~is', '~\[color=([^[]*)](.+?)\[/color]~is', '~\[img]([^[]*)\[/img]~i', '~\[flash=([^[]*)\[/flash]~i', '~\[icon]([^[]*)\[/icon]~i', '/(\[)(php)(])(\r\n)*(.*)(\[\/php\])/esiu', '~\r\n~', '~\[ram]([^[]*)\[/ram]~i', '~\[sound]([^[]*)\[/sound]~i', '~\[marquee-r]([^[]*)\[/marquee]~i', '~\[marquee-l]([^[]*)\[/marquee]~i', '/\[url\](http:\/\/|)(.*?)\[\/url\]/i', '/\[url=(http:\/\/|)(.*?)\](.*?)\[\/url\]/i', '/\[url\](http:\/\/|)(.*?)\[\/url\]/i', '/(\[)(code)(])(\r\n)*(.*)(\[\/code\])/esiu', "/(\[)(vbasic)(])(\r\n)*(.*)(\[\/vbasic\])/esiu" ); $replace = array( '>', '<', "'", '\\1', '\\1', '\\1', '{ \\1 }', '{ \\1 }', '\\1 ', '\\1', '\\1 ', '\\1 ', '\\1
', '\\2', '\\2', '\\2', ' ', '', ' ', "phpcode('\\5')", '
', '', '', '\\1', '\\1', "\\1\\2", "\\3", "\\1\\2", "ncode('\\5')", "vbasic('\\5')" ); $text = preg_replace($search, $replace, $text); $text = preg_replace("~
~", "
\r\n", $text); return $text; } function emptyreplace($text){ $search = array( '~\~is', '~\~is', '~\~is', '~\[q][/q]~is', '~\[h][/h]~is', '~\~is', '~\[left][/p]~is', '~\[right][/p]~is', '~\[justify][/p]~is', '~\[size=([0-9]+?)][/size]~is', '~\~is', '~\[color=([^[]*)][/color]~is', '~\[img][/img]~i', '~\[flash=[/flash]~i', '~\[icon][/icon]~i', '/(\[)(php)(])(\r\n)(\[\/php\])/esiu', '~\[ram][/ram]~i', '~\[sound][/sound]~i', '~\[marquee-r][/marquee]~i', '~\[marquee-l][/marquee]~i', '~\~is', '~\~is', '~\[vbasic][/vbasic]~is', '/(\[)(code)(])(\r\n)(\[\/code\])/esiu', "/(\[)(vbasic)(])(\r\n)(\[\/vbasic\])/esiu" ); $text = preg_replace($search, "", $text); return $text; } //***************end function****************\\ ?>
|