Shahiems Vragen topic XD

Gestart doorShahiem9 reacties32 weergaven

10 berichten · pagina 1 van 1

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een paar vragen daarom deze Vragen topic.

Ik heb een script maar als ik inlog dan zeg hij dat ik niet online ben , Terwijl ik dat wel ben.

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]TITLE[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]Wie is Online?[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL] [COLOR= #DD0000]inc/header.php[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id, naam, muntjes FROM leden WHERE DATE_ADD(laatst_actief, INTERVAL 300 SECOND) > NOW()"[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) !=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Er zijn geen leden online.[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Er zijn <b>[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]</b> leden online.[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Er is <b>1</b> lid online.[/COLOR][COLOR= #007700];
    }[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL]
                [COLOR= #0000BB]$online[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]
                <table width="100%">
                    <tr>
                        <td>Naam:</td>
                        <td>Muntjes:</td>
                    </tr>[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]
                    <tr>
                        <td><a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$link[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]/profiel?id=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]&p=1">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</a></td>
                        <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]muntjes[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
                    </tr>[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]
                </table>[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]
                Er zijn geen leden online.[/COLOR][COLOR= #007700];
}[/COLOR]

[URL="http://www.php.net/require_once"]require_once[/URL] [COLOR= #DD0000]inc/footer.php[/COLOR][COLOR= #007700];[/COLOR]
?>
0
Krm

Lid

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
je vergeet volgens mij dan de session start
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee, zit in de config. En er worden geen sessies gebruikt in de wie is online.
Ik weet dit omdat ik het zelf heb gescript. emo
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Dit kan gewoon 3x korter emo
[COLOR= #0000BB]<?php
    $q[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id, naam, muntjes, count(id) AS aantal_online FROM leden WHERE DATE_ADD(laatst_actief, INTERVAL 300 SECOND) > NOW()"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er [/COLOR] [COLOR= #007700]. ([/COLOR][COLOR= #0000BB]$q[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]aantal_online[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]is 1 gebruiker actief.[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000]zijn [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$q[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]aantal_online[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000] gebruikers actief.[/COLOR][COLOR= #007700]);[/COLOR] 
?>
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Moet ik dat ergens zetten? Of is dat de hele codeemo
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Shahiem schreef:
Moet ik dat ergens zetten? Of is dat de hele codeemo
Dat is van het aantal leden online de code emoDe rest nog niet naar gekeken
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
O okemo
Ik wil ook dat als je meteen uitlogt dat het veranderd, Want nu moet ik paar min wachten.
0
Krm

Lid

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
maar dat heeft nix met deze script te maken dat heeft met sessions te maken
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Daar ligt het helemaal niet aan. confused
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
emoHhahah
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren