Chce wstawic tu do ksiegi gosci IP osoby ktora wpisze sie do ksiegi gosci. A zarazem by po najechaniu podswietlal sie napis IP. Pomozcie mi prosze.

  1. function module_start($cmd) {
  2.  
  3.  
  4.  
  5. if($cmd=='add_now') {
  6. add_row();
  7. }
  8. }
  9.  
  10. function module_main($cmd) {
  11.  
  12. global $gbook_limit, $page;
  13.  
  14. if($cmd=='') {
  15.  
  16. main_title_open();
  17. echo 'Ksiêga gosci';
  18. main_title_close();
  19. main_text_open();
  20. echo '<br><center>';
  21. list_rows($gbook_limit, $page);
  22. add_form();
  23. main_text_close();
  24.  
  25.  
  26.  
  27. if($cmd=='add_now') {
  28.  
  29. main_title_open();
  30. echo 'Ksiega gosci - dodaj wpis';
  31. main_title_close();
  32. main_text_open();
  33. echo '<br>';
  34. check_form('main');
  35. main_text_close();
  36.  
  37.  
  38. }
  39.  
  40. function module_info($co) {
  41.  
  42.  
  43. if($co=='title')
  44. return 'ksiega gosci';
  45.  
  46.  
  47. }
  48.  
  49. #=====================================================#
  50.  
  51.  
  52.  
  53. function list_rows($limit, $page) {
  54.  
  55. global $gbook_tbl, $PHP_SELF, $op;
  56.  
  57.  
  58. $query = "SELECT * FROM $gbook_tbl ORDER BY date DESC";
  59. $result = mysql_query($query);
  60. $ile = mysql_num_rows($result);
  61.  
  62. if($ile<>0) {
  63. $znk = $page * $limit;
  64. mysql_data_seek($result, $znk); 
  65. }
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. $aaa = 0;
  73. while($r = mysql_fetch_array($result)) {
  74. $id = $r['id'];
  75. $ip = $r getenv(REMOTE_ADDR);
  76. $text = $r['text'];
  77. $date = $r['date'];
  78. $nick = $r['nick'];
  79. $mail = $r['mail'];
  80. $_page = $r['page'];
  81.  
  82. $text = stripslashes($text);
  83. $nick = stripslashes($nick);
  84. $text = make_clickable($text);
  85. $text = smilies($text);
  86.  
  87.  
  88. if($mail<>'') $nick = '<a href="mailto:'.$mail.'">'.$nick.'</a>'; 
  89. if($_page<>'' AND $_page<>'http://') $_page = '<a href="'.$_page.'" target="_blank">'.$_page.'</a>'; else $_page = '&lt;brak&gt;';
  90.  
  91.  
  92. if(is_login()=='yes') {
  93. $link_a = '<a href="admin.php?op=gbook&cmd=edit&id='.$id.'&goto=module.php?op='.$op.'" title="edit">E</a>';
  94. $link_b = '<a href="admin.php?op=gbook&cmd=del&id='.$id.'&goto=module.php?op='.$op.'" title="delete">D</a>';
  95. $nick = $nick.' <b>&middot;&middot;&middot;</b> (<b> '.$link_a.'</b> | <b>'.$link_b.' </b>)';
  96. }
  97. ?>
  98. <table height=80><tr><td bgcolor=#FFDAB9 width="150" border="1"><font size=1>
  99. <?
  100.  
  101. echo '
  102. <B>Autor: </B>'.$nick.'<br><br>
  103. <img src="theme/'.$color[3].'/XpBlue_by_mejczak/gfx/ip.gif"><b>'.$hostname = getenv(REMOTE_HOST).'
  104. <img src="theme/'.$color[3].'/XpBlue_by_mejczak/gfx/www.gif"><b> '.$_page.'</b><br><br>
  105. <br><b>dodano: </b>'.$date.'<br>
  106. </td><td bgcolor=#FAEBD7 width="420"><font size=1> 
  107. '.$text.
  108. ';
  109. ?> 
  110. </td></tr></table><br>
  111. <?
  112.  
  113. $aaa++;
  114. if($aaa==$limit) break;
  115. }
  116.  
  117.  
  118.  
  119.  
  120. echo '<br><center>';
  121. $ile = mysql_num_rows($result);
  122. if($ile<>0) {
  123. $row = (int) $ile;
  124. $ile = $ile / $limit;
  125. $ile = ceil($ile);
  126.  
  127. $bbb = 0;
  128.  
  129. echo 'stron: ';
  130. while($bbb<>$ile) {
  131.  
  132. $ccc = $bbb + 1;
  133. if($page==$bbb) {
  134. echo '[<b>'.$ccc.'</b>] ';
  135. } else {
  136. echo '[<a href="'.$PHP_SELF.'?op='.$op.'&page='.$bbb.'">'.$ccc.'</a>] ';
  137. }
  138.  
  139. $bbb++;
  140. }
  141. } else {
  142. echo 'stron: ';
  143. echo '[<b>1</b>]';
  144. $row = 0;
  145. }
  146. echo ', wpisów: <b>'.$row.'</b></center>';
  147.  
  148.  
  149. }
  150.  
  151.  
  152.  
  153. function add_form() {
  154.  
  155. global $op, $PHP_SELF, $f_author, $f_mail;
  156.  
  157.  
  158. if(is_user_login()=='yes')
  159. $info = get_user_info();
  160.  
  161. echo '<hr size="1" noshade><br>
  162. <form name="comments" method="post" action="'.$PHP_SELF.'?op='.$op.'"> 
  163. <table border="0" cellspacing="3" cellpadding="0" align="center"> 
  164. <tr>
  165. <td class="uni_01" valign="top"><div align="right"> <b>nick</b></div></td> 
  166. <td class="uni_01">';
  167.  
  168. if(is_user_login()=='yes') echo '<b>'.$info[1].'<input type="hidden" name="imie" value="'.$info[1].'">';
  169. else
  170. echo '<input type="text" name="imie" size="30" value="'.$GLOBALS[f_author].'">';
  171.  
  172. echo '</td> 
  173. </tr> 
  174. <tr>
  175. <td class="uni_01" valign="top"><div align="right"><b>e-mail</div></td> 
  176. <td class="uni_01">';
  177.  
  178. if(is_user_login()=='yes') echo '<b>'.$info[2].'<input type="hidden" name="mail" value="'.$info[2].'">';
  179. else
  180. echo '<input type="text" name="mail" size="30" value="'.$GLOBALS[f_mail].'">';
  181.  
  182. echo '</td> 
  183. </tr> 
  184. <tr>
  185. <td class="uni_01" valign="top"><div align="right"><b>strona</div></td> 
  186. <td class="uni_01">';
  187.  
  188. if(is_user_login()=='yes') echo '<b>'.$info[4].'<input type="hidden" name="page" value="'.$info[4].'">';
  189. else
  190. echo '<input type="text" name="page" size="30" value="http://">';
  191.  
  192. echo '</td> 
  193. </tr> 
  194. <tr>
  195. <td class="uni_01" valign="top"><div align="right"><b>text</div></td> 
  196. <td class="uni_01">
  197. <textarea name="text" rows="5" cols="50"></textarea> 
  198. </td> 
  199. </tr> 
  200. <tr>
  201. <td align="right" class="uni_01">&nbsp;</td> 
  202. <td class="uni_01">
  203. <input style="font-weight: bold;" type="submit" name="ok" value="dodaj">
  204. <input type="reset" name="Reset" value="czysæ">
  205. <input type="hidden" name="cmd" value="add_now">
  206. </td> 
  207. </tr> 
  208. </table> 
  209. </form>';
  210.  
  211. }
  212.  
  213.  
  214. function check_form($what='top') {
  215.  
  216. global $page, $text, $imie, $mail;
  217.  
  218. $a = 0;
  219. if($text=='') $a++;
  220. if($imie=='') $a++;
  221. if($mail=='') {
  222. $mail = '';
  223. } else {
  224. if (!ereg ("^.+@.+..+$", $mail)) {
  225.  
  226. $a++;
  227. $bb = "<br><br>Adres e-mail jest niepoprawny, jesli nie chcesz go podac pozostaw puste pole";
  228. }
  229. }
  230.  
  231. if($what<>'top') {
  232. if($a<>0) echo "Formularz wype³niony niepoprawnie. Musisz wype³niæ
  233. wszystkie pola oprócz e-mail i strona!";
  234. echo $bb;
  235. }
  236.  
  237. if($a==0) return 10;
  238. }
  239.  
  240.  
  241. function add_row() {
  242.  
  243. global $gbook_tbl, $page, $text, $imie, $mail, $op, $REMOTE_ADDR;
  244.  
  245. if(check_form()==10) {
  246.  
  247. $page = htmlspecialchars($page); 
  248. $imie = htmlspecialchars($imie); 
  249. $text = htmlspecialchars($text);
  250. $mail = htmlspecialchars($mail);
  251.  
  252. $query = "INSERT INTO $gbook_tbl VALUES(NULL, '$imie', '$mail', '$page', '$text', now(), '$REMOTE_ADDR')";
  253. $result = mysql_query($query);
  254.  
  255. if(is_user_login()<>'yes') save_anonim($imie, $mail);
  256.  
  257. header("Location: module.php?op=$op");
  258. }
  259.  
  260. }