Exemplo n.º 1
0
 public function newcardAction()
 {
     $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     $card = new Card();
     $card->setDateadd();
     $card->setDateup();
     $card->setActive();
     $card->setGameId();
     $card->setUserId(1);
     $em->persist($card);
     $em->flush();
     $this->layout('layout/empty');
     echo "OK";
 }
Exemplo n.º 2
0
<?php

$page = 'cards';
$title = 'Add card';
$desc = '';
require '../header.php';
if (!isset($user)) {
    fURL::redirect('/login.php?forward=/members/cards.php');
}
if (isset($_POST['submit'])) {
    try {
        fRequest::validateCSRFToken($_POST['token']);
        $card = new Card();
        $card->setUserId($user->getId());
        $card->setAddedDate(time());
        $card->setUid($_POST['uid']);
        $card->store();
        fURL::redirect('/members/cards.php');
        exit;
    } catch (fValidationException $e) {
        echo "<p>" . $e->printMessage() . "</p>";
    } catch (fSQLException $e) {
        echo "<p>An unexpected error occurred, please try again later</p>";
        trigger_error($e);
    }
}
?>

<h2>Add card</h2>
<form method="POST">
    <input type="hidden" name="token" value="<?php