forked from laurynas/php-crossword
-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo-user-words.php
78 lines (61 loc) · 1.62 KB
/
demo-user-words.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<title>PHP Crossword Generator</title>
<style>
body, td { font-family: Courier; font-size: 10pt; }
.crossTable { border-spacing:0px; border-collapse: collapse; }
.cellEmpty { padding: 0px; }
.cellLetter { padding: 1px; background-color: #EEEEEE; border: 1px solid #000000; width: 20px; height: 20px; }
.cellDebug { padding: 1px; border: 1px solid #000000; width: 20px; height: 20px; }
</style>
</head>
<body>
<?php
require 'init.php';
?>
<div align="center">
<form method="post">
Add some words: <br />
<textarea name="words" cols="30" rows="10"><?=htmlspecialchars(stripslashes($_REQUEST['words']))?></textarea>
<br /><br />
<input type="submit" value="Generate" />
</form>
<? if (!empty($_REQUEST['words'])): ?>
<?
$success = $pc->generateFromWords($_REQUEST['words']);
?>
<? if (!$success): ?>
SORRY, UNABLE TO GENERATE CROSSWORD FROM YOUR WORDS
<? else: ?>
<?
$html = $pc->getHTML($_REQUEST['colors']);
$words = $pc->getWords();
?>
<p><?=$html?></p>
<p><b>Words: <?=count($words)?></b></p>
<table border=1 align="center">
<tr>
<th>Nr.</th>
<th>Word</th>
<th>X</th>
<th>Y</th>
<th>Axis</th>
</tr>
<? foreach ($words as $key=>$word): ?>
<tr>
<td><?=$key+1?>.</td>
<td><?=$word["word"]?></td>
<td><?=$word["x"]?></td>
<td><?=$word["y"]?></td>
<td><?=$word["axis"]?></td>
</tr>
<? endforeach; ?>
</table>
<? endif; ?>
<? endif; ?>
<?=sprintf("<p>Generated in %.4f sec.</p>",(getmicrotime() - $script_start))?>
</div>
</body>
</html>