1. Непосредственно сам скрипт:
CODE (text):
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?
- if ($_POST["submit"])
- {
- $a = answer();
- $out = "<h3><font color=black><b>Таррон:</b></font></h3><h5>$a</h5><br><h3><font color=black><b>".$stat['user'].":</b></font></h3><h5>".$ask;
- $tile = ($cfg["scrolling"]) ? $tile : "";
- echo "$out<br>$tile";
- echo "<input name='tile' type='hidden' id='tile' value='$out<br>$tile'>";
- }
- function answer()
- {
- global $cfg, $ask;
- $ask = (empty($ask)) ? "<empty>" : $ask;
- $kick = array("?","\n");
- $ask = str_replace($kick,"",$ask);
- $f = file($cfg["answersfile"]);
- for ($i=0; $i<=count($f); $i++)
- {
- $an = split(";", $f[$i]);
- $a = $an[0];
- if (strstr($a,trim($ask)))
- {
- if ($wasone)
- {
- return("Скажи конкретнее!");
- }
- array_shift($an);
- array_pop($an);
- $ai = rand(0, count($an)-1);
- $wasone = true;
- $retval = $an[$ai];
- }
- }
- $retval = (empty($retval)) ? "Я не врубаюсь ,что ты хочешь?" : $retval;
- return $retval;
- }
- <table border="0" cellspacing="0" cellpadding="0">
- <form method="POST" action="main.php?set=edit&do=compl" name="reg">
- <tr>
- <td>
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td>
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><img src="../img/game/main/in_l.gif" width="20" height="35" alt="" border="0" /></td>
- <td class="in_f"><input name="ask" type="text" class="tint" id="ask" style="width:250px;" value="" onFocus="if (this.value == 'Ололо') { this.value = '' }" onBlur="if (this.value == '') { this.value = 'Ололо }" ></td>
- <td><img src="../img/game/main/in_r.gif" width="20" height="35" alt="" border="0" /></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- ?>