Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Ksiega Gosci
MuMuMilk
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 18.02.2004

Ostrzeżenie: (0%)
-----


Witam (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif) , jestem nowy i mam maly problem... jak zrobic aby w tej ksiedze gosci mozna bylo wstawiac emoty (czy jak to sie pisze ;p) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) ?

[php:1:2761cc1bc4]<?php

$txt=fopen("guestbook.gb","r");

$gbfile="";
while($line=fgets($txt,3000))
$gbfile.=$line;

//name
if(isset($name))
if($name==""){
$errorfarbe_1 = "red";
$error = "fehler";
}
else{
$errorfarbe_1 = "black";
}

//comment
if(isset($comment))
if($comment==""){
$errorfarbe_2 = "red";
$error = "fehler";
}
else{
$errorfarbe_2 = "black";
}

if(!$aktion){
$aktion = "eingabe";
}

if($error=="fehler"||$aktion=="eingabe"){
?>


<p align="center"><strong>Spis </strong></p>
<form method="post" action="<? echo $PHP_SELF;?>">
<div align="left"><strong>Nick</strong><br />
<input type="text" name="name" size="30" <? if(isset($name)) echo
"value='$name'";?> class="eingabe">
<br />
<strong>Mail</strong><br />
<input type="text" name="mail" size="30" class="eingabe">
<br />
<strong>Linkstrong><br />
<input type="text" name="site" size="100" value="http://" class="eingabe">
<br />
<font color="#FFCCCC"><br>
</font><strong>Wpisz:</strong>:<br />
<textarea name="comment" cols="100" rows="10" class="eingabe"><?
if(isset($comment)) echo "$comment";?></textarea>
<br />
<br />
<input type="submit" name="Button" value="Wyslij" class="eingabe">
<input type="Hidden" name="aktion" value="senden" class="eingabe">
<br>
</div>
</form>




<p align="center"><strong>Wpisy:</strong></p>
<p>&nbsp;</p>

<?
echo "<p>$gbfile</p>"
?>
<? }else{

if(isset($name)&&isset($comment)&&isset($mail)&&isset($site))
{
$name=stripslashes(strip_tags($name));
$comment=stripslashes(strip_tags($comment));
$mail=stripslashes(strip_tags($mail));
$site=stripslashes(strip_tags($site));


$gbfile="<b>$name</b> - ".date("m/d/Y")."<br>n<a
href='mailto:$mail'>$mail</a>n"."<br>n<a href='$site'
target='blank'>$site</a>n"."<br>n $comment <br><br>n".$gbfile;
fclose($txt);
$txt=fopen("guestbook.gb","w");
fputs($txt,$gbfile);
}
echo "<p><a href='wpisy.php'>Wpisy</a><br><br> " . $gbfile . "</p>";
fclose($txt);
}


?>[/php:1:2761cc1bc4]
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kubatron
post
Post #2





Grupa: Zarejestrowani
Postów: 581
Pomógł: 0
Dołączył: 21.07.2003
Skąd: Jasło

Ostrzeżenie: (0%)
-----


Proponuje to zrobić tak:
  1. <?php
  2. $emoty = array(&#092;":angry:\" => \"<img src=\"../emoticons/angry.gif\\" />\",
  3.  &#092;":biggrin:\" => \"<img src=\"../emoticons/biggrin.gif\\" />\",
  4.  &#092;":blink:\" => \"<img src=\"../emoticons/blink.gif\\" />\",
  5.  &#092;":blush:\" => \"<img src=\"../emoticons/blush.gif\\" />\",
  6.  &#092;":closedeyes:\" => \"<img src=\"../emoticons/closedeyes.gif\\" />\",
  7.  &#092;":cool:\" => \"<img src=\"../emoticons/cool.gif\\">\",
  8.  &#092;":dry:\" => \"<img src=\"../emoticons/dry.gif\\" />\",
  9.  &#092;":excl:\" => \"<img src=\"../emoticons/excl.gif\\" />\",
  10.  &#092;":glare:\" => \"<img src=\"../emoticons/glare.gif\\" />\",
  11.  &#092;":happy:\" => \"<img src=\"../emoticons/happy.gif\\" />\",
  12.  &#092;":huh:\" => \"<img src=\"../emoticons/huh.gif\\" />\",
  13.  &#092;":laugh:\" => \"<img src=\"../emoticons/laugh.gif\\" />\",
  14.  &#092;":mad:\" => \"<img src=\"../emoticons/mad.gif\\" />\",
  15.  &#092;":mellow:\" => \"<img src=\"../emoticons/mellow.gif\\" />\",
  16.  &#092;":ninja:\" => \"<img src=\"../emoticons/ninja.gif\\" />\",
  17.  &#092;":ohmy:\" => \"<img src=\"../emoticons/ohmy.gif\\" />\",
  18.  &#092;":ph34r:\" => \"<img src=\"../emoticons/ph34r.gif\\" />\",
  19.  &#092;":rolleyes:\" => \"<img src=\"../emoticons/rolleyes.gif\\" />\",
  20.  &#092;":sad:\" => \"<img src=\"../emoticons/sad.gif\\" />\",
  21.  &#092;":sleep:\" => \"<img src=\"../emoticons/sleep.gif\\" />\",
  22.  &#092;":smile:\" => \"<img src=\"../emoticons/smile.gif\\" />\",
  23.  &#092;":tongue:\" => \"<img src=\"../emoticons/tongue.gif\\" />\",
  24.  &#092;":unsure:\" => \"<img src=\"../emoticons/unsure.gif\\" />\",
  25.  &#092;":wacko:\" => \"<img src=\"../emoticons/wacko.gif\\" />\",
  26.  &#092;":wink:\" => \"<img src=\"../emoticons/wink.gif\\" />\",
  27.  &#092;":wub:\" => \"<img src=\"../emoticons/wub.gif\\" />\",
  28.  &#092;":?:\" => \"<img src=\"../emoticons/query.gif\\" />\",
  29.  &#092;":arrow:\" => \"<img src=\"../emoticons/arrow.gif\\" />\"
  30.  );
  31. strtr($text, $emoty);
  32. ?>

Bardziej wydajniej bedzie, co do zmiany scieżki to zastosuj while wyciagajac z bazy emoty (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) i bedzie prosto mogł modyfikowac.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 13.10.2025 - 23:00