registeren.php hulp!

Gestart doorFreestyle11 reacties20 weergaven

12 berichten · pagina 1 van 1

Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een pagina waar je je kan registeren, maar hij voegt geen leden toeconfused
script:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]inc/config.php[/COLOR][COLOR= #007700];[/COLOR]
top[COLOR= #007700]();[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700]) {[/COLOR] 
    [COLOR= #FF8000]// Hier komt alle behandeling van het formulier 
     
    // Mocht er een fout optreden, is het leuk dat de gebruiker niet alles opnieuw hoeft 
    // in te vullen. Daarom vullen we de array $post met de velden, 
    // uiteraard door htmlentities() gehaald (veiligheidsmaatregel). 
    // Wachtwoord moeten wel opnieuw ingevuld worden, nogmaals veiligheidsmaatsregel [/COLOR]
    [COLOR= #0000BB]$post[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR] 
                [COLOR= #DD0000]gebruikersnaam[/COLOR]    [COLOR= #007700]=>[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]),[/COLOR] 
                [COLOR= #DD0000]email[/COLOR]                [COLOR= #007700]=>[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]));[/COLOR] 
     
    [COLOR= #FF8000]// Verwerking 
     
    // Eerst enkele functies schrijven die de controle vergemakkelijken [/COLOR]
    [COLOR= #007700]function[/COLOR] geregistreerd[COLOR= #007700]([/COLOR][COLOR= #0000BB]$zoek[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$veld[/COLOR][COLOR= #007700]) {[/COLOR] 
        [COLOR= #FF8000]// Ik plaats de query op meerdere lijnen voor de leesbaarheid [/COLOR]
        [COLOR= #0000BB]$qZoek[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" 
            SELECT COUNT("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$veld[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]") 
                      FROM leden 
                   WHERE "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$veld[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$zoek[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] 
                    
        [COLOR= #FF8000]// Als de gebruikersnaam nog niet bestaat, geeft dit false, anders true [/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_result"]mysql_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qZoek[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]?[/COLOR] false [COLOR= #007700]:[/COLOR] true[COLOR= #007700]); 
    }[/COLOR] 
     
    [COLOR= #FF8000]// De reguliere expressies voor de controle op e-mailadressen is door FangorN samengesteld :] [/COLOR]
    [COLOR= #007700]function[/COLOR] is_email[COLOR= #007700]([/COLOR][COLOR= #0000BB]$in[/COLOR][COLOR= #007700]) {[/COLOR] 
        [URL="http://www.php.net/list"]list[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$local[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$host[/COLOR][COLOR= #007700]) =[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$in[/COLOR][COLOR= #007700]);[/COLOR] 
        [COLOR= #0000BB]$pattern_local[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?).[/COLOR] 
                       [COLOR= #007700].[/COLOR] [COLOR= #DD0000]([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)$[/COLOR][COLOR= #007700];[/COLOR]  
        [COLOR= #0000BB]$pattern_host[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]^([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?).([-]?)[/COLOR] 
                      [COLOR= #007700].[/COLOR] [COLOR= #DD0000][0-9a-z]*([-]?[0-9a-z]+)+)*.[a-z]{2,4}$[/COLOR][COLOR= #007700];[/COLOR]  
        [COLOR= #0000BB]$match_local[/COLOR]   [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/eregi"]eregi[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pattern_local[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$local[/COLOR][COLOR= #007700]);[/COLOR] 
        [COLOR= #0000BB]$match_host[/COLOR]    [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/eregi"]eregi[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pattern_host[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$host[/COLOR][COLOR= #007700]);[/COLOR] 
         
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$match_local[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$match_host[/COLOR] [COLOR= #007700]?[/COLOR] true [COLOR= #007700]:[/COLOR] false[COLOR= #007700]); 
    }[/COLOR] 
    
    [COLOR= #0000BB]$datum[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"d-M-Y H:i"[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$ip[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]];[/COLOR]
     
    [COLOR= #FF8000]// Hier zullen we de fouten in opslaan [/COLOR]
    [COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR] 
     
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][]    =[/COLOR] [COLOR= #DD0000]Er is geen gebruikersnaam opgegeven.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]) >[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700]) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]De gebruikersnaam mag niet langer dan 50 tekens zijn.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR]geregistreerd[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]De gebruikersnaam is reeds geregistreerd.[/COLOR][COLOR= #007700]; 
    }[/COLOR] 
     
     
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][]    =[/COLOR] [COLOR= #DD0000]Er is geen wachtwoord opgegeven.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord_con[/COLOR][COLOR= #007700]]) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]De wachtwoorden komen niet overeen.[/COLOR][COLOR= #007700]; 
    }[/COLOR] 
     
     
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR]is_email[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Er is geen geldig e-mailadres opgegeven.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR]geregistreerd[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #DD0000]email[/COLOR][COLOR= #007700])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Dit e-mailadres is reeds geregistreerd.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]])) {[/COLOR]
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Er is geen e-mailadres opgegeven[/COLOR][COLOR= #007700];
    }[/COLOR]
     
    [COLOR= #FF8000]// Het formulier is gecontroleerd, nu kijken we of er fouten opgetreden zijn [/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR] 
        ?> 
        <span style="color: #FF0000; ">De volgende fouten zijn opgetreden:</span> 
        <ul> 
            [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$fout[/COLOR][COLOR= #007700]) {[/COLOR] ?> 
                <li><?=$fout?></li> 
            [COLOR= #0000BB]<?php[/COLOR] [COLOR= #007700]}[/COLOR] ?> 
        </ul> 
        [COLOR= #0000BB]<?php[/COLOR] 
    [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] 
        [COLOR= #FF8000]// Er zijn geen fouten, voer registratie uit! [/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO leden 
                                 (gebruikersnaam, wachtwoord, email, datum, ip, status) 
                                 VALUES 
                                 ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", 
                                  "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", 
                                  "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", 
                                  "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datum[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]",
                                  "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$ip[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"
                                 )"[/COLOR][COLOR= #007700]); 
               
    }[/COLOR] 
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Bedankt voor het registreren![/COLOR][COLOR= #007700];
    
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] 
    [COLOR= #FF8000]// Dit stuk wordt uitgevoerd als het formulier nog niet is verzonden. 
     
    // Het formulier is nog niet verzonden, dus is er ook geen $post array. 
    // we maken deze dus zelf aan met initiele waardes, om warnings te voorkomen. [/COLOR]
    [COLOR= #0000BB]$post[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR]     
                [COLOR= #DD0000]gebruikersnaam[/COLOR]     [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] 
                [COLOR= #DD0000]email[/COLOR]                [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]); 
}[/COLOR] 

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$verberg_form[/COLOR][COLOR= #007700])) {[/COLOR] 
    ?> 
    <form action="<?=htmlentities($_SERVER[REQUEST_URI])?>" method="post"> 
        Gewenste gebruikersnaam:<br /> 
        <input type="text" name="gebruikersnaam" value="<?=$post[gebruikersnaam]?>" /><br /> 
        Wachtwoord:<br /> 
        <input type="password" name="wachtwoord" /><br /> 
        Wachtwoord controle:<br /> 
        <input type="password" name="wachtwoord_con" /><br /> 
        E-mailadres:<br /> 
        <input type="text" name="email"  value="<?=$post[email]?>" /><br /> 
        <br /> 
        <input type="submit" value="Registreer" /> 
    </form> 
    [COLOR= #0000BB]<?php[/COLOR] 
[COLOR= #007700]}[/COLOR] 
menu[COLOR= #007700]();[/COLOR]
foot[COLOR= #007700]();[/COLOR]
?>


beloning: 0,3
hij moet het helemaal doen!
0
Berichten
6.722
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]inc/config.php[/COLOR][COLOR= #007700];[/COLOR]
top[COLOR= #007700]();[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700]) {[/COLOR] 
    [COLOR= #FF8000]// Hier komt alle behandeling van het formulier 
     
    // Mocht er een fout optreden, is het leuk dat de gebruiker niet alles opnieuw hoeft 
    // in te vullen. Daarom vullen we de array $post met de velden, 
    // uiteraard door htmlentities() gehaald (veiligheidsmaatregel). 
    // Wachtwoord moeten wel opnieuw ingevuld worden, nogmaals veiligheidsmaatsregel [/COLOR]
    [COLOR= #0000BB]$post[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR] 
                [COLOR= #DD0000]gebruikersnaam[/COLOR]    [COLOR= #007700]=>[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]),[/COLOR] 
                [COLOR= #DD0000]email[/COLOR]                [COLOR= #007700]=>[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]));[/COLOR] 
     
    [COLOR= #FF8000]// Verwerking 
     
    // Eerst enkele functies schrijven die de controle vergemakkelijken [/COLOR]
    [COLOR= #007700]function[/COLOR] geregistreerd[COLOR= #007700]([/COLOR][COLOR= #0000BB]$zoek[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$veld[/COLOR][COLOR= #007700]) {[/COLOR] 
        [COLOR= #FF8000]// Ik plaats de query op meerdere lijnen voor de leesbaarheid [/COLOR]
        [COLOR= #0000BB]$qZoek[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" 
            SELECT COUNT("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$veld[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]") 
                      FROM leden 
                   WHERE "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$veld[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$zoek[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] 
                    
        [COLOR= #FF8000]// Als de gebruikersnaam nog niet bestaat, geeft dit false, anders true [/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_result"]mysql_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qZoek[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]?[/COLOR] false [COLOR= #007700]:[/COLOR] true[COLOR= #007700]); 
    }[/COLOR] 
     
    [COLOR= #FF8000]// De reguliere expressies voor de controle op e-mailadressen is door FangorN samengesteld :] [/COLOR]
    [COLOR= #007700]function[/COLOR] is_email[COLOR= #007700]([/COLOR][COLOR= #0000BB]$in[/COLOR][COLOR= #007700]) {[/COLOR] 
        [URL="http://www.php.net/list"]list[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$local[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$host[/COLOR][COLOR= #007700]) =[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$in[/COLOR][COLOR= #007700]);[/COLOR] 
        [COLOR= #0000BB]$pattern_local[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?).[/COLOR] 
                       [COLOR= #007700].[/COLOR] [COLOR= #DD0000]([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)$[/COLOR][COLOR= #007700];[/COLOR]  
        [COLOR= #0000BB]$pattern_host[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]^([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?).([-]?)[/COLOR] 
                      [COLOR= #007700].[/COLOR] [COLOR= #DD0000][0-9a-z]*([-]?[0-9a-z]+)+)*.[a-z]{2,4}$[/COLOR][COLOR= #007700];[/COLOR]  
        [COLOR= #0000BB]$match_local[/COLOR]   [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/eregi"]eregi[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pattern_local[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$local[/COLOR][COLOR= #007700]);[/COLOR] 
        [COLOR= #0000BB]$match_host[/COLOR]    [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/eregi"]eregi[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pattern_host[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$host[/COLOR][COLOR= #007700]);[/COLOR] 
         
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$match_local[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$match_host[/COLOR] [COLOR= #007700]?[/COLOR] true [COLOR= #007700]:[/COLOR] false[COLOR= #007700]); 
    }[/COLOR] 
    
    [COLOR= #0000BB]$datum[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"d-M-Y H:i"[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$ip[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]];[/COLOR]
     
    [COLOR= #FF8000]// Hier zullen we de fouten in opslaan [/COLOR]
    [COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR] 
     
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][]    =[/COLOR] [COLOR= #DD0000]Er is geen gebruikersnaam opgegeven.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]) >[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700]) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]De gebruikersnaam mag niet langer dan 50 tekens zijn.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR]geregistreerd[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]De gebruikersnaam is reeds geregistreerd.[/COLOR][COLOR= #007700]; 
    }[/COLOR] 
     
     
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][]    =[/COLOR] [COLOR= #DD0000]Er is geen wachtwoord opgegeven.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord_con[/COLOR][COLOR= #007700]]) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]De wachtwoorden komen niet overeen.[/COLOR][COLOR= #007700]; 
    }[/COLOR] 
     
     
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR]is_email[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Er is geen geldig e-mailadres opgegeven.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR]geregistreerd[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #DD0000]email[/COLOR][COLOR= #007700])) {[/COLOR] 
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Dit e-mailadres is reeds geregistreerd.[/COLOR][COLOR= #007700]; 
    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]])) {[/COLOR]
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Er is geen e-mailadres opgegeven[/COLOR][COLOR= #007700];
    }[/COLOR]
     
    [COLOR= #FF8000]// Het formulier is gecontroleerd, nu kijken we of er fouten opgetreden zijn [/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR] 
        ?> 
        <span style="color: #FF0000; ">De volgende fouten zijn opgetreden:</span> 
        <ul> 
            [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$fout[/COLOR][COLOR= #007700]) {[/COLOR] ?> 
                <li><?=$fout?></li> 
            [COLOR= #0000BB]<?php[/COLOR] [COLOR= #007700]}[/COLOR] ?> 
        </ul> 
        [COLOR= #0000BB]<?php[/COLOR] 
    [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] 
        [COLOR= #FF8000]// Er zijn geen fouten, voer registratie uit! [/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO leden 
                                 (gebruikersnaam, wachtwoord, email, datum, ip) 
                                 VALUES 
                                 ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", 
                                  "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/sha1"]sha1[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", 
                                  "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", 
                                  "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datum[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]",
                                  "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$ip[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"
                                 )"[/COLOR][COLOR= #007700]); 
               
    }[/COLOR] 
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Bedankt voor het registreren![/COLOR][COLOR= #007700];
    
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] 
    [COLOR= #FF8000]// Dit stuk wordt uitgevoerd als het formulier nog niet is verzonden. 
     
    // Het formulier is nog niet verzonden, dus is er ook geen $post array. 
    // we maken deze dus zelf aan met initiele waardes, om warnings te voorkomen. [/COLOR]
    [COLOR= #0000BB]$post[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR]     
                [COLOR= #DD0000]gebruikersnaam[/COLOR]     [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] 
                [COLOR= #DD0000]email[/COLOR]                [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]); 
}[/COLOR] 

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$verberg_form[/COLOR][COLOR= #007700])) {[/COLOR] 
    ?> 
    <form action="<?=htmlentities($_SERVER[REQUEST_URI])?>" method="post"> 
        Gewenste gebruikersnaam:<br /> 
        <input type="text" name="gebruikersnaam" value="<?=$post[gebruikersnaam]?>" /><br /> 
        Wachtwoord:<br /> 
        <input type="password" name="wachtwoord" /><br /> 
        Wachtwoord controle:<br /> 
        <input type="password" name="wachtwoord_con" /><br /> 
        E-mailadres:<br /> 
        <input type="text" name="email"  value="<?=$post[email]?>" /><br /> 
        <br /> 
        <input type="submit" value="Registreer" /> 
    </form> 
    [COLOR= #0000BB]<?php[/COLOR] 
[COLOR= #007700]}[/COLOR] 
menu[COLOR= #007700]();[/COLOR]
foot[COLOR= #007700]();[/COLOR]
?>
0
Berichten
707
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat zou bij TUTS moeten staan.
0
Berichten
6.722
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Brechtje schreef:
Dat zou bij TUTS moeten staan.
Weet je zelf wel hoe dom deze reactie is? emo
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Wiitse schreef:
Eerdere citaten tonen
Brechtje schreef:
Dat zou bij TUTS moeten staan.
Weet je zelf wel hoe dom deze reactie is? emo
Faal reactie emo
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Raoulfloks schreef:
Eerdere citaten tonen
Wiitse schreef:
Eerdere citaten tonen
Brechtje schreef:
Dat zou bij TUTS moeten staan.
Weet je zelf wel hoe dom deze reactie is? emo
Faal reactie emo
Die van wiitse? Hij heeft nochtans gelijk.
0
Berichten
6.722
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Via msn heeft Marijn (Freestyle) trouwens verteld dat het werkt en ik heb de 0,3 punten gekregen. smile
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
alemaalte wat is er dan nog fout?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Alemaalte schreef:
Eerdere citaten tonen
Raoulfloks schreef:
Eerdere citaten tonen
Wiitse schreef:
Eerdere citaten tonen
Brechtje schreef:
Dat zou bij TUTS moeten staan.
Weet je zelf wel hoe dom deze reactie is? emo
Faal reactie emo
Die van wiitse? Hij heeft nochtans gelijk.
Nee die van Brechtje
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Freestyle schreef:
alemaalte wat is er dan nog fout?
Waar zeg ik dat er nog iets fout is? Hier kan trouwens een slotje op want het is opgelost.
0
Berichten
6.722
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Freestyle schreef:
alemaalte wat is er dan nog fout?
Niks. Ik reageerde op Brechtje. Allemaaltje gaf me met die reactie gelijk. Niks aan de hand dus. yummie
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
oo oke, verkeerd begrepen, ik zal report maken met de vraag of ze het sluiten.
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