[mail] gastenboek hulp

Gestart doorFreestyle9 reacties20 weergaven

10 berichten · pagina 1 van 1

Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
in mijn gastenboek. staat een email check alleen die doet het niet.
hij zegt dat mijn mail adres niet klopt maar hij klopt welconfused
code waar de email check staat:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// ubb.php


// E-mail check[/COLOR]
[COLOR= #007700]function[/COLOR] check_mail[COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700])
{[/COLOR]  
    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/ereg"]ereg[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"[A-Za-z0-9_-]+([.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([.]{1}[A-Za-z0-9-]+)+"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]);  
}[/COLOR]

[COLOR= #FF8000]// UBB Algemeen[/COLOR]
[COLOR= #007700]function[/COLOR] ubb_gastenboek[COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700])
{[/COLOR]
    [COLOR= #FF8000]// De smilies  (Hier je afbeelding namen bijzetten)[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:D[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="/* afbnaam */">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:P[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:)[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:([/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000](@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:S[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000];)[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]

    [COLOR= #FF8000]// De tekst opmaak[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][b][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<b>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][/b][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]</b>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][u][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<u>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][/u][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]</u>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]

    [COLOR= #FF8000]// Een reactie (quote)[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][quote][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<div class="quote">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][/quote][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700];
}[/COLOR]
?>


code waar je je email adress moet in vullen:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// Schrijf.php

// Database connectie maken met database[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Connectie maken met de ubb pagina voor email check[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]ubb.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Als er gepost is checken of er niks vergeten is[/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]// Als de naam niet is ingevult[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [COLOR= #FF8000]// Error[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U bent vergeten uw naam in te vullen[/COLOR][COLOR= #007700];
    }[/COLOR]
    [COLOR= #FF8000]// Anders[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #FF8000]// Als de email niet is ingevult[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]))
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U bent vergeten uw email in te vullen[/COLOR][COLOR= #007700];
        }[/COLOR]
        [COLOR= #FF8000]// Anders[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            [COLOR= #FF8000]// Als email niet klopt[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]check_mail[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]))
            {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft geen geldige email ingevult[/COLOR][COLOR= #007700];
            }[/COLOR]
            [COLOR= #FF8000]// Anders[/COLOR]
            [URL="http://www.php.net/else"]else[/URL]
            [COLOR= #007700]{[/COLOR]
                [COLOR= #FF8000]// Als bericht is ingeveult[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]))
                {[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft geen bericht ingevult[/COLOR][COLOR= #007700];
                }[/COLOR]
                [COLOR= #FF8000]// Anders[/COLOR]
                [URL="http://www.php.net/else"]else[/URL]
                [COLOR= #007700]{[/COLOR]
                    [COLOR= #FF8000]// De mysql_query uitvoeren om alles in de db te zetten[/COLOR]
                    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO 
                                            gastenboek 
                                                (
                                                naam,
                                                email,
                                                bericht,
                                                datum
                                                )
                                        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]naam[/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][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]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]"
                                            NOW()
                                            )
                                        "[/COLOR][COLOR= #007700]);[/COLOR]
                                        
                    [COLOR= #FF8000]// Als de query is gelukt[/COLOR]
                    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])
                    {[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Uw bericht is geplaatst<br>[/COLOR][COLOR= #007700];[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Klik <a href="Lees.php"> hier</a> om naar uw bericht te gaan[/COLOR][COLOR= #007700];
                    }[/COLOR]
                    [COLOR= #FF8000]// Anders[/COLOR]
                    [URL="http://www.php.net/else"]else[/URL]
                    [COLOR= #007700]{[/COLOR]
                        [COLOR= #FF8000]// MySql Error opvangen[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er is een fout opgetreden bij de query: <br />[/COLOR][COLOR= #007700];[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
                    }
                }
            }
        }
    }
}[/COLOR]
[COLOR= #FF8000]// Anders[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]// Het formulier[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form action="" method="post">[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Naam: <input type="text" name="naam"><br>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]E-mail: <input type="text" name="email"><br>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Bericht:<br>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<textarea name="bericht"></textarea>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="submit" value="Verzenden">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</form>[/COLOR][COLOR= #007700];
}[/COLOR]
?>


de config. en de lees pagina zijn denk ik niet nodigwink
0
Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik denk dat je het in de function moet veranderen?bloosCorrect me if Im wron!nerd
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
wat moet ik in function veranderen? (ook wel handig om er bij te zettenwink)
0
Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Post m eens.wink
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
alle scripts bedoel je?

schrijf.php (waar je bericht post)

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// Schrijf.php

// Database connectie maken met database[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Connectie maken met de ubb pagina voor email check[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]ubb.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Als er gepost is checken of er niks vergeten is[/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]// Als de naam niet is ingevult[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [COLOR= #FF8000]// Error[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U bent vergeten uw naam in te vullen[/COLOR][COLOR= #007700];
    }[/COLOR]
    [COLOR= #FF8000]// Anders[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #FF8000]// Als de email niet is ingevult[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]))
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U bent vergeten uw email in te vullen[/COLOR][COLOR= #007700];
        }[/COLOR]
        [COLOR= #FF8000]// Anders[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            [COLOR= #FF8000]// Als email niet klopt[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]check_mail[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]))
            {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft geen geldige email ingevult[/COLOR][COLOR= #007700];
            }[/COLOR]
            [COLOR= #FF8000]// Anders[/COLOR]
            [URL="http://www.php.net/else"]else[/URL]
            [COLOR= #007700]{[/COLOR]
                [COLOR= #FF8000]// Als bericht is ingeveult[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]))
                {[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft geen bericht ingevult[/COLOR][COLOR= #007700];
                }[/COLOR]
                [COLOR= #FF8000]// Anders[/COLOR]
                [URL="http://www.php.net/else"]else[/URL]
                [COLOR= #007700]{[/COLOR]
                    [COLOR= #FF8000]// De mysql_query uitvoeren om alles in de db te zetten[/COLOR]
                    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO 
                                            gastenboek 
                                                (
                                                naam,
                                                email,
                                                bericht,
                                                datum
                                                )
                                        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]naam[/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][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]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]"
                                            NOW()
                                            )
                                        "[/COLOR][COLOR= #007700]);[/COLOR]
                                        
                    [COLOR= #FF8000]// Als de query is gelukt[/COLOR]
                    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])
                    {[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Uw bericht is geplaatst<br>[/COLOR][COLOR= #007700];[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Klik <a href="Lees.php"> hier</a> om naar uw bericht te gaan[/COLOR][COLOR= #007700];
                    }[/COLOR]
                    [COLOR= #FF8000]// Anders[/COLOR]
                    [URL="http://www.php.net/else"]else[/URL]
                    [COLOR= #007700]{[/COLOR]
                        [COLOR= #FF8000]// MySql Error opvangen[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er is een fout opgetreden bij de query: <br />[/COLOR][COLOR= #007700];[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
                    }
                }
            }
        }
    }
}[/COLOR]
[COLOR= #FF8000]// Anders[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]// Het formulier[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form action="" method="post">[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Naam: <input type="text" name="naam"><br>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]E-mail: <input type="text" name="email"><br>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Bericht:<br>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<textarea name="bericht"></textarea>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="submit" value="Verzenden">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</form>[/COLOR][COLOR= #007700];
}[/COLOR]
?>


lees.php (hier kan je de berichten bekijken)

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// Lees.php


// Database connectie maken met database[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Connectie maken met de ubb pagina[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]ubb.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Link naar schrijf pagina[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Klik <a href="Schrijf.php">hier</a> om een bericht te plaatsen[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]// Alles uit db halen laatste bericht als eerste.[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT
                        *,
                        DATE_FORMAT(datum, %d-%m-%Y %H:%i) AS new_date
                    FROM
                        gastenboek
                    ORDER BY
                        datum
                    DESC
                    "[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Als de query is gelukt[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])
{[/COLOR]
    [COLOR= #FF8000]// Als er items zijn[/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= #FF8000]// Items neerzetten[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$rec[/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]
            [COLOR= #FF8000]// Alles echoën[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Naam: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$rec[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]E-Mail: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$rec[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Gepost op: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$rec[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]new_date[/COLOR][COLOR= #007700]];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Bericht: <br>[/COLOR][COLOR= #007700].[/COLOR]ubb_gastenboek[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rec[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]);[/COLOR]
            
            [COLOR= #FF8000]// Lijntje[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><hr><br>[/COLOR][COLOR= #007700];
        }
    }[/COLOR]
    [COLOR= #FF8000]// Anders[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #FF8000]// Geen berichten[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er zijn nog geen gastenboek berichten.[/COLOR][COLOR= #007700];
    }    
}[/COLOR]
[COLOR= #FF8000]// Anders[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]// MySql error[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er is een fout opgetreden in de query: <br />[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
}[/COLOR]
?>


config

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// Config.php[/COLOR]

[COLOR= #0000BB]$host[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"localhost"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Je host[/COLOR]
[COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"root"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Je MySQL gebruikersnaam[/COLOR]
[COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Je MySQL wachtwoord[/COLOR]
[COLOR= #0000BB]$datb[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"gast"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Je MySQL database

// Verbinding maken[/COLOR]
[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$host[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$user[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$pass[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"Er is een fout bij het connectie maken met de DataBase"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$datb[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"Er is een fout bij het selecteren van de DataBase"[/COLOR][COLOR= #007700]);[/COLOR]
?>


next >>


ubb.php (hier word ook email gechekt)

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// ubb.php


// E-mail check[/COLOR]
[COLOR= #007700]function[/COLOR] check_mail[COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700])
{[/COLOR]  
    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/ereg"]ereg[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"[A-Za-z0-9_-]+([.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([.]{1}[A-Za-z0-9-]+)+"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]);  
}[/COLOR]

[COLOR= #FF8000]// UBB Algemeen[/COLOR]
[COLOR= #007700]function[/COLOR] ubb_gastenboek[COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700])
{[/COLOR]
    [COLOR= #FF8000]// De smilies  (Hier je afbeelding namen bijzetten)[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:D[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="/* afbnaam */">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:P[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:)[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:([/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000](@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:S[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000];)[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]:@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<img src="">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]

    [COLOR= #FF8000]// De tekst opmaak[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][b][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<b>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][/b][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]</b>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][u][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<u>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][/u][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]</u>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]

    [COLOR= #FF8000]// Een reactie (quote)[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][quote][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]<div class="quote">[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000][/quote][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hij staat eremo
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ja hij staat er.
maar hij doet het nietconfused.
probeer het zelf maarwink
error:
Deprecated: Function ereg() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/login/ubb.php on line 8
U heeft geen geldige email ingevult

(ik heb het email adress goed ingevult)
0
Jort

Lid

Berichten
524
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// E-mail check[/COLOR]
[COLOR= #007700]function[/COLOR] check_mail[COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700])
{[/COLOR]  
    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/eregi"]eregi[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"^[a-z0-9_-]+[a-z0-9_.-]*@[a-z0-9_-]+[a-z0-9_.-]*.[a-z]{2,5}$"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700]);  
}[/COLOR]

?>
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
BEDANKTwink
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
OMG emoDie error had je niet gegeven he.
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