Scriptjes

Gestart doorErik22 reacties35 weergaven

23 berichten · pagina 1 van 2

Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey,
In dit topic post ik een aantal scriptjes die ik heb gemaakt voor jullie.
Deze mag je niet doorverkopen.

Script 1: Pagina systeem
Ik heb dit scriptje voor Nielsie gemaakt, omdat hij dat nodig had voor zijn site.
Nu publiceer ik dit gratis voor iedereen.
Code (PHP):

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]localhost[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]root[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]****[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]root[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
                   SELECT
                           naam,
                        link
                    FROM
                        paginas
                    ORDER BY
                        id
                    ASC
                    "[/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[/COLOR][COLOR= #007700]) !=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]))
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<a href="[/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]],[/COLOR] ENT_QUOTES[COLOR= #007700]).[/COLOR][COLOR= #DD0000]">[/COLOR][COLOR= #007700].[/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]],[/COLOR] ENT_QUOTES[COLOR= #007700]).[/COLOR][COLOR= #DD0000]</a>[/COLOR][COLOR= #007700];
    }
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er zijn (nog) geen paginas.[/COLOR][COLOR= #007700];
}[/COLOR]
?>


MySQL:

CREATE TABLE paginas (
id            INT(11) NOT NULL AUTO_INCREMENT,
naam        VARCHAR(255) NOT NULL,
link        VARCHAR(255) NOT NULL,

PRIMARY KEY id (id)
);


Veel plezier ermee!
Ik zal dit topic regelmatig updaten met nieuwe scripts.
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
TNX smile
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Alsje. smile
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
sorry voor bumb maar beter topic omhoog halen dan nieuwe maken
ik heb nu de 2de link erin gezet
en hij zet er geen enters in
hoe kan ik dit doen?
0
Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nielsie:
sorry voor bumb maar beter topic omhoog halen dan nieuwe maken
ik heb nu de 2de link erin gezet
en hij zet er geen enters in
hoe kan ik dit doen?

heb je:


of
allemaal al geprobeerd?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
ohw ja werkt nu =D
0
Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
oke
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
weet iemand ook hoe ik een formulier maak om een link toe te voegen?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
ik heb zelf gemaakt smilevoor de mensen die dit script gebruiken en Het script ook willen:

<form name="form1" id="form1" method="post" action="LINK VAN SITE">
wat is de link?<br />
<INPUT TYPE="text" NAME="link" VALUE="Link zonder /"><br />
wat is de naam?<br />
<INPUT TYPE="text" NAME="naam" VALUE="Pagina naam"><br />
<INPUT TYPE="submit" NAME="submit" VALUE="update"><br />
</FORM>
        [COLOR= #0000BB]<?php[/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/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO `paginas` (id, link, naam) VALUES (NULL, "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/print"]print[/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]" Succesvol link toegevoegd"[/COLOR][COLOR= #007700];
        }[/COLOR]
        ?>


ben blij dat het is gelukt =D
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nielsie:
ik heb zelf gemaakt smilevoor de mensen die dit script gebruiken en Het script ook willen:

<form name="form1" id="form1" method="post" action="LINK VAN SITE">
wat is de link?<br />
<INPUT TYPE="text" NAME="link" VALUE="Link zonder /"><br />
wat is de naam?<br />
<INPUT TYPE="text" NAME="naam" VALUE="Pagina naam"><br />
<INPUT TYPE="submit" NAME="submit" VALUE="update"><br />
</FORM>
        [COLOR= #0000BB]<?php[/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/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO `paginas` (id, link, naam) VALUES (NULL, "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/print"]print[/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]" Succesvol link toegevoegd"[/COLOR][COLOR= #007700];
        }[/COLOR]
        ?>


ben blij dat het is gelukt =D

[COLOR= #0000BB]<?php[/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/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO `paginas` (id, link, naam) VALUES (NULL, "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/print"]print[/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]" Succesvol link toegevoegd"[/COLOR][COLOR= #007700];
        }[/COLOR]
        ?>
<form name="form1" method="post" action="">
wat is de link?<br />
<input type="text" NAME="link" VALUE="Link zonder /"><br />
wat is de naam?<br />
<input type="text" NAME="naam" VALUE="Pagina naam"><br />
<input type="submit" NAME="submit" VALUE="update"><br />
</fORM>


Dit is beteremo
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Nog beter is om alle html-tags lowercase te doen emo
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nog beter is om te checken of er velden zijn ingevuld, en MySQL exploits tegen gaan. emo
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
erik wilde me niet helpen dus kon het niet beter doen
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Erik schreef:
Nog beter is om te checken of er velden zijn ingevuld, en MySQL exploits tegen gaan. emo
Zoiets:

[COLOR= #0000BB]<?php[/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/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]link[/COLOR][COLOR= #007700]]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]))
        {[/COLOR]
            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO paginas (link, naam) 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]link[/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]naam[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/trigger_error"]trigger_error[/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]Succesvol link toegevoegd[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U bent vergeten een veld in te vullen[/COLOR][COLOR= #007700];
        }
    }[/COLOR]
?>
<form name="form1" method="POST">
    <strong>Wat is de link?</strong><br />
    <small>De link moet beginnen met http:// en mag niet eindigen met een /</small><br />
    <input type="text" name="link" /><br /><br />

    <strong>Wat is de naam?</strong><br />
    <input type="text" naam="naam" /><br /><br />

    <input type="submit" name="submit" value="Voeg toe">
</form>
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Rik schreef:
Eerdere citaten tonen
Erik schreef:
Nog beter is om te checken of er velden zijn ingevuld, en MySQL exploits tegen gaan. emo
Zoiets:

CODE

die geeft parse errors
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