Toon posts:

[PHP] aanklikbare smileys voor gastenboek

Pagina: 1
Acties:
  • 70 views sinds 30-01-2008

Verwijderd

Topicstarter
Ik heb een vraag. nu is mijn guestbook script wel uitgerust met smileys maar je moet de codes intoetsen. Ik wil het graag zo hebben dat je een smiley kan aanklikken en dat de code van de smiley dan in de message formulier wordt toegevoegd op de plaats waar de cursor stond.

Ik heb dit al eens eerder geprobeerd te realiseren maar dat was niet gelukt.
Ik had een stuk van een andere guestbook script toegevoegd maar die werkte niet.
Het moet zo werken als met dit forum...

Hoe kan ik dit voorelkaar krijgen? Heeft iemand hier dat al eens gemaakt?

Hieronder 2 stukken uit het script. Guestbook is te vinden op http://www.nxshardcore.com/ingetjuh
__________________________________________________________________

Guestbook formulier:

?>

<small><center><table><tr><td align="left"><?php echo $fontTag; ?>
<center><table border="0"><td align="left">
<form action="gbook.php3" method="post">
<input type="hidden" name="remote_adress" size="49" style="BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: rgb(255,255,255); FONT-FAMILY: Tahoma; FONT-SIZE: 8pt" value="<?php echo $REMOTE_ADDR; ?>" maxlength="50">
<font size="2">Your Name:</font><br><input type="text" name="person" size="49" style="BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: rgb(255,255,255); FONT-FAMILY: Tahoma; FONT-SIZE: 8pt" value="<?php echo $person; ?>" maxlength="50"><br>
<font size="2">Where are you from:</font><br><input type="text" name="where_from" style="BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: rgb(255,255,255); FONT-FAMILY: Tahoma; FONT-SIZE: 8pt" value="<?php echo $where_from; ?>" size="49" maxlength="50"><br>
<font size="2">E-Mail:</font><br><input type="text" name="email" style="BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: rgb(255,255,255); FONT-FAMILY: Tahoma; FONT-SIZE: 8pt" value="<?php echo $email; ?>" size="49" maxlength="49"><br>
</td>
<td>
<font size="2">Website address:</font><br><input type="text" name="site_address" size="49" maxlength="100" style="BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: rgb(255,255,255); FONT-FAMILY: Tahoma; FONT-SIZE: 8pt" VALUE="<?php if($action=="Preview"){ echo $site_address; } else { echo"http://"; } ?>"><br>
<font size="2">Website Title:</font><br><input type="text" name="site_title" style="BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: rgb(255,255,255); FONT-FAMILY: Tahoma; FONT-SIZE: 8pt" value="<?php echo $site_title; ?>" size="49" maxlength="50"><br>
<font size="2">ICQ #:</font><br><input type="text" name="icq" style="BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: rgb(255,255,255); FONT-FAMILY: Tahoma; FONT-SIZE: 8pt" value="<?php echo $icq; ?>" size="49" maxlength="15"><br>
</td>
</table>
<font size="2">Comments:</font><br><textarea name="message" rows="5" cols="103" style="BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: rgb(255,255,255); FONT-FAMILY: Tahoma; FONT-SIZE: 8pt"><?php echo $message; ?></textarea><br><br>
<input type="submit" name="action" value="Submit" style="background-color: #888888; color: rgb(255,255,255)">
<p>
<font
face="Arial">:) = <img src="http://www.nxshardcore.com/newsgroups/xnpsmiley14.gif" width="17"
height="17"> :( = <img src="http://www.nxshardcore.com/newsgroups/xnpsmiley3.gif" width="17"
height="17"> :P = <img src="http://www.nxshardcore.com/newsgroups/xnpsmiley15.gif" width="17"
height="17"> :D = <img src="http://www.nxshardcore.com/newsgroups/xnpsmiley10.gif" width="17"
height="17"> :frusty: = <img src="http://www.nxshardcore.com/newsgroups/frusty.gif" width="25"
height="15"> :middlefinger: = <img src="http://www.nxshardcore.com/newsgroups/middlefinger.gif" width="24"
height="15"> ;dj; = <img src="http://www.nxshardcore.com/newsgroups/dj.gif" width="41"
height="36"><br>:knife: = <img src="http://www.nxshardcore.com/newsgroups/knife.gif" width="34"
height="15"> :frag: = <img src="http://www.nxshardcore.com/newsgroups/frag.gif" width="46"
height="26"> :heart: = <img src="http://www.nxshardcore.com/newsgroups/heart.gif" width="17"
height="17"> :beer: = <img src="http://www.nxshardcore.com/newsgroups/beer.gif" width="13"
height="13"> :evil: = <img src="http://www.nxshardcore.com/newsgroups/devil.gif" width="25"
height="18"> :bash: = <img src="http://www.nxshardcore.com/newsgroups/bash.gif" width="33"
height="26"><br>:rambo: = <img src="http://www.nxshardcore.com/newsgroups/rambo.gif" width="52"
height="16"> :rotate: = <img src="http://www.nxshardcore.com/newsgroups/rotate.gif" width="16"
height="16"></font></p>
</center>
</form>
</font>
</td></small>


<?php
__________________________________________________________________

Stuk dat de ingevulde tekens omzet naar smileys:

// debug all the forms
$message = stripslashes ($message);
$message = str_replace ("|","&#124", $message);
$message = str_replace ("\r\n","<br>", $message);
$site_title = stripslashes ($site_title);
$site_title = str_replace ("|","&#124", $site_title);
$person = stripslashes ($person);
$person = str_replace ("|","&#124", $person);
$email = stripslashes ($email);
$email = str_replace ("|"," ", $email);
$site_address = stripslashes ($site_address);
$site_address = str_replace ("|"," ", $site_address);
$icq = stripslashes ($icq);
$icq = str_replace ("|"," ", $icq);
$where_from = stripslashes ($where_from);
$where_from = str_replace ("|","&#124", $where_from);
$message = str_replace (":)","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/xnpsmiley14.gif", $message);
$message = str_replace (":-)","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/xnpsmiley14.gif", $message);
$message = str_replace (":(","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/xnpsmiley3.gif", $message);
$message = str_replace (":-(","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/xnpsmiley3.gif", $message);
$message = str_replace (":p","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/xnpsmiley15.gif", $message);
$message = str_replace (":P","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/xnpsmiley15.gif", $message);
$message = str_replace (":d","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/xnpsmiley10.gif", $message);
$message = str_replace (":D","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/xnpsmiley10.gif", $message);
$message = str_replace (":frusty:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/frusty.gif", $message);
$message = str_replace (":middlefinger:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/middlefinger.gif", $message);
$message = str_replace (":bash:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/bash.gif", $message);
$message = str_replace (":knife:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/knife.gif", $message);
$message = str_replace (":frag:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/frag.gif", $message);
$message = str_replace (":heart:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/heart.gif", $message);
$message = str_replace (":beer:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/beer.gif", $message);
$message = str_replace (";dj;","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/dj.gif", $message);
$message = str_replace (":evil:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/devil.gif", $message);
$message = str_replace (":rambo:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/rambo.gif", $message);
$message = str_replace (":rotate:","Afbeeldingslocatie: http://www.nxshardcore.com/newsgroups/rotate.gif", $message);
$message = stripslashes ($message);
$message = str_replace ("|","&#124", $message);
$message = str_replace ("\r\n","<br>", $message);
$person = stripslashes ($person);
$person = str_replace ("|","&#124", $person);
$message = str_replace ("\$message\","<i>\$message\</i>", $message);
__________________________________________________________________

Als er meer van het script nodig is zeg het maar...

Kan ik die functie hier wel inbouwen??

  • Michali
  • Registratie: Juli 2002
  • Laatst online: 22-03 18:12
Dat is niet met PHP te doen, omdat het gewoon puur client-side afgehandeld wordt. Je zou eens naar javascript moeten gaan kijken. Verder is je HTML 1 grote bende en ik denk niet dat iemand hier zin heeft om dit te gaan lezen :|

Noushka's Magnificent Dream | Unity


  • whoami
  • Registratie: December 2000
  • Laatst online: 15:14
Ja sorry hoor, maar zoals Michali al zegt is dit gewoon niet leesbaar.
Als je zomaar je code hier neerzet, dan lijkt het trouwens ook sterk op een 'wie maakt het ff voor mij' request, en daar doen we niet aan mee.

https://fgheysels.github.io/


Dit topic is gesloten.