Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Odswiezenie strony bez "mrugniecia" nie dziala, Po wyslaniu wiadomosci odswieza sie strona
arogant
post
Post #1





Grupa: Zarejestrowani
Postów: 47
Pomógł: 0
Dołączył: 16.08.2012
Skąd: Rybnik Śląsk

Ostrzeżenie: (0%)
-----


Witam.
Robie taką jakby księge gości z odświeżaniem AJAX (podobno)
Na dwóch komputerach odpaliłem ta strone i komputer, ktory wysylal wpis odswiezal strone, ale "odbiorca" mial tak jak chce (czyli sie nie odswieza)

Ten skrypt jest z neta ale go troche zmienilem pod siebie
Kod
    <script src="jquery-1.10.2.min.js"></script>
    <script>
        function check(){
            $.ajax({
                type: 'POST',
                url: 'checker.php',
                dataType: 'json',
                data: {
                    counter:$('#message-list').data('counter')
                }
            }).done(function( response ) {
                $('#message-list').data('counter',response.current);
                if(response.update==true){
                    $('#message-list').html(response.news);
                    $("html, body").animate({  scrollTop:1000 }, 700);
                }
            });
        }
        setInterval(check,2000);
    </script>
    <div id="message-list" data-counter="<?php echo (int)$db->check_changes();?>">
        <?php echo $db->get_news();?>
    </div>
    <form action="" method="post">
    <input name="title" placeholder="Twoj wpis... (MAX 1024 znaków)" maxlength="1024" />
    <input type="submit" value="Wyślij!" />
    </form>


Naprowadzi / pomoze ktoś?

pozdrawiam Arogant
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
arogant
post
Post #2





Grupa: Zarejestrowani
Postów: 47
Pomógł: 0
Dołączył: 16.08.2012
Skąd: Rybnik Śląsk

Ostrzeżenie: (0%)
-----


Kod
67. function getStaff($staff){
68. switch($staff){
69. case 0: return "color=\"grey\" style=\"text-shadow:0 0 0px grey;\""; break;


co tu mam zmienić? jak to się pobiera z bazy danych?

Kod
<?php
                        $dbq->query("DELETE FROM news WHERE add_date < SUBTIME(NOW(),'0:10:0')");
                        $nick = "SennyK";
                        $a=$dbq->query("SELECT * FROM users WHERE nick='$nick'");
                        while($user=$a->fetch_assoc()){
                            $staff = $user['staff'];
                            function getStaff($staff){
                                switch($staff){
                                    case 0: return "color=\"grey\" style=\"text-shadow:0 0 0px grey;\""; break;
                                    case 1: return "color=\"blue\" style=\"text-shadow:0 0 6px blue;\""; break;
                                    case 2: return "color=\"#A67D3D\" style=\"text-shadow:0 0 6px #A67D3D;\""; break;
                                    case 3: return "color=\"#E47833\" style=\"text-shadow:0 0 6px #E47833; background: url(assets/img/stars/orange.gif);\""; break;
                                    case 4: return "color=\"#006600\" style=\"text-shadow:0 0 6px green; background: url(assets/img/stars/lgreen.gif);\""; break;
                                    case 5: return "color=\"#FF3333\" style=\"text-shadow:0 0 6px #FF0000; background: url(assets/img/stars/red.gif);\""; break;
                                }
                            }
                            ?>


dobra zrobiłem to tak bo chyba nikt mi nie pomoże..

Kod
// $font = getStaff();
                            switch($staff){
                                    case 0: $font = "color=\"grey\" style=\"text-shadow:0 0 0px grey;\""; break;
                                    case 1: $font = "color=\"blue\" style=\"text-shadow:0 0 6px blue;\""; break;
                                    case 2: $font = "color=\"#A67D3D\" style=\"text-shadow:0 0 6px #A67D3D;\""; break;
                                    case 3: $font = "color=\"#E47833\" style=\"text-shadow:0 0 6px #E47833; background: url(assets/img/stars/orange.gif);\""; break;
                                    case 4: $font = "color=\"#006600\" style=\"text-shadow:0 0 6px green; background: url(assets/img/stars/lgreen.gif);\""; break;
                                    case 5: $font = "color=\"#FF3333\" style=\"text-shadow:0 0 6px #FF0000; background: url(assets/img/stars/red.gif);\""; break;
                                }
                $return .= '<p><img style="margin: 5px 5px 5px 5px;" id="avatar" src="assets/img/'.$user['avatar'].'" height="50" /><font '.$font.'><strong>'.$user['nick'].'</strong></font> | '.htmlspecialchars($r->title).'</p>';
                $return .= '<hr/>';


bez zadnej funkcji

Ten post edytował arogant 14.03.2016, 15:59:04
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 02:10