Пример #1
0
<?php

include "files/models.php";
include_once "files/new_room.php";
$add_guest = 0;
if (isset($_POST['add_guest'])) {
    if ($_POST['add_guest'] == "on") {
        $add_guest = 1;
    }
}
if (isset($_POST['submit'])) {
    new_room($_POST['title'], $add_guest, $_POST['email_guest'], $_POST['date'], $_POST['time']);
}
Пример #2
0
include 'php/signalling.php';
// Client gets it's client id;
$client_id = new_client_id();
$join_timestamp = get_mysql_time();
// Client joins a room.  The room could be specified in the url otherwise
// a random room is made.
if (isset($_GET['room_id'])) {
    $room_id = $_GET['room_id'];
    if (strlen($room_id) != 6) {
        $error = "Error! invalid room";
    } else {
        ensure_room_exists($room_id, $client_id);
    }
} else {
    $room_id = new_room($client_id);
}
// Join the room.  A join room signal will be broadcast by the server on
// the client's behalf, even before the signaller is built on the client.
// Maybe you want to let client send join message with her signaller
join_room($room_id, $client_id);
$initiator_id = get_initiator($room_id);
// The initiator of the room is passive, and waits for newcommers to
// initiate.  Hence, the room initiator is never the call-initiator!
$initiator = $initiator_id == $client_id ? 'false' : 'true';
$is_first = $initiator_id == $client_id ? 'true' : 'false';
// Generate a url for this room.  Users might share by email or IM to
// get connected
$room_file_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$room_id_url = "?room_id={$room_id}";
$room_url = $room_file_url . $room_id_url;