Fragment index.php
<div id="okladka2"> <iframe src="komenty.php" width="168px" height="300px" frameborder="0">not</iframe> <form action="" method="post"> Ksywka: <input type="text" name="ksywka" style="width:170px" /> <br>Tresc: <input type="text" name="tresc" style="width:170px" /> <br><select name="grupa"><option checked="yes">Internauta</option></select> <p align="right"> <input type="submit" value='' style='background:url(grafika/ok.gif); border:0; height:10px; width:50px' /> </p> <?php $nazwa = $_POST['ksywka']; $tresc = $_POST['tresc']; $grupa = $_POST['grupa']; if($ksywka and $tresc and $grupa) { require "connection.php"; connection(); $ins = @mysql_query("INSERT INTO komentarze SET id=null, ksywka='".$ksywka."', tresc='".$tresc."', grupa='".$grupa."';"); } ?> </form> </div>
komenty.php
<?php require "connection.php"; connection(); if ($r['grupa'] == "admin") { echo "<div id='wiersz'><img src='grafika/kropka2.gif'><font color='#49b23b'><b>".$r['ksywka']." napisał(a): </b>".htmlspecialchars($r['tresc'])."</font></div><br>"; } else { echo "<div id='wiersz'><img src='grafika/kropka.gif'><b>".$r['ksywka']." napisał(a): </b>".htmlspecialchars($r['tresc'])."</div><br>"; } } } ?>
connection.php
<?php function connection() { $mysql_server = "***"; $mysql_admin = "***"; $mysql_pass = "***"; $mysql_db = "***"; } ?>