elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


  Mostrar Mensajes
Páginas: 1 [2] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
11  Programación / Desarrollo Web / long polling ajax no esta funcionando bien en: 25 Abril 2017, 01:24 am
lo hace este script es que cuando cambio algo en la base de datos automaticamente se refleja en el sitio solo que cuando agrego un elemento a la base de datos cada ves tengo que recargar la pagina como pudiera hacer para solucionar esto? otra cosa en mi timestamp en la consola de google chrome parece asi http://localhost/storelte/notify/pusher?timestamp=1493076211  pending pero al agregar el nuevo elemento no cambia el timestamp porq no lo hace automatico tengo que recargar para verlo no se que estoy haciendo mal en el ajax ,
Código
  1. $(function(doc, win, $) {
  2.    var has_focus = true;
  3.    var notification = win.Notification || win.mozNotification || win.webkitNotification;
  4.    var $badge = $("#notifications-badge");
  5.    var $list = $("#notifications-list");
  6.    var $button = $("#notifications-button");
  7.    URL_GET_NOTIFICATION = BASE_URL + 'notify/pusher';
  8.    URL_GET_NOTIFICATION_UPDATE = BASE_URL + 'notify/update';
  9.  
  10.    if ('undefined' === typeof notification) {
  11.        console.log('Web notification not supported');
  12.    } else {
  13.        notification.requestPermission(function(permission) {});
  14.    }
  15.  
  16.    function check_notifications(timestamp) {
  17.        $.ajax({
  18.            type: 'GET',
  19.            url: URL_GET_NOTIFICATION,
  20.            data: { timestamp : timestamp },
  21.            dataType: 'json',
  22.            async: true,
  23.            success: function (data) {
  24.                for (var i in data.notifications) {
  25.                    notify(data.notifications[i].message, data.notifications[i].type, data.notifications[i].timestamp);
  26.                }
  27.                check_notifications(data.timestamp);
  28.            }
  29.        });
  30.    }
  31.  
  32.     function notify(message, type, created_at) {
  33.        var type_txt = 'info';
  34.        var url = '#';
  35.        var icon = 'info-circle';
  36.  
  37.        if (type == 0) {
  38.            type_txt = 'success';
  39.            icon = 'check';
  40.        } else if (type == 1) {
  41.            type_txt = 'info';
  42.            icon = 'exclamation';
  43.        } else if (type == 2) {
  44.            type_txt = 'warning';
  45.            icon = 'exclamation-triangle';
  46.        } else if (type == 3 || type == 4) {
  47.            type_txt = 'danger';
  48.            icon = 'fire';
  49.        }
  50.  
  51.        $badge.show();
  52.        $badge.text(parseInt($badge.text()) + 1);
  53.  
  54.        $list.find(".item").eq(13).nextAll(".item").remove();
  55.        var item = '<li class="item text-' + type_txt + '"><a href="' + url + '"><span class="text-' + type_txt + '">' +
  56.            '<i class="fa fa-' + icon + ' fa-fw"></i> ' + message.substr(0, 22) + '</span>' +
  57.            '<span class="pull-right text-muted small" data-time="' + created_at + '">X</span></a></li>' +
  58.            '<li class="item divider"></li>';
  59.        $list.prepend(item);
  60.  
  61.        $('.dropdown.open .dropdown-toggle').dropdown('toggle');
  62.  
  63.        return true;
  64.    }
  65.  
  66.    $(win).on("blur", function () {
  67.        has_focus = false;
  68.    });
  69.  
  70.    $(win).on("focus", function () {
  71.        has_focus = true;
  72.    });
  73.  
  74.    $button.on("click", function () {
  75.        $badge.fadeOut(300, function () {
  76.            $badge.text(0);
  77.        });
  78.  
  79.        $list.find("span[data-time]").each(function (index) {
  80.            var $this = $(this);
  81.            $this.text(moment.unix($this.data('time')).fromNow());
  82.        });
  83.    });
  84.  
  85.    check_notifications();
  86. }(document, window, jQuery));
  87.  
  88. $('#notifications-button').on('click', function () {
  89.    $.ajax({
  90.        type: 'GET',
  91.        url: 'http://localhost/storelte/notify/update',
  92.        success: function(data){
  93.        }
  94.    });
  95. });
12  Programación / PHP / websocket ratchet en: 22 Abril 2017, 03:48 am
lo que queiero hacer es como mandar los mensajes a la base de datos para poder mostrarlos en la vista usando ratchet websocket . mis websocket ya los genera pero desde otro php para generarlos por medio de un boton como prueba pero como pudiera hacerlos de manera dinamica para detectar el evento y mostrarlos ?

Código
  1. public function pusher(){
  2.     $entryData = array(
  3.         'category' => $this->input->post('category'),
  4.         'title'    => $this->input->post('title'),
  5.         'article'  => $this->input->post('article'),
  6.         'timestamp'     => time()
  7.     );
  8.  
  9.    //$this->notification->addNotification($entryData);
  10.  
  11.    // This is our new stuff
  12.  
  13.    $context = new ZMQContext();
  14.    $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
  15.    $socket->connect("tcp://localhost:5555");
  16.  
  17.    $socket->send(json_encode($entryData));
  18.    print_r($entryData);
  19.  
  20. }

Código
  1. var sock = new ab.Session('ws://192.168.0.4:8080',
  2.        function() {
  3.            sock.subscribe('kittensCategory', function(topic, data) {
  4.                $badge.show();
  5.                $badge.text(parseInt($badge.text()) + 1);
  6.  
  7.                $list.find(".item").eq(13).nextAll(".item").remove();
  8.                var item = '<li class="item text-warning"><a href="#"><span class="text-warning">' +
  9.                    '<i class="fa fa-exclamation-triangle fa-fw"></i>'+data.title+' is low'+'</span>' +
  10.                    '<span class="pull-right text-muted small" data-time="">'+data.timestamp+'</span></a></li>' +
  11.                    '<li class="item divider"></li>';
  12.                $list.prepend(item);
  13.                $('.dropdown.open .dropdown-toggle').dropdown('toggle');
  14.            });
  15.        },
  16.        function() {
  17.            console.warn('WebSocket connection closed');
  18.        }, {
  19.            'skipSubprotocolCheck': true
  20.        }
  21.    );
  22.  
13  Informática / Hardware / Re: procesador para edicion de video y cracking de password offline usando la gpu en: 18 Enero 2017, 03:51 am
en cualquier de estos me podria servir si tener tanta plata para un buen procesador

AMD FX-8320E / FD6300WMHKBOX FX-6300 6-Core
14  Informática / Hardware / Re: procesador para edicion de video y cracking de password offline usando la gpu en: 18 Enero 2017, 03:27 am
de passwords por diccionario otra cosa  intel xeon que no es de servidores?
15  Informática / Hardware / Re: procesador para edicion de video y cracking de password offline usando la gpu en: 18 Enero 2017, 03:19 am
al menos si me sirven para al menos 1/4 de millon por segundo?
16  Informática / Hardware / Re: procesador para edicion de video y cracking de password offline usando la gpu en: 18 Enero 2017, 03:06 am
si lo que lo mejor seria intel pero no tengo tanta plata para comprar un i7 que seria lo mejor para los procesos
17  Informática / Hardware / procesador para edicion de video y cracking de password offline usando la gpu en: 17 Enero 2017, 23:52 pm
bueno tenia pensando usar entre  AMD FX-8320E / FD6300WMHKBOX FX-6300 6-Core  y RX 460 4gb ddr5  o EVGA GeForce GTX 960 4GB SuperSC ACX 2.0+ con una  ASRock 960GM/U3S3 FX Micro ATX AM3+o gigabyte GA-78LMT-USB3 Micro ATX AM3+ pero no se por cual decidirme
18  Programación / PHP / error 500 Internal server al momento de enviar datos al servidor codeigniter en: 17 Diciembre 2016, 20:29 pm
el error es porque cuando trato de enviar mis datos al server me da error 500 internal error pero si recargo la pagina si me los subio a que se debe este error? otra cosa en la parte de   $
Código
  1. ("#description").mask("(999) 999-9999");
