%PDF- %PDF-
| Direktori : /www/varak.net/www.varak.net/texts/ |
| Current File : /www/varak.net/www.varak.net/texts/insert.php |
<?php
/*$spojeni = mysql_connect("localhost", "waritko", "blade666");
mysql_select_db("test", $spojeni);
mysql_query("set names 'latin2'");
$nazev = $_POST['nazev'];
$text = nl2br($_POST['text']);
mysql_query("insert into texts(id, nazev, text) values(NULL, '$nazev', '$text')", $spojeni);
header("Location: index.html");
mysql_close($spojeni);*/
//$txt = explode("\n", $_POST['text']);
//file_put_contents("in.txt", $_POST['text'] );
$txt = file("in.txt");
$out = "";
$bl = 1;
foreach($txt as $line)
{
if(trim($line) == "")
{
if($bl) continue;
$out .= "\n\n";
$bl = 1;
continue;
}
if(preg_match("/\*[0-9]*\*/", $line)) continue;
if(!$bl)
{
$out .= " ";
}
$out .= trim($line);
$bl = 0;
}
file_put_contents("out.txt", $out);
//header("Location: index.html");
?>