} else { $app->notFound(); } }); $app->get('/card/:id/view', function ($id) use($app) { $card = new models\Card(); $purshare = new models\Purshare(); $res = $card->getCardById($id); $c = $res[0]; if ($c) { $c['status_name'] = $card->getStatusName($id); $app->render('cards/profile.html', array('card' => $c, 'id' => $id, 'active_cards' => 'active', 'purshares' => $purshare->getPurshares($id))); } else { $app->notFound(); } }); $app->get('/card/generator', function () use($app) { $app->render('cards/generator.html', array('active_cards' => 'active')); }); $app->post('/card/check/number', function () use($app) { $data = $app->request()->post('generator'); $card = new models\Card(); $app->contentType('application/json'); echo json_encode($card->isNumber($data['number'])); }); $app->post('/card/check/serial', function () use($app) { $data = $app->request()->post('generator'); $card = new models\Card(); $app->contentType('application/json'); echo json_encode($card->isSerial($data['serial'])); });