[Website] Hulp gezocht

Gestart doorPropje12 reacties38 weergaven

13 berichten · pagina 1 van 1

Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo jongens

Vraag 1:
ik heb een foutje ik heb een antiflood script gemaakt heb ik in me systeem gebouwd alleen hij werkt niet?

hier is het script

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl">

<head>
 <title>Nieuwe weetjes? - 71boxes.nl</title>
 <link rel="stylesheet" type="text/css" href="style.css" />
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
 
<body>
        <br/><br/><br/><br/><br/><br/><br/><br/>
        <center>  
    <table>
    <tr><td>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][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][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700]))
{[/COLOR]
    
    [COLOR= #0000BB]$aFouten[/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][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]weetje[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je hebt geen weetje ingevuld[/COLOR][COLOR= #007700];
    }[/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]$aFouten[/COLOR][COLOR= #007700]) !=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]er zijn wat fouten gevonden <br />[/COLOR][COLOR= #007700];[/COLOR]
        
        [URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Fi[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$Fi[/COLOR] [COLOR= #007700]<[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$Fi[/COLOR][COLOR= #007700]++)
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$Fi[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
        }[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br />Klik <a href="javascript:history.go(-1);">hier</a> om terug te gaan.[/COLOR][COLOR= #007700];
    }[/COLOR]
    
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        
        [COLOR= #0000BB]$timeoutseconds[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]20[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$timestamp[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/time"]time[/URL][COLOR= #007700]();[/COLOR]
        [COLOR= #0000BB]$timeout[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]-[/COLOR][COLOR= #0000BB]$timeoutseconds[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DELETE FROM demo WHERE moment<$timeout AND ip="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
        
        [COLOR= #0000BB]$sql_spam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM demo WHERE ip="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/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/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql_spam[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je mag maar 1 keer in de 5 minuten een weetje posten.<br /><a href=javascript:history.go(-1)>Ga terug</a>"[/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 demo (ip,moment) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]                
            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO demo (weetje) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]weetje[/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]"Je hebt succesvol een weetje aangemaakt."[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<meta http-equiv="refresh" content="1;url=admin.php">[/COLOR][COLOR= #007700];
        }
    }
    
}[/COLOR]

[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<form method="post" action="">
weetje toevoegen:<br/>
<textarea name="weetje" rows="15" cols="35"/>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]weetje[/COLOR][COLOR= #007700]];[/COLOR] ?></textarea><br/>
<input type="submit" name="verzenden" value="verzenden">
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>


        </td></tr>
    </table>
        &copy; alle rechten voorbehouden - onderdeel van <A HREF="http://www.zubein.nl">zubein.nl</A>
        </center>
</body>
</html>


Vraag 2:
Hoe kan ik hem beveiligen dat je geen html tags mag gebruiken?
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Vraag 1:
Te lui vooryummie
Vraag 2:
htmlentities();
0
Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Andy waar moet je htmlentities(); inzetten dan?
Maar wil je please vraag 1 ook doen?
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Als je de tekst laat weergeven, dan doe je daar omheen htmlentities();

Voorbeeld:

[COLOR= #0000BB]<?php
$tekst[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Hallo <plaintext>![/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$tekst[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan krijg ik een error
heb het zo

echo <B>Wist u dat?.. </B>;
        echo htmlentities($start1, 0, "weetje);
        echo <br/>;
        echo <br/>;
        echo <input type=button value="Nieuwe weetje kiezen" onClick="window.location.reload()">;


en krijg deze error

Parse error: syntax error, unexpected T_STRING in /home/propje/domains/71boxes.nl/public_html/index.php on line 26

lijn 26:

echo ;
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
je moet niet 3 waardes invullen voor htmlentities(); ...

Zoek anders even op google.
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
post het hele script eens.
0
Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl">

<head>
 <title>Nieuwe weetjes? - 71boxes.nl</title>
 <link rel="stylesheet" type="text/css" href="style.css" />
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
 
<body>
        <br/><br/><br/><br/><br/><br/><br/><br/>
        <center>   
    <table>
    <tr><td>
        [COLOR= #0000BB]<?php[/COLOR]
        [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]SELECT weetje FROM demo ORDER BY Rand() LIMIT 2[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$start1[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br/>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br/>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<B>Wist u dat?.. </B>[/COLOR][COLOR= #007700];[/COLOR]
        ?>
        [COLOR= #0000BB]<?php[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$start1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"weetje);
        ?>
        <?php
        echo <br/>;
        echo <br/>;
        echo <input type=button value="[/COLOR]Nieuwe weetje kiezen[COLOR= #DD0000]" onClick="[/COLOR]window[COLOR= #007700].[/COLOR]location[COLOR= #007700].[/COLOR]reload[COLOR= #007700]()[/COLOR][COLOR= #DD0000]">;
        echo <br/>;
        echo <br/>;
        ?>
        </td></tr>
    </table>
        &copy; alle rechten voorbehouden - onderdeel van <A HREF="[/COLOR]http[COLOR= #007700]:[/COLOR][COLOR= #FF8000]//www.zubein.nl">zubein.nl</A>[/COLOR]
        [COLOR= #007700]<[/COLOR]/center[COLOR= #007700]>
<[/COLOR]/body[COLOR= #007700]>
<[/COLOR]/html[COLOR= #007700]>[/COLOR]


Parse error: syntax error, unexpected T_STRING in /home/propje/domains/71boxes.nl/public_html/index.php on line 30
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
doe de hele regel 25 weg en zet dit er neer:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] htmlenties[COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]weetje[/COLOR][COLOR= #007700]]);
}[/COLOR]
?>


Als het goed is werkt dit.
0
Berichten
262
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
kijk eens heel goed naar je kleurtje van het script!!
die verspringen namelijk hellemaal hoe ze niet zouden moeten.

op regel 25 een " achter weetje toevoegen

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl">

<head>
 <title>Nieuwe weetjes? - 71boxes.nl</title>
 <link rel="stylesheet" type="text/css" href="style.css" />
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
 
<body>
        <br/><br/><br/><br/><br/><br/><br/><br/>
        <center>   
    <table>
    <tr><td>
        [COLOR= #0000BB]<?php[/COLOR]
        [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]SELECT weetje FROM demo ORDER BY Rand() LIMIT 2[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$start1[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br/><br/><B>Wist u dat?.. </B>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$start1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"weetje"[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br/><br/>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type=button value="Nieuwe weetje kiezen" onClick="window.location.reload()">[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br/><br/>[/COLOR][COLOR= #007700];[/COLOR]
        ?>
        </td></tr>
    </table>
        &copy; alle rechten voorbehouden - onderdeel van <A HREF="http://www.zubein.nl">zubein.nl</A>
        </center>
</body>
</html>


en vervolgens beetje css toevoegen scheelt ook veel html roetzooiwink
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
maar dan klopt hij niet, want dat klopt niet met de htmlentities. Als het goed is werkt die van mij.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/COLOR]
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl">
    <head>
        <title>Nieuwe weetjes? - 71boxes.nl</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    </head>
    <body>
        <br/><br/><br/><br/><br/><br/><br/><br/>
        <center>   
            <table>
                <tr>
                    <td>
                        <br/>
                        <br/>
                        <strong>Wist u dat?.. </strong>
[COLOR= #0000BB]<?php
    $query[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]SELECT weetje FROM demo ORDER BY RAND() LIMIT 1[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$start1[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$start1[/COLOR][COLOR= #007700]))
    {[/COLOR]
        
        [COLOR= #0000BB]$weetje[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$start1[/COLOR][COLOR= #007700]);[/COLOR]
?>
                        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$weetje[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]weetje[/COLOR][COLOR= #007700]]);[/COLOR] ?><br/>
[COLOR= #0000BB]<?php[/COLOR]
    [COLOR= #007700]}[/COLOR]
    
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
?>
                        Er kon geen weetje geladen worden
[COLOR= #0000BB]<?php[/COLOR]
    [COLOR= #007700]}[/COLOR]
?>
                        <br/>
                        <input type="button" value="Nieuwe weetje kiezen" onclick="window.location.reload()">
                        <br/>
                        <br/>
                    </td>
                </tr>
            </table>
            &copy; alle rechten voorbehouden - onderdeel van <a href="http://www.zubein.nl">zubein.nl</a>
        </center>
    </body>
</html>

pompom
0
Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Thanx alleen wil die anti flood niet confused
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl">

<head>
 <title>Nieuwe weetjes? - 71boxes.nl</title>
 <link rel="stylesheet" type="text/css" href="style.css" />
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
 
<body>
        <br/><br/><br/><br/><br/><br/><br/><br/>
        <center>  
    <table>
    <tr><td>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][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][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700]))
{[/COLOR]
    
    [COLOR= #0000BB]$aFouten[/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][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]weetje[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je hebt geen weetje ingevuld[/COLOR][COLOR= #007700];
    }[/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]$aFouten[/COLOR][COLOR= #007700]) !=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]er zijn wat fouten gevonden <br />[/COLOR][COLOR= #007700];[/COLOR]
        
        [URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Fi[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$Fi[/COLOR] [COLOR= #007700]<[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$Fi[/COLOR][COLOR= #007700]++)
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$Fi[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
        }[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br />Klik <a href="javascript:history.go(-1);">hier</a> om terug te gaan.[/COLOR][COLOR= #007700];
    }[/COLOR]
    
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        
        [COLOR= #0000BB]$timeoutseconds[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]20[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$timestamp[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/time"]time[/URL][COLOR= #007700]();[/COLOR]
        [COLOR= #0000BB]$timeout[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]-[/COLOR][COLOR= #0000BB]$timeoutseconds[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DELETE FROM demo WHERE moment<$timeout AND ip="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
        
        [COLOR= #0000BB]$sql_spam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM demo WHERE ip="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/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/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql_spam[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je mag maar 1 keer in de 5 minuten een weetje posten.<br /><a href=javascript:history.go(-1)>Ga terug</a>"[/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 demo (ip,moment) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]                
            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO demo (weetje) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]weetje[/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]"Je hebt succesvol een weetje aangemaakt."[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<meta http-equiv="refresh" content="1;url=admin.php">[/COLOR][COLOR= #007700];
        }
    }
    
}[/COLOR]

[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<form method="post" action="">
weetje toevoegen:<br/>
<textarea name="weetje" rows="15" cols="35"/>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]weetje[/COLOR][COLOR= #007700]];[/COLOR] ?></textarea><br/>
<input type="submit" name="verzenden" value="verzenden">
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>


        </td></tr>
    </table>
        &copy; alle rechten voorbehouden - onderdeel van <A HREF="http://www.zubein.nl">zubein.nl</A>
        </center>
</body>
</html>
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