rejetto forum

if one special word then

kaler · 11 · 5102

0 Members and 1 Guest are viewing this topic.

Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
hello i have a little problem:

i want a marco(or script) that works, when a special word ( phrase) is submited.

then the script must add smething to a '.txt' file... how can i realise this?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
how/where would this word be submitted?

make a full example of how the full process would go, from a user point of view.


Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
ok sorry i forgot here:

First dokument:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="/shoutbox/cool_art.css"/>
</head>
<body onload="window.scrollTo(0,99999)" id="msgBody" style="background-color: rgb(0, 0, 0); color: rgb(255, 255, 255);>
{.$files.}
<form name="shout" action="/shoutbox/process_posts/" method="post" id="msgForm">
<center>

{.if|%user%|
<input type="text" name="user" size="17" maxlength="30" value="%user%" id="msgInput" readonly/>
|
<input type="text" name="user" size="17" maxlength="12" value="{.!Name.}" id="msgInput" onclick="if(this.value=='{.!Name.}')this.value=''"/>
.}

<br/>
<input type="text" name="msg" size="17" maxlength="150" value="{.!Nachricht.}" id="msgInput" title="{.!Smilis-Codes.}: :) :D ;D ;) :S :$ :P :o :'( :( (h)" onclick="if(this.value=='{.!Nachricht.}')this.value=''"
/><br/>
<input type="submit" value="{.!Absenden.}" id="msgSubmit"/>
</center>
</form>
</body>
</html>

[files]
{.if not|%number%|<center id="Senden fehlgeschlagen">{.!Keine Nachrichten vorhanden.}</center>|%list%.}

[file.txt]
<div class="msgOuter">
{.load|/shoutbox/display_posts/%item-name%.}
</div>

Second:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Refresh" content="1; URL=/shoutbox/display_posts/?sort=t&rev=1">
<link rel="stylesheet" type="text/css" href="/shoutbox/cool_art.css"/>
</head>
<body id="msgBody" style="background-color: rgb(0, 0, 0); color: rgb(255, 255, 255);">
<br/><center><i>{.!Senden....}</i></center>
</body>
</html>
[special:begin]

{.if not|{.match|{.postvar|msg.}|{.!NO CONTENT.}.}|
{:{.append|/shoutbox/display_posts/%ip% {.replace|/|-|:|.|%timestamp%.}.txt|
<div class="msgHeader">
[<span class="msgUser"><b>{.replace|<|&lt;|{.if not|%user%|Gast-||.}{.postvar|user.}.}</b></span>]<br/>%timestamp%
</div>
<div class="msgInner">
{.replace
|<|&lt;|ä|&auml;|ü|&uuml;
|ö|&ouml;|ß|&szlig;
|:)|<img src="/chat/smileys/smiley.gif" alt=""/>
|:D|<img src="/chat/smileys/cheesy.gif" alt=""/>
|:P|<img src="/chat/smileys/tongue.gif" alt=""/>
|;D|<img src="/chat/smileys/grin.gif" alt=""/>
|:(|<img src="/chat/smileys/sad.gif" alt=""/>
|:$|<img src="/chat/smileys/embarrassed.gif" alt=""/>
|:'(|<img src="/chat/smileys/cry.gif" alt=""/>
|:o|<img src="/chat/smileys/shocked.gif" alt=""/>
|(h)|<img src="/chat/smileys/cool.gif" alt=""/>
|:S|<img src="/chat/smileys/undecided.gif" alt=""/>
|;)|<img src="/chat/smileys/wink.gif" alt=""/>
|[b]|<b>
|[/b]|</b>
|[u]|<u>
|[/u]|</u>
|[i]|<i>
|[/i]|</i>
|[url]|<a target="_blank" href="
|[/url]|">LINK</a>
|{.postvar|msg.}
.}
</div>
.}:}
.}

