コード例 #1
0
ファイル: input.php プロジェクト: npucc/onyoku
<?php

require_once '../lib/db.php';
$input = json_decode($_POST['data']);
//echo '<pre>';
//print_r($input);
//echo '</pre>';
//echo '<br>';
try {
    check_input($input);
    //	echo 'check_ok<br>';
    save_input($_POST['data']);
    $music_id = register_music($input);
    $label_id = register_label($input);
    $stocker_id = register_stocker($input);
    $disc_id = register_disc($input, $label_id);
    register_discography($input, $music_id, $disc_id);
    register_asset($stocker_id, $disc_id, $input->condition);
} catch (Exception $e) {
    $error_message = $e->getMessage();
}
$ret['success'] = isset($error_message) ? false : true;
$ret['input'] = $input;
$ret['error'] = $error_message;
echo json_encode($ret);
function register_asset($stocker_id, $disc_id, $condition)
{
    $db = OnyokuDB::getInstance();
    $sql = 'INSERT INTO asset' . ' (stocker_id, disc_id, status)' . ' VALUES($1, $2, $3)';
    $db->query($sql, array($stocker_id, $disc_id, $condition));
}
コード例 #2
0
ファイル: set_rates.php プロジェクト: fortyspokes/ProjectLogs
function rate_change()
{
    global $_STATE;
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        //POST carries rate data
        save_input();
        $_STATE->replies = array();
    } else {
        foreach ($_GET as $field => $reply) {
            //GET carries replies
            $_STATE->replies[$field] = $reply;
        }
    }
    if (!audit_input()) {
        return;
    }
    if ($_STATE->rates[$_STATE->rate_ndx]["ID"] == 0) {
        add_rate();
    } elseif ($_STATE->new_rate["eff"] == 0) {
        delete_rate();
    } else {
        update_rate();
    }
}