This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
71 lines (67 loc) · 2.13 KB
/
index.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
<?php
require "header.php";
if(isset($_SESSION["errmsg"])) {
echo "<p style=\"text-align: center; color: red;\">" . $_SESSION["errmsg"] . "</p>";
echo "<p style=\"text-align: center;\"><button type=\"button\" onclick=\"location.href = 'index.php';\">"._("Indietro")."</button></p>";
unset($_SESSION["errmsg"]);
require "footer.php";
die();
}
if(isset($_SESSION["infomsg"])) {
echo "<p style=\"text-align: center; color: blue;\">" . $_SESSION["infomsg"] . "</p>";
echo "<p style=\"text-align: center;\"><button type=\"button\" onclick=\"location.href = 'index.php';\">"._("Indietro")."</button></p>";
unset($_SESSION["infomsg"]);
require "footer.php";
die();
}
?>
<form class="fileform" action="sendfax.php" method="POST" enctype="multipart/form-data" onsubmit="return checkValidForm()">
<table>
<tr>
<th><?= _("Mittente"); ?></th>
<td><select name="modem">
<?php foreach(getAllNumbers() as $modem => $identifier): ?>
<option value="<?php echo $modem ?>"><?php echo $identifier ?></option>
<?php endforeach; ?>
</select></td>
</tr>
<tr>
<th><?= _("Destinatario"); ?></th>
<td><input type="text" placeholder="0773123456" name="dest" id="dest" /></td>
</tr>
<tr>
<th><?= _("File (PDF)"); ?></th>
<td><input type="file" name="f" /></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><button type="submit"><?= _("Invia FAX"); ?></button></td>
</tr>
</table>
</form>
<script>
$('#dest').keydown(function(event){
var ch = String.fromCharCode(event.which);
if((!ch.match(/^[0-9]+$/)
&& event.which > 31
&& event.which != 46
&& !(event.which >= 37 && event.which <= 40)
&& !(event.which >= 96 && event.which <= 105)) || event.which == 0) {
console.log(ch);
console.log(event.which);
event.preventDefault();
}
});
function checkValidForm() {
var dest = $('#dest').val();
if(dest == "" || !dest.match(/^[0-9]+$/)) {
alert("<?= _("Numero fax di destinazione non valido"); ?>");
return false;
}
return true;
}
</script>
<?php
require "footer.php";