[php] vraagje

Gestart doorRohimma11 reacties48 weergaven

12 berichten · pagina 1 van 1

Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik ben weer bezig met een ander inlogscript maar er zit een fout in die ik niet kan ondekken

de fout zit op lijn 17

het script:
(het script)
[COLOR= #0000BB]<?php[/COLOR]
                [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]login[/COLOR][COLOR= #007700]]) 
                {[/COLOR]
                    [URL="http://www.php.net/include_once"]include_once[/URL] [COLOR= #DD0000]"connect_to_mysql.php"[/COLOR][COLOR= #007700];[/COLOR]
                    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]);[/COLOR]
                    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]);[/COLOR]
                    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]);[/COLOR]
                    [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/ereg_replace"]ereg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"[^A-Za-z0-9]"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]
                    [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/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 * FROM users WHERE gebruikersnaam=$gebruikersnaam AND wachtwoord=$wachtwoord AND emailactivated=a"[/COLOR][COLOR= #007700]);[/COLOR] 
                    [COLOR= #0000BB]$login_check[/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]
                    
                    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$login_check[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]0[/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_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR] 
                            [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"id"[/COLOR][COLOR= #007700]];[/COLOR] 
                            [URL="http://www.php.net/session_register"]session_register[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]);[/COLOR] 
                            [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$id[/COLOR][COLOR= #007700];[/COLOR]
                        [COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]];[/COLOR]   
                            [URL="http://www.php.net/session_register"]session_register[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]);[/COLOR] 
                            [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700];[/COLOR]
                            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET lastlogin=now() WHERE id=$id"[/COLOR][COLOR= #007700]);[/COLOR] 
                            [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"location: index.php?id=$id"[/COLOR][COLOR= #007700]);[/COLOR] 
                            [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
                        }
                    
                    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font color="#FFFFFF">log in</font><br />Uw gebruikersnaam en wachtwoord komen niet overeen.<br /><br /><a href="index.php">Klik hier</a> om het opnieuw te proberen[/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]<font color="#FFFFFF">log in</font>[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form action="" method="post" enctype="multipart/form-data" name="login" id="login" onsubmit="return validate_form ( );">[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]gebruikersnaam:[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="gebruikersnaam" type="text" id="gebruikersnaam" size="30" maxlength="64" /><br /><br />[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]wachtwoord:<br />[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="wachtwoord" type="password" id="wachtwoord" size="30" maxlength="24" /><br /><br />[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="login" type="submit" value="Login" />[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</form>[/COLOR][COLOR= #007700];
                }[/COLOR]
                ?>
kan iemand mij helpen?
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
En wat is de fout?
0
Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /home/rohimma/domains/rohimma.s3.one2xs.com/public_html/voorbeeld/index.php:5) in /home/rohimma/domains/rohimma.s3.one2xs.com/public_html/voorbeeld/index.php on line 50

Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/rohimma/domains/rohimma.s3.one2xs.com/public_html/voorbeeld/index.php:5) in /home/rohimma/domains/rohimma.s3.one2xs.com/public_html/voorbeeld/index.php on line 50

ff vergeten...
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik gebruik nooit session_register(); ... Haal dat eens weg?
En dan gewoon $_SESSION[iets] = iets;
0
Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
dan is er een fout op lijn 22...

Warning: Cannot modify header information - headers already sent by (output started at /home/rohimma/domains/rohimma.s3.one2xs.com/public_html/voorbeeld/index.php:5) in /home/rohimma/domains/rohimma.s3.one2xs.com/public_html/voorbeeld/index.php on line 54
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Lijn 22.. En daar staat 54.. Post je hele code eens..
0
Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
(Spoiler)
<html>
    <head>
        <title>v1.0</title>
        <link rel="stylesheet" type="text/css" href="style.css" /> 
        <script type="text/javascript">
            function validate_form ( ) { 
                valid = true; 
                if ( document.login.gebruikersnaam.value == "" ) { 
                alert ( "vul uw gebruikersnaam in" ); 
                valid = false;
                }
                if ( document.login.wachtwoord.value == "" ) { 
                    alert ( "vul uw wachtwoord in" ); 
                    valid = false;
                }
                return valid;
            }
            </script>
    </head>
    <body>
        <font size="7" color="#FFFFFF" face="La Bamba LET">rohimma.nl</font>
        <div id="content">
            <div id="menu">
                [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"menu_top.php"[/COLOR][COLOR= #007700];[/COLOR] ?>
            </div>
            
            <div id="gvlak">
            <font color="#FFFFFF">home</font><br />
            Welkom op rohimma.nl.<br /><br />
            Dit is een website die gaat over mijn projecten en dingen die ik heb gemaakt.<br />
            Mijn afgeronde projecten die zijn te zien op de voorbeelden pagina.<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><hr>test
            </div>
            
            <div id="svlak">
                [COLOR= #0000BB]<?php[/COLOR]
                [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]login[/COLOR][COLOR= #007700]]) 
                {[/COLOR]
                    [URL="http://www.php.net/include_once"]include_once[/URL] [COLOR= #DD0000]"connect_to_mysql.php"[/COLOR][COLOR= #007700];[/COLOR]
                    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]);[/COLOR]
                    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]);[/COLOR]
                    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]);[/COLOR]
                    [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/ereg_replace"]ereg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"[^A-Za-z0-9]"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]
                    [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/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 * FROM users WHERE gebruikersnaam=$gebruikersnaam AND wachtwoord=$wachtwoord AND emailactivated=a"[/COLOR][COLOR= #007700]);[/COLOR] 
                    [COLOR= #0000BB]$login_check[/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]
                    
                    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$login_check[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]0[/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_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR] 
                            [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"id"[/COLOR][COLOR= #007700]];[/COLOR]  
                            [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$id[/COLOR][COLOR= #007700];[/COLOR]
                        [COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]];[/COLOR]   
                            [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700];[/COLOR]
                            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET lastlogin=now() WHERE id=$id"[/COLOR][COLOR= #007700]);[/COLOR] 
                            [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"location: index.php?id=$id"[/COLOR][COLOR= #007700]);[/COLOR] 
                            [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
                        }
                    
                    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font color="#FFFFFF">log in</font><br />Uw gebruikersnaam en wachtwoord komen niet overeen.<br /><br /><a href="index.php">Klik hier</a> om het opnieuw te proberen[/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]<font color="#FFFFFF">log in</font>[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form action="" method="post" enctype="multipart/form-data" name="login" id="login" onsubmit="return validate_form ( );">[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]gebruikersnaam:[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="gebruikersnaam" type="text" id="gebruikersnaam" size="30" maxlength="64" /><br /><br />[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]wachtwoord:<br />[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="wachtwoord" type="password" id="wachtwoord" size="30" maxlength="24" /><br /><br />[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="login" type="submit" value="Login" />[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</form>[/COLOR][COLOR= #007700];
                }[/COLOR]
                ?>
            </div>
            
            <div id="svlak2">
            <font color="#FFFFFF">menu</font><br />
            bla <br /><br /><br /><br />bla
            </div>
        </div>
        
    </body>
</html>
alleen maar html er bij.. dacht dat dat niet nodig was
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Header("location: "); moet altijd voor html komen ofzo..
En aangezien je dat na html hebt.. Komt er error..

Dus je moet dat hele login gebeuren boven zetten.

Edit: Dat html was het probleem emo
0
Rohimma

Lid · Topicstarter

Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
het is gelukt bedankt thumbsup
(slotje??)
0
Berichten
1.533
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan je zelf ook
0
Berichten
3.052
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Poedeltje schreef:
Kan je zelf ook
alleen bij aanvragen/ aanbiedingen
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Poedeltje schreef:
Kan je zelf ook
niet in webwereld yummiemaar bij deze...
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