Jump to content
Fórum Script Brasil
  • 0

É possível java scripts que executar um arquivo php automático?

Daniel Tweetar




Eu tenho um scripts que ele executar um arquivo php em um scripts contabilizando um valor no saldo do usuário por minuto online navegando no site e gostaria de saber se é possível faz esse scripts executar esse arquivo /user-on.php?on=1 automático sem precisar navegar e contabilizando o valor no saldo do usuário e pausa se ele não mexer mais no mouse no tempo de 15 minutos ai para de contabilizar no saldo dele.


Esse é o scripts

var aways = false;


    var fkclk     = true;
    var listclk   = ['a', 'button'];

    setInterval(function() {

         if(!fkclk) {


                url: '/user-on.php?on=1',
                type: 'post',
                dataType: "html",
                contentType: 'application/json',
                success: function (data) {
                },error: function(error){

    }, 5000);

    var initial;

    function invocation() {
        initial = window.setTimeout( 

        function() {

            fkclk = true;

        }, 1800000);


    for(var i in listclk){

        if(typeof listclk[i] == "string"){

            $(listclk[i]).mousedown( function(e){

                fkclk = false;

                clearTimeout( initial )


            var element = document.querySelector(listclk[i]);

            element.addEventListener('click', function(event){


                    fkclk = false;

                } else{

                    fkclk = true;


            }, false);



var modal = '<div class="modal fade" id="away-modal" tabindex="-1" role="dialog" data-backdrop="static" data-onclose="remove">'+
                    '<div class="modal-dialog modal-dialog-centered" role="document">'+
                        '<div class="modal-content">'+
                            '<div class="modal-header">'+
                                '<h5 class="modal-title">'+
                                'Desaja continuar navegando?'+
                            '<div class="modal-body">'+
                                'Se deseja continuar navegando clique em continuar'+
                            '<div class="modal-footer">'+
                                '<button type="button" onclick="away_modal_c();" class="btn btn-primary btn-block" data-dismiss="modal">'+

function away_modal(){



        aways = true;





function away_modal_c(){


    setTimeout( function(){


    }, 2000);


function makeid(length) {

    var result           = '';

    var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

    var charactersLength = characters.length;

    for ( var i = 0; i < length; i++ ) {

      result += characters.charAt(Math.floor(Math.random() * 



   return result;



Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...