Пример #1
0
	<style>
	.succes { font-weight: 600; color: #00CC00; }
	.erreur { font-weight: 600; color: #CC0000; }

	</style>
</head>

<body>
<h1>PHP Naive Bayesian Filter</h1>
<?php 
switch ($_REQUEST['action']) {
    case 'addcat':
        addcat();
        break;
    case 'remcat':
        remcat();
        break;
    case 'train':
        train();
        break;
    case 'untrain':
        untrain();
        break;
    case 'cat':
        cat();
        break;
}
function addcat()
{
    global $_REQUEST, $login, $pass, $server, $db;
    $cat = trim(strip_tags($_REQUEST['cat']));
Пример #2
0
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = confirm($_POST);
            break;
        case "write":
            $OUTPUT = write($_POST);
            break;
        default:
            $OUTPUT = remcat($_GET['catid'], $_GET['type']);
    }
} else {
    # Display default output
    if (!empty($_GET['catid'])) {
        $OUTPUT = remcat($_GET['catid'], $_GET['type']);
    } else {
        $OUTPUT = remcat('none', 'none');
    }
}
# get template
require "template.php";
function remcat($catid, $type)
{
    // Limit field lengths as per database settings ( Regex method doesn't work :-/ )
    require_lib("validate");
    $v = new validate();
    $v->isOk($catid, "string", 1, 20, "Invalid category ID.");
    $v->isOk($type, "string", 1, 2, "Invalid category Type .");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();