Thats my shoutbox... now i would make a "script" that replace FU'CK (without ' ) to **** ok thats simple:
Code: [Select]
|[url]|<a target="_blank" href="
|[/url]|">LINK</a>
        |FUCK|*****
|{.postvar|msg.}

But i want, that when there is this word, after the hole message there would be a message from the admin like: "Don't use this word" or somethings like that...

but how can i realise this...
can you help me rejetto?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
after "replace"

{.if|{.pos|BADWORD|{.postvar|msg.}.}| don't use this word.}


Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile

Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
if tryd it, but its not that what im lokking for... sorry rejetto...

i will post you the code:

First file:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="/shoutbox/live_black.css"/>
</head>
<body onload="window.scrollTo(0,99999)" id="msgBody" style="background-color: rgb(0, 0, 0); color: rgb(255, 255, 255);>
{.$files.}
<form name="shout" action="/shoutbox/process_posts/" method="post" id="msgForm">
<center>

{.if|%user%|
<input type="text" name="user" size="17" maxlength="30" value="%user%" id="msgInput" readonly/>
|
<input type="text" name="user" size="17" maxlength="12" value="{.!Name.}" id="msgInput" onclick="if(this.value=='{.!Name.}')this.value=''"/>
.}

<br/>
<input type="text" name="msg" size="17" maxlength="150" value="{.!Nachricht.}" id="msgInput" title="{.!Smilis-Codes.}: :) :D ;D ;) :S :$ :P :o :'( :( (h)" onclick="if(this.value=='{.!Nachricht.}')this.value=''"
/><br/>
<input type="submit" value="{.!Absenden.}" id="msgSubmit"/>
</center>
</form>
</body>
</html>

[files]
{.if not|%number%|<center id="Senden fehlgeschlagen">{.!Keine Nachrichten vorhanden.}</center>|%list%.}

[file.txt]
<div class="msgOuter">
{.load|/shoutbox/display_posts/%item-name%.}
</div>

Second File:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Refresh" content="1; URL=/~chat_wide">
<link rel="stylesheet" type="text/css" href="/schoutbox/live_black.css"/>
<link rel="shortcut icon" href="/template/{.!theme.}/images/icon.ico" />
</head>
<body id="msgBody" style="background-color: rgb(0, 0, 0); color: rgb(255, 255, 255);">
<br/><center><i>{.!Senden....}</i></center>
</body>
</html>

[special:begin]
{.if not|{.match|{.postvar|msg.}|{.!NO CONTENT.}.}|
{:{.append|shoutbox/display_posts/%ip% {.replace|/|-|:|.|%timestamp%.}.txt|
<div class="msgHeader">
[<span class="msgUser"><b>{.replace|<|&lt;|{.if not|%user%|Gast -&nbsp;||.}{.postvar|user.}.}</b></span>]<br/>%timestamp%
</div>
<div class="msgInner">
{.replace
|<|&lt;|ä|&auml;|ü|&uuml;
|ö|&ouml;|ß|&szlig;
...
...
...
|[i]|<i>
|[/i]|</i>
|[url]|<a target="_blank" href="
|[/url]|">LINK</a>
|[img]|<img width="70" hight="70" alt="" src="
|[/img]|"/>
|fuck|*****
|{.postvar|msg.}
.}
</div>
.}:}
.}


the replace i know how it works...
but now after the message in form of {.postvar|msg.} should be written: "in future don't use this word..."

thank you rejetto...


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile

Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
a sorry my fault... i had the wrong word for BADWORD...

ok now it is working thx you


Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
can i insert on the place of BADWORD morne than one word? or must i insert the code for every word?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
yes, you can in several ways.
the method i prefer is to use {.regexp.} but it won't work with this version because there's a bug.
i will fix it in next version, and i think i will publish it today.

another method is to duplicate the code

{.pos|WORD1|{.postvar|msg.}.} {.pos|WORD2|{.postvar|msg.}.}


another method is to use {.match.}, but it uses ; and * as special characters, and you won't be able to match some smileys.