no me quiere agarrar el mask pero si abro la consola en chrome y hago lo mismo si la agarra como puedo arreglar ambos errores?

controlador

Código
  1. public function addProduct(){
  2. $descripcion = $this->input->post('description');
  3. $cost_price =  $this->input->post('cost_price');
  4. $selling_price = $this->input->post('selling_price');
  5. $wprice = $this->input->post('wprice');
  6. $stock = $this->input->post('stock');
  7. $data_product = $this->item->addProduct($descripcion,$cost_price,$selling_price,$wprice,$stock);
  8. $data = array(
  9. 'description' => $descripcion,
  10. 'cost_price' => $cost_price,
  11. 'selling_price' => $selling_price,
  12. 'wprice' => $wprice,
  13. 'stock' => $stock
  14. );
  15. $this->json($data_product);
  16. }
  17.  


model
Código
  1. public function addProduct($descripcion,$cost_price,$selling_price,$wprice,$stock){
  2. $data = array(
  3. 'descripcion' => $descripcion,
  4. 'precio_compra' => $cost_price,
  5. 'precio_venta' => $selling_price,
  6. 'precio_mayoreo' => $wprice,
  7. 'existencia' => $stock
  8. );
  9.  
  10. $query = $this->db->insert('storelte_articulos',$data);
  11. return $query->result_array();
  12. }


ajax

Código
  1. $('#add').on('click',function(){
  2.        $("#description").mask("(999) 999-9999");
  3. $("#new_product").validate();
  4. BootstrapDialog.show({
  5.            message: function(dialog) {
  6.                var $message = $('<div></div>');
  7.                var pageToLoad = dialog.getData('pageToLoad');
  8.                $message.load(pageToLoad);
  9.  
  10.                return $message;
  11.            },
  12.            data: {
  13.                'pageToLoad': URL_GET_VIEW_PRODUCT
  14.            },
  15.            closable: false,
  16.            buttons:[{
  17.                id: 'btn-ok',
  18.                cssClass: 'btn-primary',
  19.                icon: 'glyphicon glyphicon-send',
  20.                label: ' Save',
  21.             action: function (e) {
  22.                    var description = $('#description').val();
  23.                    var cost_price = $('#cost_price').val();
  24.                    var selling_price = $('#selling_price').val();
  25.                    var wprice = $('#wprice').val();
  26.                    var stock = $('#stock').val();
  27.             if($("#new_product").valid()){
  28.                        $.ajax({
  29.                            url: URL_GET_ADD_PRODUCT,
  30.                            type: 'POST',
  31.                            data: {description: description, cost_price: cost_price, selling_price: selling_price, wprice: wprice, stock: stock}
  32.                        }).done(function (e) {
  33.                            console.log(e);
  34.                        });
  35.                    }
  36.             }
  37.            },{
  38.             id: 'btn-cancel',
  39.             cssClass: 'btn-danger',
  40.                icon: 'glyphicon glyphicon-remove',
  41.             label: ' Cancel',
  42.             action: function (e) {
  43.                    e.close();
  44.             }
  45.            }]
  46.        });
  47. });
19  Programación / Scripting / Re: el script al momento de cifrar los archivos del usb truena python en: 8 Diciembre 2016, 22:29 pm
o no se puediera ?
20  Programación / Scripting / Re: el script al momento de cifrar los archivos del usb truena python en: 8 Diciembre 2016, 02:03 am
funciono solo que si quiero la llave de aes encriptarla con rsa en el mismo for lo abro el archvio .pem o como pudiera hacer algo similar a esto S
Código
  1. HA256.new(password).digest()
Páginas: 1 [2] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines