Esempio n. 1
0
function registerEvent($id, $user)
{
    global $db;
    if (isRegisteredInEvent($id, $user)) {
        return false;
    }
    $a = $db->prepare('INSERT INTO event_registrations VALUES(?, ?)');
    $a->execute(array($user, $id));
    return true;
}
Esempio n. 2
0
        ?>
                </li>
            <?php 
    }
} else {
    ?>
                <s>No comments yet :(</s>
            <?php 
}
?>
    </ul>

    <!-- Comment form -->
    <div id="comment_form">
        <?php 
if ($logged && (isRegisteredInEvent($id, $_SESSION['username']) || $_SESSION['username'] == $event['creator'])) {
    ?>
            <form action="action_comment.php" method="post" >
                <input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
">
                <input type="hidden" name="author" value="<?php 
    echo $_SESSION['username'];
    ?>
">
                <input type="text" name="text" required placeholder="Write a comment...">
                <input type="submit" name="comment_btn" value="Post">
            </form>
        <?php 
} else {
Esempio n. 3
0
<?php 
} else {
    ?>
    <p>Register in the event to comment or share</p>
<?php 
}
?>

<br>

<div class="nav_buttons">
    <?php 
if ($logged) {
    ?>
        <?php 
    if (!isRegisteredInEvent($id, $_SESSION['username'])) {
        ?>

            <button type="button" onclick="location.href='action_register_event.php?id=<?php 
        echo $id;
        ?>
'">Register</button>

        <?php 
    } else {
        ?>
            <button type="button" onclick="location.href='action_unregister_event.php?id=<?php 
        echo $id;
        ?>
'">Unregister</button>