function _initialize() { if (false == ListMobile() && allowPhone()) { //Header("Location:http://m.ishoutou.com".$_SERVER['REQUEST_URI']); $url = "http://m.ishoutou.com" . $_SERVER['REQUEST_URI']; echo "<script language='javascript' type='text/javascript'>"; echo "window.location.href='{$url}'"; echo "</script>"; exit; } $filename = "/home/www/default/AllowList.txt"; if (file_exists($filename)) { $handle = fopen($filename, 'rb'); while (!feof($handle)) { $contxt123[] = fgetss($handle, 1024); } foreach ($contxt123 as $val) { $tt = trim($val); if (false === empty($tt)) { $tmparr[] = $tt; } } $ipadds = get_client_ip(); if (!in_array($ipadds, $tmparr)) { header('HTTP/1.1 404 Not Found'); header("status: 404 Not Found"); die('HTTP/1.1 404 Not Found'); } } $this->tempswich(); }
function thes_search(&$irc, &$data, $url, $param) { $buffer = ""; if ($fp = fsockopen("thesaurus.reference.com", 80, $errno, $errstr, 30)) { fputs($fp, "GET {$url} HTTP/1.0\r\nHost: thesaurus.reference.com\r\n\r\n"); while (!feof($fp)) { $buffer .= fgetss($fp, 1024); } fclose($fp); $this->log($irc, $data, "thes for " . $param); } else { $this->log($irc, $data, "thes for " . $param . " and socket failed : {$errstr} ({$errno})"); } $start = strpos($buffer, 'Entry:') + 6; echo substr($buffer, 0, 255); $buffer = substr($buffer, $start); echo substr($buffer, 0, 255); $end = strpos($buffer, 'Source:'); $buffer = substr($buffer, 0, $end); echo substr($buffer, 0, 255); $buffer = html_entity_decode($buffer); $buffer = str_replace("\n", ' ', $buffer); if ($buffer) { $this->talk($irc, $data, $buffer); } else { $this->talk($irc, $data, 'Search string not found'); } }
public function changePassword($mewpassword) { $ret = ""; $fp = fopen($this->remoteUrl . "/cpwd.asp?name=" . $this->userName . "&pwd=" . $this->userPassword . "&newpwd={$mewpassword}", "r"); $ret = fgetss($fp, 255); fclose($fp); return $ret; }
function doRead() { // strip HTML tags from the read line $line = fgetss($this->fp, 4096); // convert HTML entities to valid UTF-8 characters $line = String::html2utf($line); // slightly (~10%) faster than above, but not quite as accurate, and requires html_entity_decode() // $line = html_entity_decode($line, ENT_COMPAT, strtoupper(Config::getVar('i18n', 'client_charset'))); return $line; }
public static function resolveFileFromParent($collectionHandle, $path) { if (!($parentConfig = Site::getParentHostConfig())) { return false; } // get collection for parent site $collection = SiteCollection::getOrCreateRootCollection($collectionHandle, $parentConfig['ID']); $fileNode = $collection->resolvePath($path); // try to download from parent site if (!$fileNode) { $remoteURL = 'http://' . $parentConfig['Hostname'] . '/emergence/'; $remoteURL .= $collectionHandle . '/'; $remoteURL .= join('/', $path); $remoteURL .= '?accessKey=' . $parentConfig['AccessKey']; $cache = apc_fetch($remoteURL); if ($cache == '404') { return false; } //if(isset(self::$cache[$cacheKey])) { // $fp = self::$cache[$cacheKey]; //} $fp = fopen('php://memory', 'w+'); //print("Retrieving: <a href='$remoteURL' target='_blank'>$remoteURL</a><br>\n"); $ch = curl_init($remoteURL); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, true); if (!curl_exec($ch)) { throw new Exception('Failed to query parent site for file'); } if (curl_errno($ch)) { die("curl error:" . curl_error($ch)); } // write file to parent site collection fseek($fp, 0); // read status $statusLine = trim(fgetss($fp)); list($protocol, $status, $message) = explode(' ', $statusLine); if ($status != '200') { apc_store($remoteURL, '404'); return false; } // read headers while ($header = trim(fgetss($fp))) { if (!$header) { break; } list($key, $value) = preg_split('/:\\s*/', $header, 2); //print "$key=$value<br>"; } $collection->createFile($path, $fp); $fileNode = $collection->resolvePath($path); } return $fileNode; }
function readTextFromFile($file) { $file_string = ''; $handle = @fopen($file, "r"); if ($handle) { while (!feof($handle)) { $file_string .= fgetss($handle, 4096); } fclose($handle); } return $file_string; }
public static function createBoot($rootPath) { $boot = $rootPath . DIRECTORY_SEPARATOR . 'app'; static::mkdir($boot); static::mkdir($boot . '/config'); static::mkdir($boot . '/views'); if (!file_exists($boot . '/Application.php')) { copy(__DIR__ . '/init/app/Application.php', $boot . '/Application.php'); } if (!file_exists($boot . '/config/global.php')) { copy(__DIR__ . '/init/app/global.php', $boot . '/config/global.php'); } if (!file_exists($boot . '/console')) { copy(__DIR__ . '/init/app/console', $boot . '/console'); } $ignoreFile = $rootPath . '/.gitignore'; if (!file_exists($ignoreFile)) { touch($ignoreFile); } $handle = fopen($ignoreFile, "r"); $defineIgnore = []; if ($handle) { while (($buffer = fgetss($handle, 4096)) !== false) { $buffer = trim(str_replace(PHP_EOL, '', $buffer)); if (!empty($buffer)) { $defineIgnore[] = $buffer; } } fclose($handle); } $length = count($defineIgnore); if (empty($defineIgnore)) { file_put_contents($ignoreFile, <<<IGNORE /app /bin /.idea /vendor /public IGNORE ); } else { foreach ($defineIgnore as $key => $val) { foreach (['/public', '/app', '/bin', '/.idea', '/vendor'] as $index => $ignore) { if (false === @strpos($ignore, $val) && $key === $length) { file_put_contents($ignoreFile, $ignore, FILE_APPEND); } } } } }
public static function loadProperties($file) { $properties = array(); $fp = fopen($file, 'r'); while ($line = fgetss($fp)) { // clean out space and comments $line = preg_replace('/\\s*([^#\\n\\r]*)\\s*(#.*)?/', '$1', $line); if ($line) { list($key, $value) = explode('=', $line, 2); $properties[$key] = $value; } } fclose($fp); return $properties; }
/** * PUTのデータの解決 */ private function readPut() { $this->requests_ = array(); $putdata = @fopen("php://input", "r"); if ($putdata) { while (!feof($putdata)) { $line = fgetss($putdata); $tokens = split('=', $line); if (count($tokens) != 2) { continue; } $key = rawurldecode($tokens[0]); $value = rawurldecode($tokens[1]); $this->requests_ += array($key => trim($value)); } } }
public function install_tables_data($filename) { if ($this->the_plugin->verifyFileExists($filename)) { //verify file existance! global $wpdb; $file_handle = fopen($filename, "rb"); if ($file_handle === false) { return false; } while (!feof($file_handle)) { $sql = fgetss($file_handle); if ($sql === false || empty($sql) || trim($sql) == '') { continue 1; } $sql = str_replace('{wp_prefix}', $wpdb->prefix, $sql); $wpdb->query($sql); } fclose($file_handle); } return false; //return error! }
public function massSend1($mob,$content, $time, $isSub=false) { if(!$isSub){ $uid = $this->msgconfig ['sms'] ['user']; // 分配给你的账号 $pwd = $this->msgconfig ['sms'] ['pass']; // 密码 }else{ $uid = $this->msgconfig ['sms'] ['subuser']; // 分配给你的账号 $pwd = $this->msgconfig ['sms'] ['subpass']; // 密码 } $mob = $mob; // 发送号码用逗号分隔 $content = urlencode ( auto_charset ( $content, "utf-8", 'gbk' ) ); // 短信内容 // 功能:发送短信 // $time = date('YmdHi',time()); // 备用IP地址为203.81.21.13 $fp = fopen ( $this->ismsinfo ["MASSSEND_URL"] . "?name=$uid&pwd=$pwd&dst=$mob&msg=$content&time=$time", "r" ); $ret = fgetss ( $fp, 255 ); $ret = auto_charset ( $ret, "gbk", 'utf-8' ); fclose ( $fp ); $data = dealSmsResult ( $ret ); return $data; }
function getUsers() { $users = array(); //deal with users.txt if (file_exists("users.txt")) { $fileptr = fopen("users.txt", "r"); if (flock($fileptr, LOCK_EX)) { //check each user line while ($curruser = fgetss($fileptr, 512)) { //user = thing before ^, or splitusertime[0] //times = comes after ^, or splitusertime[1] //times split by | $splitusertime = explode("^", $curruser); $splittimes = explode("|", rtrim($splitusertime[1])); $users[$splitusertime[0]] = $splittimes; } } flock($fileptr, LOCK_UN); } //users are in username => list of times pair return $users; }
require 'db_connect.php'; } foreach ($files as $key => $filename) { $i = $i + 1; echo '<tr><td>' . $i . '</td><td>' . iconv('Windows-1251', 'UTF-8', $filename) . '</td>'; //распаковываем файлы в папку test if ($zip->open($dir . $filename) === TRUE) { $zip->extractTo('test/' . $filename . '/'); $zip->close(); } else { echo 'Не удалось распаковать файл' . $filename; } //достаем текст из распакованных файлов, удаляем пробелы и считаем количество символов $file = fopen('/home/localhost/www/mystats/test/' . $filename . '/word/document.xml', 'r'); while (!feof($file)) { $text = $text . fgetss($file); } fclose($file); $text_without_spaces = str_replace(' ', '', $text); $text = FALSE; //очищаем переменную $text $numb_char_without_spaces = mb_strlen($text_without_spaces, "utf-8"); echo '<td>' . $numb_char_without_spaces . '</td>'; //Добавляем данные в БД. $query = mysqli_query($dbc, 'INSERT INTO `day_stats` (`filename`, `dates`, `price`, `size`, `client`) VALUES ("' . iconv('Windows-1251', 'UTF-8', $filename) . '", "' . date('Y.m.d.') . '", "' . $price . '", "' . $numb_char_without_spaces . '", "' . $client . '")'); $totalchar += $numb_char_without_spaces; echo '<td>' . $totalchar . '</td></tr>'; } echo '</table>'; echo '<br> Итого:' . $totalchar; ?>
function extractSave($fp) { $db = connectDB(); $note = 'Note'; $note_zh = '笔记'; $bookmark = "Bookmark"; $bookmark_zh = '书签'; $loc_delimiter = 'Loc.'; $loc_delimiter_zh = '#'; $type_delimiter = '的'; $time_delimiter = '| Added on '; $time_delimiter_zh = '| 添加于 '; $bname_note = array(); $row_cnt = 0; // 读取文件内容 while (!feof($fp)) { $line = fgetss($fp); switch ($row_cnt) { case 0: $row_cnt++; $first = explode('(', $line); $bname = $first[0]; $author = $first[1]; $author = explode(')', $author); $author = trim($author[0]); break; case '1': $row_cnt++; if (!strpos($line, $time_delimiter_zh)) { $second = explode($time_delimiter, $line); $time = $second[1]; $type_loc = explode($loc_delimiter, $second[0]); $type = trim($type_loc[0], '-'); $type = trim($type); // 清除字符串中的空格和'-' $loc = trim($type_loc[1]); } else { $second_ = explode($time_delimiter_zh, $line); $time = $second_[1]; $type_loc = explode($loc_delimiter_zh, $second_[0]); $typeloc = $type_loc[1]; $tmp = explode($type_delimiter, $typeloc); $loc = trim($tmp[0]); $type = trim($tmp[1]); } break; case '2': $row_cnt++; break; case '3': $row_cnt++; $content = $line; break; case '4': $row_cnt = 0; if ($type == $note || $type == $note_zh) { $note_link = "SELECT * FROM note WHERE bookname LIKE '%" . $bname . "%'"; $note_res = $db->query($note_link); while ($row = $note_res->fetch_assoc()) { $db_loc = $row['location']; $tmp_loc = explode('-', $db_loc); $location = $tmp_loc[0]; if ($loc - $location <= 1) { if ($row['note']) { $content = $row['note'] . "\n" . $content; } $note_sql = "UPDATE note SET note = '" . addslashes($content) . "' \n \t\t\tWHERE bookname LIKE '%" . $bname . "%' AND location LIKE '%" . $db_loc . "%'"; //var_dump($note_sql); $nres = $db->query($note_sql); } } } elseif ($type != $bookmark && $type != $bookmark_zh) { $link = "INSERT INTO note (time, location, content, type, bookname, author) VALUES ('" . $time . "', '" . $loc . "', '" . $content . "', '" . $type . "', '" . $bname . "', '" . $author . "' )"; $res = $db->query($link); } break; default: break; } } }
if ($spam != "") { irc_say($sfp, $spam, $nick, $channel); //echo("-SAID: ".trim($commands[3])."\n"); } //hplay:file - Prehraje soubor if (trim($commands[2]) == "hplay") { if (is_file(trim($commands[3]))) { $rfile = fopen(trim($commands[3]), "r"); } else { fclose($rfile); $rfile = ""; } echo "-FILE: " . trim($commands[3]) . "\n"; } if ($rfile != "") { irc_say($sfp, fgetss($rfile), $nick, $channel); } //hhelp - vypise tuto napovedu if (trim($commands[2]) == "hhelp") { irc_say($sfp, "Ja jsem Harvester - vice info na: http://ircbot.wz.cz/", $nick, $channel); /* irc_say( $sfp, "Harvester - Posle vizitku", $nick, $channel ); irc_say( $sfp, "hhelp - vypise tuto napovedu", $nick, $channel ); irc_say( $sfp, "hsay:Message - Posle zpravu", $nick, $channel ); irc_say( $sfp, "hpsay:to:Message - Posle soukromou zpravu kanalu nebo osobe", $nick, $channel ); irc_say( $sfp, "hdo:Command - Posle serveru prikaz", $nick, $channel ); irc_say( $sfp, "hmove:Channel - Pripoji do kanalu / Zmeni aktivni kanal", $nick, $channel ); irc_say( $sfp, "/invite Harvester #channel - Pozve a pripoji bota do kanalu", $nick, $channel ); irc_say( $sfp, "hpart:Channel - Odpoji se z kanalu", $nick, $channel ); irc_say( $sfp, "hjoke - Posle \"nahodny\" vtip", $nick, $channel ); */
/** * @param string $sText * @return mixed array with command output or false. */ function proc_open_spell($sText) { $descriptorspec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')); if ($this->debug) { $spell_proc = proc_open($this->spell_command, $descriptorspec, $pipes); } else { $spell_proc = @proc_open($this->spell_command, $descriptorspec, $pipes); } if (!is_resource($spell_proc)) { return $this->set_error(sprintf(_("Could not run the spellchecker command (%s)."), $this->spell_command)); } if (!@fwrite($pipes[0], $sText)) { $this->set_error(_("Error while writing to pipe.")); // close all three $pipes here. for ($i = 0; $i <= 2; $i++) { // disable all fclose error messages @fclose($pipes[$i]); } return false; } fclose($pipes[0]); $sqspell_output = array(); for ($i = 1; $i <= 2; $i++) { while (!feof($pipes[$i])) { array_push($sqspell_output, rtrim(fgetss($pipes[$i], 999), "\r\n")); } fclose($pipes[$i]); } if (proc_close($spell_proc)) { $error = ''; foreach ($sqspell_output as $line) { $error .= $line . "\n"; } return $this->set_error($error); } else { return $sqspell_output; } }
<?php header('content-type:text/html;charset=utf-8'); $filename = 'readme.txt'; // 打开文件句柄 $handle = fopen($filename, 'r'); while (!feof($handle)) { echo trim(fgetss($handle)), '<br/>'; } // 关闭文件句柄 fclose($handle);
/** * 获取一行内容,过滤html php标签 * * @param string $file * @param string $length * @param string $allow_tags * @return string */ public function getss($file, $length = null, $allow_tags = '') { return fgetss($this->handle($file), $length, $allow_tags); }
$thumbdir = rtrim('photos/' . $requestedDir, '/'); $currentdir = GALLERY_ROOT . $thumbdir; guardAgainstDirectoryTraversal($currentdir); //----------------------- // READ FILES AND FOLDERS //----------------------- $files = array(); $dirs = array(); $img_captions = array(); if (is_dir($currentdir) && ($handle = opendir($currentdir))) { // 1. LOAD CAPTIONS $caption_filename = "{$currentdir}/captions.txt"; if (is_readable($caption_filename)) { $caption_handle = fopen($caption_filename, "rb"); while (!feof($caption_handle)) { $caption_line = fgetss($caption_handle); if (empty($caption_line)) { continue; } list($img_file, $img_text) = explode('|', $caption_line); $img_captions[$img_file] = trim($img_text); } fclose($caption_handle); } while (false !== ($file = readdir($handle)) && !in_array($file, $SkipObjects)) { // 2. LOAD FOLDERS if (is_dir($currentdir . "/" . $file)) { if ($file != "." && $file != "..") { checkpermissions($currentdir . "/" . $file); // Check for correct file permission // Set thumbnail to folder.jpg if found:
file_put_contents($filename, $string_with_tags); $file_handle = fopen($filename, $file_modes[$mode_counter]); if (!$file_handle) { echo "Error: failed to open file {$filename}!\n"; exit; } // rewind the file pointer to beginning of the file var_dump(filesize($filename)); var_dump(rewind($file_handle)); var_dump(ftell($file_handle)); var_dump(feof($file_handle)); /* rewind the file and read the file line by line with allowable tags */ echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; rewind($file_handle); $line = 1; while (!feof($file_handle)) { echo "-- Line {$line} --\n"; $line++; var_dump(fgetss($file_handle, 80, "<test>, <html>, <?>")); var_dump(ftell($file_handle)); // check the file pointer position var_dump(feof($file_handle)); // check if eof reached } // close the file fclose($file_handle); // delete the file delete_file($filename); } // end of for - mode_counter echo "Done\n";
private function display_story($id) { $path = $this->home . "/articles/{$id}/{$id}.art"; $text = ""; $file = fopen($path, 'r'); $words = 0; if ($file) { while (!feof($file)) { $temp = fgetss($file); $temp = htmlspecialchars_decode($temp); //$temp= html_entity_decode($temp); $temp = preg_replace("/ /", "", $temp); $temp = preg_replace("/&asymp/", "", $temp); $temp = preg_replace("/&scaron/", "", $temp); $temp = preg_replace("/[\n\\s;]+/", " ", $temp); $text .= $temp; $words += str_word_count($temp); if ($words > 50) { break; } } fclose($file); } /* echo "<span class='article_name'>".$this->articles[$id]['name']."</span></br>"; echo "<span class='article_type'>(Reportáž)</span>"; echo "<span class='article_date'>".$this->articles[$id]['day']."</span></br>"; echo "<span class='article_description'>".trim($text)." ...[viac]</span></br>"; */ $this->display_article_desc($id, "Reportáž", trim($text)); }
<?php $file = dirname(__FILE__) . '/foo.html'; file_put_contents($file, 'text 0<div class="tested">text 1</div>'); $handle = fopen($file, 'r'); $object = new SplFileObject($file); var_dump($object->fgetss()); var_dump(fgetss($handle)); error_reporting(0); unlink(dirname(__FILE__) . '/foo.html');
/** * Read a line from the file starting at the file pointer. The file handle must be opened. * This method attempts to strip HTML, PHP tags and NUL bytes. * Reading ends when the maximum number of bytes is read, if specified by $length. * Reading ends when a new line is reached (the new line character is included in the output). * Reading ends when the end of the file is reached. * This method is binary safe. * * @param int|null $length [optional] Specifies the maximum number of bytes to read, * null to disable a maximum length. * @param string $allowTags [optional] A list of allowed tags, which shouldn't be stripped by this method. * Whitespaces aren't allowed, and tags are case-insensitive. * * @return string|null The read data, or null if the end of the file was reached or if an error occurred. */ public function getLineStripped($length = null, $allowTags = '') { // Read the line with stripped tags, return null if an error occurs if (($out = fgetss($this->handle, $length, $allowTags)) === false) { return null; } // Return the read data return $out; }
/** * reads a url or file and strips the HTML-tags AND removes all * empty lines. * This is used to read plain-text out of a HTML-page * * @param string $url: * URL to load * @return the content */ public function getStrippedURL($url) { $content = ''; if ($fd = fopen($url, "rb")) { while (!feof($fd)) { $line = fgetss($fd, 5000); if (trim($line)) { $content .= trim($line) . LF; } } fclose($fd); } return $content; }
// write log utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'stock_take', $_SESSION['realname'] . ' upload stock take file ' . $upload->new_filename); // open file $stfile = @fopen(FILES_UPLOAD_DIR . $upload->new_filename, 'r'); if (!$stfile) { echo '<script type="text/javascript">' . "\n"; echo 'parent.$(\'#stUploadMsg\').html(\'Failed to open stock take file ' . $upload->new_filename . '. Please check permission for directory ' . FILES_UPLOAD_DIR . '\')'; echo '.toggleClass(\'errorBox\').css( {\'display\': \'block\'} );' . "\n"; echo '</script>'; exit; } // start loop $i = 0; while (!feof($stfile)) { $curr_time = date('Y-m-d H:i:s'); $item_code = fgetss($stfile, 512); $item_code = trim($item_code); if (!$item_code) { continue; } // check item status first $item_check = $dbs->query("SELECT * FROM stock_take_item WHERE item_code='{$item_code}'"); $item_check_d = $item_check->fetch_assoc(); if ($item_check->num_rows > 0) { if ($item_check_d['status'] == 'l') { // record to log utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'stock_take', 'Stock Take ERROR : Item ' . $item_check_d['title'] . ' (' . $item_check_d['item_code'] . ') is currently ON LOAN (from uploaded file ' . $upload->new_filename . ')'); continue; } else { if ($item_check_d['status'] == 'e') { continue;
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Пример fgetss</title> </head> <body> <?php if ($myFile = fopen('data.html', 'r')) { $lines = array(); while ($myLine = fgetss($myFile, 1024, '<br />')) { $lines[] = $myLine; } fclose($myFile); echo '<pre>'; print_r($lines); echo '</pre>'; } ?> </body> </html>
$a_filesInFolder[$i_fileIndex] = $filesInFolder; echo "<a href=\"http://dev4.youcontrol.com.ua/jude/html-files/" . $a_filesInFolder[$i_fileIndex] . "\" target=\"_blank\">" . $a_filesInFolder[$i_fileIndex] . "</a><br>"; // Відкриваємо файл для поміщення в нього тег для кодування файлу в utf-8 $forTagOpen = fopen($pathToFolder . $a_filesInFolder[$i_fileIndex], "r+"); $writeMetaTagInFile = fwrite($forTagOpen, "\n<br><head><meta charset=\"utf-8\"></head><br>\n "); fclose($forTagOpen); // Відкриваємо файл для прочитання, і створюємо за такою ж назвою текстовий файл в іншій папці $fileForRead = fopen($pathToFolder . $a_filesInFolder[$i_fileIndex], "r"); // $fileForWrite = fopen('/usr/home/sites/app/jude/txt/'.$a_filesInFolder[$i_fileIndex].'.txt', "w+"); $flagForPlaintiff = 0; $flagForDefendant = 0; $er = 0; // Читаємо кожний рядок файлу while (!feof($fileForRead)) { // Пропускаємо через фільтри рядок, для отримання у потрібному вигляді $f_spacesDelete = trim(str_replace(" ", ' ', fgetss($fileForRead))); $f_quotesAndComa = str_replace('",', '"', $f_spacesDelete); $f_substituteQuotes1 = str_replace('"', '«', str_replace('в"я', ' ! ', $f_quotesAndComa)); $f_substituteQuotes1 = str_replace('"', '«', str_replace('б"є', 'б_є', $f_quotesAndComa)); $f_substituteQuotes2 = str_replace("»", '«', $f_substituteQuotes1); $a_quotesForChange = array(""", "„", """, "«", "„", "»", "«", "»", "″", "„", "”", "“", "«1.", "\\„"); $i_quotes = 0; for ($i_quotes = 0; $i_quotes < count($a_quotesForChange); $i_quotes++) { $f_substituteQuotes2 = str_replace($a_quotesForChange[$i_quotes], '« ', $f_substituteQuotes2); } $f_endContent = str_replace("представника позивача", ' ', $f_substituteQuotes2); // Масив різновидів слів визначаючих позивача $a_plaintiff = array("за позовом", "позовом", "Позивач", "за позовною заявою", "позивач", "заяву", "позов", "заява", "заявою", "за апеляційною скаргою", "за поданням"); // Масив різновидів вживаних видів прав власності витягуємо з файла include_once '/usr/home/sites/app/jude/a_ownership.php'; // include_once('a_ownership.php');
if ($result->num_rows > 1) { header("location: ../Accounts/login.phtml?error=Sorry, we had an internal server error."); } else { if ($result->num_rows == 0 || $itemCod[0] == "") { echo "<tr><td colspan=5>Any item yet</td></tr>"; } else { sort($itemCod); $limit = count($itemCod); $j = 0; for ($j = 0; $j <= $limit - 1; $j++) { $file = fopen($path . $itemCod[$j] . ".txt", "r"); //SECURITY: Here i have a problem, it doesn't check for EOF $itemArray["cod"] = $itemCod[$j]; $itemArray["name"] = fgetss($file); $itemArray["type"] = fgetss($file); $itemArray["subtype"] = fgetss($file); $itemArray["attributes"] = fgetss($file); echo "<tr><td>" . $itemArray['cod'] . "</td><td>" . $itemArray['name'] . "</td><td>" . $itemArray['type'] . "</td><td>" . $itemArray['subtype'] . "</td><td>" . $itemArray['attributes'] . "</td></tr>"; fclose($file); } } } } else { echo "Error, try to reload the page"; } } //<tr><td>1</td><td>Sedenta por sangue</td><td>Equipamento</td><td>Espada</td><td>Roubo de vida +30</td></tr> ?> </table> </body> </html>
// 1 UNKNOWN require 'config.php'; if (!isset($sql_file)) { $sql_file = 'build.sql'; } $sql_fh = fopen($sql_file, 'r'); if ($sql_fh === false) { echo 'ERROR: Cannot open SQL build script ' . $sql_file . "\n"; exit(1); } $connection = mysql_connect($config['db_host'], $config['db_user'], $config['db_pass']); if ($connection === false) { echo 'ERROR: Cannot connect to database: ' . mysql_error() . "\n"; exit(1); } $select = mysql_select_db($config['db_name']); if ($select === false) { echo 'ERROR: Cannot select database: ' . mysql_error() . "\n"; exit(1); } while (!feof($sql_fh)) { $line = fgetss($sql_fh); if (!empty($line)) { $creation = mysql_query($line); if (!$creation) { echo 'WARNING: Cannot execute query (' . $line . '): ' . mysql_error() . "\n"; } } } fclose($sql_fh); require 'includes/sql-schema/update.php';
function gzgetss($fp, $len, $allowedtags = "") { return fgetss($fp, $len, $allowedtags); }