Vraag veilighied.

Gestart doorFreestyle5 reacties9 weergaven

6 berichten · pagina 1 van 1

Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een pagina en ik wil weten of dit overdreven is of dat het nog veiliger kan.

code:
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]functies.php[/COLOR][COLOR= #007700];[/COLOR]
top[COLOR= #007700]();[/COLOR]
menu[COLOR= #007700]();[/COLOR]
links[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= #0000BB]$rang[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"lid"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$avatar[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]http://sitemasterdatabase.nl/uploads/avatar/avatar.png[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]])) 
{[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]])) ||[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/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] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/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] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]av[/COLOR][COLOR= #007700]]))) 
            {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt niet alle velden ingevuld![/COLOR][COLOR= #007700];
            }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                    [URL="http://www.php.net/if"]if[/URL][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]wachtwoord[/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]wachtwoord_con[/COLOR][COLOR= #007700]]))
                    {[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De wachtwoorden komen niet overeen![/COLOR][COLOR= #007700];
                }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                        [COLOR= #0000BB]$user_check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id FROM users WHERE user="[/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]user[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" LIMIT 1"[/COLOR][COLOR= #007700]);[/COLOR]
                        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$user_check[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
                        {[/COLOR] 
                               [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Uw gebruikersnaam is al in gebruik, probeer een ander.[/COLOR][COLOR= #007700];
                    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                            [COLOR= #0000BB]$email_check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id FROM users WHERE email="[/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]" LIMIT 1"[/COLOR][COLOR= #007700]);[/COLOR]
                            [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$email_check[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
                            {[/COLOR] 
                                  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er is al een account met dit email adres geregistreed![/COLOR][COLOR= #007700];
                        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                        

                [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO users (user, wachtwoord, email, reg_datum, reg_ip, rang, avatar, nieuwsbrief, kvk, website)
                                                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]user[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
                                                "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/sha1"]sha1[/URL][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]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][COLOR= #0000BB]$rang[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]",
                                                "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$avatar[/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]nieuwsbrief[/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]kvk[/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]website[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]"
                                                )"[/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]U bent succes vol geregistreerd![/COLOR][COLOR= #007700];
                                }
                        }
                    }
                }
        }[/COLOR]
?>
<h1>Registreren</h1>
    <span>Registreer je hier snel en gratis op [COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$web_naam[/COLOR][COLOR= #007700];[/COLOR] ?></span>
<hr />

<from action="registreer.php" method="POST">
    <p>
        <table width="100%" >
              <tr>
                  <td width="45%"><h1>Registreer hier!</h1></td><td>Snel en gratis!</td>
              </tr>
              <tr>
                  <td>*Gebruikersnaam:</td><td><input size="30px" type="text" name="user" /></td>
              </tr>
              <tr>
                  <td>*Wachtwoord:</td><td><input type="password" size="30px" name="wachtwoord" /></td>
              </tr>
              <tr>
                  <td>*Wachtwoord controle</td><td><input type="password" size="30px" name="wachtwoord_con" /></td>
              </tr>
              <tr>
                  <td>*E-mail adress:</td><td><input type="text" name="email" size="30px" /></td>
              </tr>
          </table>
          <table width="100%">
              <tr>
                  <td width="45%">Niewsbrief:</td><td><input size="50px" type="checkbox" name="nieuwsbrief" value="ja" checked />Ja, ik wil de nieuwsbrief ontvangen.</td>
              </tr>
              <tr>
                  <td>***Kvk nummer:</td><td><input type="text" name="kvk" size="50px" value="N.V.T" /></td>
              </tr>
              <tr>
                  <td>**Website:</td><td><input type="text" width="200px" size="50px" name="website" value="http://www.sitemasterdatabase.nl/" /></td>
              </tr>
              <tr>
                  <td><input type="checkbox" name="av" /> Ik ga akkoord met de algemenen voorwaarden</td><td><a href="av.php">Algemenen voorwaarden</a></td>
              <tr>
                  <td><input type="submit" name="submit" title="Registreer je nu!" /></td><td></td>
              </tr>
          </table>
          * = Verplichte velden<br />
          ** = Er moet: beginnen met http:// en hij moet eindigen met /<br />
          *** = Alleen invullen als je ingeschreven bent bij KVK. (dit word gecontroleerd!)
    </p>
</form>

[COLOR= #0000BB]<?php[/COLOR]
footer[COLOR= #007700]();[/COLOR]
?>
Dus moet ik ook
$ip met mysql_real_escape_string() doen?

dus kan het veiliger zo ja:
hoe en wat

Zo nee:
is het overdreven? ja of nee.

alvast bedankt!
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Je moet die dingen van gebruikers nooit vertrouwen, ik zal het ip ook gewoon escapen..
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Xjessex schreef:
Je moet die dingen van gebruikers nooit vertrouwen, ik zal het ip ook gewoon escapen..
je bedoelt:

[COLOR= #0000BB]<?php[/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]submit[/COLOR][COLOR= #007700]])) 
{[/COLOR]
?>


?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Jup, maar ook gebruikersnamen, email accounts etc, alles wat een gebruiker vrij kan invullen smile.
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Vergeet niet dat een ip ook vervangen kan worden he wink Gewoon voor alle veiligheid alles escapen
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zou nakijken of het ip een ip is.
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