0
my php page uses the following files "1-config.php = connects to the database" "2-total.php = connects to the Form and shows the total record on the page"
in the html of my main page I use <?php require_once("total.php"); ?>
, now enter the problem, I have a script at the bottom of the page that controls one of the functions of my page
<script type="text/javascript">
function verifica() {
for (var a = 0; a < 39; a++) {
var b = "s" + (a + 1),
c = document.getElementById(b);
if (c.innerHTML = segsToTime(c.getAttribute("inicial")), verificaCookie(b)) {
var d = new Date,
e = d.getTime() - getCookie(b),
f = c.getAttribute("inicial") - parseInt(e / 1e3);
c.innerHTML = segsToTime(f), f < 0 && (c.innerHTML = segsToTime(c.getAttribute("inicial")), invalidarCookie(b))
}
}
setTimeout(function() {
verifica()
}, 1e3)
}
function dispara(a) {
var b = document.getElementById(a),
c = new Date,
d = c.getTime();
c.setTime(c.getTime() + 2e3 * b.getAttribute("inicial")), document.cookie = a + "=" + d + "; path=/"
}
function lerCookie(a) {
var b = document.cookie.split("=");
return b[1]
}
function verificaCookie(a) {
return document.cookie.indexOf(a) != -1
}
function getCookie(a) {
var b = document.cookie,
c = a + "=",
d = b.indexOf("; " + c);
if (d == -1) {
if (d = b.indexOf(c), 0 != d) return null
} else d += 2;
var e = b.indexOf(";", d);
return e == -1 && (e = b.length), unescape(b.substring(d + c.length, e))
}
function invalidarCookie(a) {
document.cookie = a + "=0; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"
}
function segsToTime(a) {
return h = parseInt(a / 3600), h < 10 && (h = "0" + h), m = parseInt(a / 60 % 60), m < 10 && (m = "0" + m), s = parseInt(a % 60), s < 10 && (s = "0" + s), h + ":" + m + ":" + s
}
verifica();
</script>
The problem is, how can I put the comic’s registration total so it’s automatic like the rest of the page? without having to migrate the script to php like "echo("...rest of the code")" you can do something in the html itself inside the script?
EX:function verifica(){for(var a=0;a<"total";a++)...resto do código
or
EX:function verifica(){for(var a=0;a<"<?php require_once("total.php");?>";a++)...resto do código
(I’ve tried it like this)
Thank you.
If you run a jsbeautifier.org on these codes will make it much easier.
– relaxeaza