Location: PHPKode > projects > PuszForum > puszforum/php/phpwritten.php
<?
function zamien($tabela)
{
for($i=0; $i< count($tabela);$i++)
	{
	$tabela2[$i] = strip_tags($tabela[$i]);
	$tabela2[$i] = eregi_replace("\"","&quot;", $tabela2[$i]);
	$tabela2[$i] = eregi_replace("\n","<br>", $tabela2[$i]);
	$tabela2[$i] = eregi_replace("\'","&acute;", $tabela2[$i]);
	$tabela2[$i] = eregi_replace(";","#srednik#", $tabela2[$i]);
	$tabela2[$i] = eregi_replace("\n","#koniec#", $tabela2[$i]);
	$tabela2[$i] = stripslashes($tabela2[$i]);
	}
return $tabela2;
}

list($autor, $tresc,$temat) = zamien(array($autor, $tresc,$temat));

$data = date("Y-m-d G:i:s");

$plik = "data/mails.txt";
$conn = connect_pb($plik);
if($conn != 0) $maxlist = max($conn["id"]) + 1; else $maxlist = 1;



if($coto == "list")
	{
	insert_pb ($plik,"$maxlist;$nagl #naglowek# $tresc;$idtem;$autor;$data;");

	$plik = "data/topics.txt";
	$conn = connect_pb($plik);
	$wynik = select_pb($conn,"id","x == '$idtem'"); 
	$nowailosc = $wynik["ilosc"][0] + 1; 

	update_pb ($plik,"id","x == '$idtem'","ilosc","$nowailosc"); 

	$wroc = "mails.php?idkat=$idkat&idtem=$idtem";
	}

if($coto == "temat" )
	{
	
	$conn = connect_pb($plik);
	if($conn !=0) $maxtemat = max($conn["id"]) + 1; else $maxtemat =1;
	
	$plik = "data/mails.txt";
	insert_pb ($plik,"$maxlist;$tresc;$maxtemat;$autor;$data;pierwszy;");
	
	if(strlen($temat)<2) $temat = "Bez tematu";

	$plik = "data/topics.txt";
	insert_pb ($plik,"$maxtemat;$temat;1;$idkat;$data;");

	$wroc = "topics.php?idkat=$idkat";	
	}


?>
Return current item: PuszForum