Jump to content
php.lv forumi

Paliiidziiet! Plzz!


ultradog

Recommended Posts

Guest noisex

mnjaa..viss kas ir specinats ar opensource, shaja gadijuma ar NUKE engini...ir pilnigs shits..nespesi lapit caurumus ciet..piekam saprotu tu no php ne bu ne mee, tad nu vel lielaks vuernible pasakums iepsjems...labaak tad jau iemwcies uztaisit kaut vai 1u formu ar ieraxtishanu ieksh txt faila un tad output displejoshanu. Tatad. lai uztaisit kaut ko tadu: tiek izmantoti sekojoshi faili: submit.html. kur ir forma ar value=zinja, un post=news.php, tad ieksh ta news.php ir scripts, kursh apstradaat doto value=zinja un iebaxta to ieksh news.txt, kas tiek izmantots ka DB, tad nakamais fails laiakm jau bus, kas izvadis uz ekrana visu infu no taa news.txt, pimeram index.php

Forma

<code><font color="#000000">

<form method="POST" action="news.php">
			<font face="Verdana" size="2"> 
			<textarea rows="10" name="zinja">te tu vari kaut ko raxtiit</textarea>
			</font> 
			<p> 
			  <input type="submit" value="Send" name="stanb">
			  <input type="reset" value="Reset" name="B2">
			  <font face="Verdana" size="2"> </font></p>
		  </form>
</font>
</code>

 

datu apstrade

<code><font color="#000000">

<font color="#0000CC"><?
$zinja </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/str_replace]str_replace[/url]</font><font color="#006600">(</font><font color="#0000CC">[url=http://lv.php.net/chr]chr[/url]</font><font color="#006600">(</font><font color="#0000CC">10</font><font color="#006600">), </font><font color="#CC0000">"
"</font><font color="#006600">, </font><font color="#0000CC">$zinja</font><font color="#006600">);
</font><font color="#0000CC">$rinda </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/wordwrap]wordwrap[/url]</font><font color="#006600">( </font><font color="#0000CC">$zinja</font><font color="#006600">, </font><font color="#0000CC">38</font><font color="#006600">, </font><font color="#CC0000">"n"</font><font color="#006600">, </font><font color="#0000CC">1</font><font color="#006600">);

</font><font color="#FF9900">//$new=ereg_replace('&', '&', ereg_replace('"','"', ereg_replace('<', '<', ereg_replace('>', '>', ereg_replace(''', 'as', $rinda)))));	 
</font><font color="#0000CC">$new</font><font color="#006600">=</font><font color="#0000CC">[url=http://lv.php.net/str_replace]str_replace[/url]</font><font color="#006600">(</font><font color="#CC0000">'[]'</font><font color="#006600">,</font><font color="#CC0000">'•'</font><font color="#006600">, </font><font color="#0000CC">[url=http://lv.php.net/str_replace]str_replace[/url]</font><font color="#006600">(</font><font color="#0000CC">[url=http://lv.php.net/chr]chr[/url]</font><font color="#006600">(</font><font color="#0000CC">92</font><font color="#006600">),</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#0000CC">[url=http://lv.php.net/preg_replace]preg_replace[/url]</font><font color="#006600">(</font><font color="#CC0000">"/((http(s?)://)|(www.))([S.]+)/i"</font><font color="#006600">, </font><font color="#CC0000">'<a href="http3://45">245</a>'</font><font color="#006600">,</font><font color="#0000CC">$zinja</font><font color="#006600">)));
</font><font color="#0000CC">$filewrite </font><font color="#006600">= </font><font color="#CC0000">"sitenews.txt"</font><font color="#006600">;
</font><font color="#0000CC">$line1 </font><font color="#006600">= </font><font color="#CC0000">"<b>"</font><font color="#006600">.</font><font color="#0000CC">date </font><font color="#006600">(</font><font color="#CC0000">"d  F m, Y - H:i"</font><font color="#006600">).</font><font color="#CC0000">"</b>
n"</font><font color="#006600">;
</font><font color="#0000CC">$line2 </font><font color="#006600">= </font><font color="#0000CC">$new</font><font color="#006600">.</font><font color="#CC0000">"
n"</font><font color="#006600">;
</font><font color="#0000CC">$line3 </font><font color="#006600">= </font><font color="#CC0000">"
n"</font><font color="#006600">;
</font><font color="#0000CC">$filesize </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/filesize]filesize[/url]</font><font color="#006600">(</font><font color="#CC0000">"news.txt"</font><font color="#006600">); 
</font><font color="#0000CC">$file </font><font color="#006600">= </font><font color="#0000CC">fopen </font><font color="#006600">(</font><font color="#CC0000">"$filewrite"</font><font color="#006600">, </font><font color="#CC0000">"r"</font><font color="#006600">);
</font><font color="#0000CC">$buffer </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/fread]fread[/url]</font><font color="#006600">(</font><font color="#0000CC">$file</font><font color="#006600">,</font><font color="#0000CC">$filesize</font><font color="#006600">);

</font><font color="#0000CC">$file </font><font color="#006600">= </font><font color="#0000CC">fopen </font><font color="#006600">(</font><font color="#CC0000">"$filewrite"</font><font color="#006600">, </font><font color="#CC0000">"w"</font><font color="#006600">);

</font><font color="#0000CC">$string </font><font color="#006600">= </font><font color="#CC0000">"$line1 $line2 $line3"</font><font color="#006600">;
</font><font color="#0000CC">fputs </font><font color="#006600">(</font><font color="#0000CC">$file</font><font color="#006600">,</font><font color="#CC0000">"$string n $buffer"</font><font color="#006600">);
</font><font color="#0000CC">fclose </font><font color="#006600">(</font><font color="#0000CC">$file</font><font color="#006600">);

</font><font color="#0000CC">$readnews </font><font color="#006600">= </font><font color="#CC0000">"index.php"</font><font color="#006600">;
</font><font color="#0000CC">header </font><font color="#006600">(</font><font color="#CC0000">"Location: "</font><font color="#006600">.</font><font color="#0000CC">$readnews</font><font color="#006600">.</font><font color="#CC0000">""</font><font color="#006600">);
exit;				 

</font><font color="#0000CC">?>
</font>
</font>
</code>

 

datu displejoshana

<code><font color="#000000">

<font color="#0000CC"><?
$filename </font><font color="#006600">= </font><font color="#CC0000">"news.txt"</font><font color="#006600">;
</font><font color="#0000CC">$fd </font><font color="#006600">= </font><font color="#0000CC">fopen </font><font color="#006600">(</font><font color="#0000CC">$filename</font><font color="#006600">, </font><font color="#CC0000">"rb"</font><font color="#006600">);
</font><font color="#0000CC">$contents </font><font color="#006600">= </font><font color="#0000CC">fread </font><font color="#006600">(</font><font color="#0000CC">$fd</font><font color="#006600">, </font><font color="#0000CC">filesize </font><font color="#006600">(</font><font color="#0000CC">$filename</font><font color="#006600">));
print(</font><font color="#0000CC">$contents</font><font color="#006600">);
</font><font color="#0000CC">fclose </font><font color="#006600">(</font><font color="#0000CC">$fd</font><font color="#006600">);
</font><font color="#0000CC">?>
</font>
</font>
</code>

 

njem par labu sho mazo engini :)))

bet nu galvenajaa taja news.php ir apskataams piemeeraa:

Link to comment
Share on other sites

  • 2 years later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...