Университетская электронная библиотека.
www.infoliolib.info
EOD; $banner[]= <<
Самые свежие новости со всего мира. Мы работаем для вас 24 часа в сутки.
www.24da.ru
Регистрация доменов RU, SU от 150 рублей. Прогрессивные скидки.
www.direg.ru
EOT; //$set=rand(1,10); //$banner = ($set == 1) ? $2_banner : $1_banner; $set=rand(1,2); $bannert = $banner[$set-1]; //$ssp=banner2(); $ssp=""; return "
".$bannert."".$ssp."
"; //return ""; } function banner2(){ if (!defined('_SAPE_USER')){ define('_SAPE_USER', 'fb1504b60f1800342587b50e6e9a7a7b'); } require_once($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'); $o['charset']="UTF-8"; $sape = new SAPE_client($o); unset($o); $banner = "".$sape->return_links(); return $banner; } ?> open("$zip_file"); if ($ret === TRUE) { for ($i=0; $i<$za->numFiles;$i++) { $old_name=$za->getNameIndex($i); $new_name=str_replace("bestref","materstudiorum.ru",$old_name); $za->renameName($old_name,$new_name); } $za->setArchiveComment(' http://www.materstudiorum.ru/'); $za->close(); tolog($zip_file); } } function tolog($str){ $hndl=fopen("./log.txt", "a"); $dt=date("Y-m-d H:i:s"); fwrite($hndl, $dt." >> ".$str."\n"); fclose($handle); } ?>"; // insert message if(isset($message) and $captcha==$_SESSION["capch"]){ unset($_SESSION["capch"]); $s=("INSERT INTO `comments` SET `date`='$date', `ip`='$ip', `page_url`='$page_url', `name`='$name', `email`='$email', `message`='$message', `status`='$status'"); mysql_query($s) or die(mysql_error()); if($status==1){ $_SESSION["mess"]="Ваше сообщение успешно отправлено!"; } else{ $_SESSION["mess"]="Ваше сообщение отправлено и ожидает проверки администратором!"; } /* $comret.= ""; */ header ("Location: $page_url#mess"); exit; } else { //$_SESSION["mess"]="Произошла ошибка!"; } // get all comments for some page $i=0; $messages=""; $res=mysqli_query($dbh,"SELECT * FROM `comments` WHERE `page_url`='$page_url' and `status`=1 ORDER BY `date` ASC"); while($row = mysqli_fetch_array($res)){ if(strlen($row["email"])>4){$eml="".$row["name"]."";} else {$eml="".$row["name"]."";} $messages.="
".$row["date"]." ".$eml."

".$row["message"]."

"; $i++; } if($i===0) { $messages="
Нет комментариев.
"; } $comret.= "
"; $comret.= $messages.""; if(isset($_SESSION["mess"])){ $comret.= "".$_SESSION["mess"]."
"; unset($_SESSION["mess"]); } else { $comret.= "


Оставить комментарий:

