-
Notifications
You must be signed in to change notification settings - Fork 0
/
room.php
84 lines (72 loc) · 2.28 KB
/
room.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
function createRoom() {
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$room = createRoom();
$logfile = "./logs/" . $room . ".txt";
$fh = fopen($logfile, 'w') or die("can't open file");
$stringData = "Bienvenue\n\n";
fwrite($fh, $stringData);
fclose($fh);
$url = "http://6ou.fr/balloop/write.php?room=" . $room;
$err = "H";
require_once('qrgen/qrcode.class.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>Balloop</title>
<script type="text/javascript">
var room = "<?php echo $room; ?>";
var lastud = 1;
function poll() {
xhr = new XMLHttpRequest();
xhr.open("GET","./queue.php?room="+room+"&lastud="+lastud,true);
xhr.send();
xhr.onreadystatechange=function() {
if(xhr.readyState==4 && xhr.status==200) {
if(xhr.responseText) {
var reply = JSON.parse(xhr.responseText);
document.getElementById("logs").innerHTML = reply.logs;
lastud = reply.lastud;
}
poll();
}
}
}
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-29238968-1']);
_gaq.push(['_setDomainName', '6ou.fr']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<?php
//$qrcode = new QRcode(utf8_encode($url), $err);
//$qrcode->displayHTML();
?>
<img src="./qrgen/image.php?msg=<?php echo urlencode($url); ?>&err=<?php echo urlencode($err); ?>" alt="generation qr-code" style="border: solid 1px black;"><br>
<div id="logs"></div>
<script type="text/javascript">
poll();
</script>
</body>
</html>