-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncoes.php
More file actions
45 lines (43 loc) · 1.32 KB
/
Copy pathfuncoes.php
File metadata and controls
45 lines (43 loc) · 1.32 KB
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
<?php
function debug($str){
if ($_GET['debug'] == 1) {
print "<div style='border: 1px solid red;background: #FAA;padding: 5px;margin: 10px;border-radius: 10px;font-size: 12px;text-align: left;'>DEBUG:";
print_r($str);
print "</div>";
}
}
if ($_GET['action'] == '') {
print "Erro";
} else {
$action = $_GET['action'];
switch ($action) {
case 'iniciar':
//Pega uma lista de palavras
$palavras = array("carro","corrida","cena","dedos","caminhada","acusador");
//Embaralha
shuffle($palavras);
echo "<div id='box_palavra' class='div_geral'>
<input type='hidden' id='completa' value='".strtoupper($palavras[0])."' />
<span id='palavra'>".str_repeat('_',strlen($palavras[0]))."</span>
</div>";
break;
case 'add_letra':
$letra = $_GET['letra'];
$completa = $_GET['completa'];
$palavra = $_GET['palavra'];
$temp="";
for($x=0;$x<strlen($completa);$x++){
if ((strtoupper(substr($completa,$x,1)) == strtoupper($letra)) || (strtoupper(substr($palavra,$x,1)) == strtoupper(substr($completa,$x,1)))) {
$temp = $temp . strtoupper(substr($completa,$x,1));
} else {
$temp = $temp . "_";
}
}
echo "<div id='box_palavra' class='div_geral'>
<input type='hidden' id='completa' value='".strtoupper($completa)."' />
<span id='palavra'>".$temp."</span>
</div>";
break;
}
}
?>