Ваше Имя:
Email:
Антибот:  
Ваш комментарий:  
"; } $comret.= "
"; return $comret; } //return image function capch_img($keyc=""){ $key = $_SESSION["capch"]; $count=strlen($key); $iw=$count*10; $im = ImageCreate($iw+4, 22); $background_color = ImageColorAllocate($im, 255, 255, 255); $text_color = ImageColorAllocate($im, 233, 14, 91); $color = ImageColorAllocate($im,0,0,0); ImageRectangle($im,0,0,imageSX($im)-1,imageSY($im)-1,$color); ImageString($im, 5, 4, 4, $key, $text_color); header("Content-type: image/png"); ImagePNG($im); } ?> LoadFile("bginfo.doc"); Function: GetPlainText Input: Contents of a valid MS Word 97/2000/XP/2003 or RTF file. Returns: Plain text generated on the basis of the input contents. Notes: The function automatically detects the format of the file and converts it accordingly. Returns FALSE on failure to identify the contents as valid. Example: $plaintext = $phpwordlib->GetPlainText(&$contents); */ class PHPWordLib { function LoadFile1($filename) { $f = fopen($filename, "rb"); $contents = fread($f, filesize($filename)); fclose($f); if (!$this->CheckWordFormat($contents)) $isWord = FALSE; else $isWord = TRUE; if (!$this->CheckRTFFormat($contents)) $isRTF = FALSE; else $isRTF = TRUE; if (!$isWord && !$isRTF) return FALSE; else return $contents; } function LoadFile($filecontent) { $contents = $filecontent; if (!$this->CheckWordFormat($contents)) $isWord = FALSE; else $isWord = TRUE; if (!$this->CheckRTFFormat($contents)) $isRTF = FALSE; else $isRTF = TRUE; if (!$isWord && !$isRTF) return FALSE; else return $contents; } function CheckWordFormat(&$contents) { // This function checks the format of the file. Currently only MS Word 97/2000/XP/2003/... (Windows) format using ANSI character set is supported, so for now we will return false on all others! if (ord($contents[512]) != 236 && ord($contents[513]) != 165) return FALSE; if (ord($contents[530]) != 0) return FALSE; if (ord($contents[532]) > 0) return FALSE; if (ord($contents[546]) != 98 && ord($contents[547]) != 106) return FALSE; return TRUE; } function CheckRTFFormat(&$contents) { // This function checks whether the format of the file is RTF (Rich Text Format). Currently supported version is up to 1.5 if (substr($contents, 0, 6) == '{\rtf1') return TRUE; else return FALSE; } function GetWordPlainText(&$contents) { // This function will return the text of a MS Word document in a plain text format. Note: This will only get the main text for now, no text boxes, etc. $s1 = (ord($contents[536]) + (ord($contents[537]) << 8) + (ord($contents[538]) << 16) + (ord($contents[539]) << 24)) + 512; $s2 = (ord($contents[540]) + (ord($contents[541]) << 8) + (ord($contents[542]) << 16) + (ord($contents[543]) << 24)) + 512; if ($s2 > $s1) { $plaintext = substr($contents, $s1, $s2-$s1); //echo iconv("UTF-8", "cp1251", $plaintext); //echo $plaintext; $ss1 = strpos($plaintext, chr(19)); if ($ss1) { $ss2 = strpos($plaintext, chr(21), $ss1); $plaintext = substr_replace($plaintext, '', $ss1, $ss2-$ss1+1); } $plaintext = str_replace(chr(0), "", $plaintext); $plaintext = str_replace(chr(1), "", $plaintext); $plaintext = str_replace(chr(2), "", $plaintext); $plaintext = str_replace(chr(3), "", $plaintext); $plaintext = str_replace(chr(4), "", $plaintext); $plaintext = str_replace(chr(5), "", $plaintext); $plaintext = str_replace(chr(6), "", $plaintext); $plaintext = str_replace(chr(7), " ", $plaintext); $plaintext = str_replace(chr(8), "", $plaintext); $plaintext = str_replace(chr(11), "\n", $plaintext); $plaintext = str_replace(chr(12), "\n\n", $plaintext); $plaintext = str_replace(chr(13), "\n", $plaintext); $plaintext = str_replace(chr(14), " ", $plaintext); $plaintext = str_replace(chr(15), "", $plaintext); $plaintext = str_replace(chr(16), "", $plaintext); $plaintext = str_replace(chr(17), "", $plaintext); $plaintext = str_replace(chr(18), "", $plaintext); $plaintext = str_replace(chr(20), " ", $plaintext); $plaintext = str_replace(chr(22), "", $plaintext); $plaintext = str_replace(chr(23), "", $plaintext); $plaintext = str_replace(chr(24), "", $plaintext); $plaintext = str_replace(chr(25), "", $plaintext); $plaintext = str_replace(chr(26), "", $plaintext); $plaintext = str_replace(chr(27), "", $plaintext); $plaintext = str_replace(chr(28), "", $plaintext); $plaintext = str_replace(chr(29), "", $plaintext); $plaintext = str_replace(chr(30), "", $plaintext); $plaintext = str_replace(chr(31), "-", $plaintext); $plaintext = str_replace(chr(160), " ", $plaintext); //rus $plaintext = str_replace(chr(48), "", $plaintext); $plaintext = str_replace(chr(49), "", $plaintext); $plaintext = str_replace(chr(50), "", $plaintext); $plaintext = str_replace(chr(51), "", $plaintext); $plaintext = str_replace(chr(52), "", $plaintext); $plaintext = str_replace(chr(53), "", $plaintext); $plaintext = str_replace(chr(54), "", $plaintext); $plaintext = str_replace(chr(55), "", $plaintext); $plaintext = str_replace(chr(56), "", $plaintext); $plaintext = str_replace(chr(57), "", $plaintext); $plaintext = str_replace(chr(68), "", $plaintext); //chr(hexdec("\\1") return $plaintext; } else return false; } function ExtractRTFBlock($blockname) { global $contents; $blockname = '{\\' . $blockname; $s1 = strpos($contents, $blockname); $s2 = strpos($contents, '}}', $s1); return substr($contents, $s1, $s2-$s1+1); } function RemoveRTFBlock($blockname) { global $contents; $blockname = '{\\' . $blockname; $s1 = strpos($contents, $blockname); $s2 = strpos($contents, '}}', $s1); $part1 = substr($contents, 0, $s1-1); $part2 = substr($contents, $s2+1); return $part1 . $part2; } function GetRTFPlainText(&$contents) { $s1 = strpos($contents, '{', 1); $rtf_header = substr($contents, 0, $s1); if (substr($rtf_header, 0, 6) == '{\rtf1') $rtf_version = 1; else return FALSE; //echo $contents; if (strpos($rtf_header, '\ansi')) $rtf_charset = 'ansi'; if (strpos($rtf_header, '\mac')) $rtf_charset = 'mac'; if (strpos($rtf_header, '\pc')) $rtf_charset = 'pc'; $count = preg_match_all("(\\\ansicpg([0-9]+))", $rtf_header, $res); if ($count > 0) $rtf_codepage = $res[1][0]; $count = preg_match_all("(\\\uc([0-9]{1}))", $rtf_header, $res); if ($count > 0) $rtf_unicodebytes = $res[1][0]; $count = preg_match_all("(\\\deflang([0-9]+))", $rtf_header, $res); if ($count > 0) $rtf_deflang = $res[1][0]; $count = preg_match_all("(\\\deflangfe([0-9]+))", $rtf_header, $res); if ($count > 0) $rtf_deflangfe = $res[1][0]; $contents = $this->RemoveRTFBlock('fonttbl'); $contents = $this->RemoveRTFBlock('colortbl'); $info_block = $this->ExtractRTFBlock('info'); $contents = $this->RemoveRTFBlock('info'); $s1 = 1; while ($s1 > 0) { $contents = $this->RemoveRTFBlock('*'); $s1 = strpos($contents, '\*'); } $plain_text = $contents; $plain_text = str_replace("\n", "", $plain_text); $plain_text = str_replace("\r", "", $plain_text); $plain_text = str_replace('\pard', "\dummy", $plain_text); $plain_text = preg_replace("(arsid([0-9]+))", "", $plain_text); $plain_text = preg_replace("(http://(.+) )", "", $plain_text); $plain_text = preg_replace("(Width([0-9]+))", "", $plain_text); $plain_text = preg_replace("(Width([A-Z][0-9]))", "", $plain_text); $plain_text = preg_replace("/(\\\\'([0-9a-zA-Z]*))/e", 'chr(hexdec("\\1"))', $plain_text); // Convert hexdecimal symbols into letters $plain_text = preg_replace("(\\\par([ ]){0,1})", "\n", $plain_text); // Convert \par to \n $plain_text = preg_replace("(\\\(sn|sv)+([a-zA-Z0-9 -:_\\\\])*([ ]){0,1})", "", $plain_text); // Clean up all unused control symbols $plain_text = preg_replace("(\\\([a-z])+([-0-9])*([ ]){0,1})", "", $plain_text); // Clean up all unused control symbols $plain_text = str_replace("{", "", $plain_text); $plain_text = str_replace("}", "", $plain_text); $plain_text = str_replace(" ", " ", $plain_text); return $plain_text; } function GetPlainText(&$contents) { if ($this->CheckWordFormat($contents)) return $this->GetWordPlainText($contents); if ($this->CheckRTFFormat($contents)) return $this->GetRTFPlainText($contents); return FALSE; } } ?>