<?php
function check_text($text) {
	$text = strip_tags($text);
	$text = str_replace('<', '', $text);
    $text = str_replace('>', '', $text);
    $text = str_replace('$', 'y.e', $text);
    $text = str_replace(';', '', $text);
    $text = str_replace('"', '', $text);
    $text = str_replace('\'', '', $text);
    $text = str_replace('`', '', $text);
	$text = trim($text);
	return $text;
}

function getwmid($wmid) {
    $getwmid = file_get_contents('http://passport.webmoney.ru/asp/CertView.asp?purse=' . $wmid);
    $pos = strpos($getwmid, 'https://events.webmoney.ru/user.aspx?');
    $getwmid = substr($getwmid, $pos);
    $pos = strpos($getwmid, '"><img src=');
    $getwmid = substr($getwmid, 0, $pos);
    $getwmid = substr($getwmid, strlen($getwmid)-12);
    if (!is_numeric($getwmid) or strlen($getwmid) != 12) {
        $wmid = 1;
    } else {
        $wmid = $getwmid;
    }
    return $wmid;
}

function moneyraund ($money, $kol) {
    if ($money == 0) {
        $money = 0.00;
        return $money;
    } else
    if (strpos($money, '.')) {
        $money = explode('.', $money);
        return $money[0] . '.' . substr($money[1], 0, $kol);
    } else {
        return $money;
    }
}
?>