View file kalc.php

File size: 1.15Kb
<?
## NeDeL | XROCK.Ru | JID: [email protected] ##

if ($_GET['act'] == "ok" && !ereg("[A-я_</>\|`'@]", $_POST[1]) && !ereg("[A-я_</>\|`'@]", $_POST[2]))

{

$_POST[1] = htmlspecialchars(stripslashes(trim($_POST[1])));
$_POST[2] = htmlspecialchars(stripslashes(trim($_POST[2])));

if ($_POST[dey] == "umnozh")
{
$t = $_POST[1] * $_POST[2];
}

if ($_POST[dey] == "slozh")
{
$t = $_POST[1] + $_POST[2];
}

if ($_POST[dey] == "delen")
{
$t = $_POST[1] / $_POST[2];
}

if ($_POST[dey] == "vychit")
{
$t = $_POST[1] - $_POST[2];
}

echo 'Ответ: <b>'.$t.'</b><br/><br/>';

}

echo '<form method="post" action="kalc.php?act=ok">
Число:<br /><input name="1"  maxlength="50" value="" /><br />
<select name="dey"><option selected="selected">Действия</option>

<option value="umnozh">Умножить</option>

<option value="slozh">Сложить</option>

<option value="vychit">Вычесть</option>

<option value="delen">Делить</option>

</select>

<br/>

Число:<br /><input name="2"  maxlength="50" value="" /><br />

<input value="Сосчитать" name="do" type="submit" /></form><br/>';

?>