Bestand beveiligen.

Gestart doorReins9 reacties54 weergaven

10 berichten · pagina 1 van 1

Reins

Lid · Topicstarter

Berichten
14.363
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi,
ik heb een bestand op mijn site, een tekst bestand.
Maar nu wil ik dat beveiligen met een wachtwoord, hoe doe ik dat?
Alvast bedankt! biggrin
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$password[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]wachtwoord 1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]wachtwoord2[/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/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ww[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$password[/COLOR][COLOR= #007700])) {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]bestand.txt[/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]Fuck off, onjuiste code.[/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]<form method="post">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="password" name="ww">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="submit" name="submit" value="Inloggen">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</form>[/COLOR][COLOR= #007700];
}[/COLOR]
?>


ff snel gemaakt
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Jponsen schreef:
[COLOR= #0000BB]<?php
$password[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]wachtwoord 1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]wachtwoord2[/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/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ww[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$password[/COLOR][COLOR= #007700])) {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]bestand.txt[/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]Fuck off, onjuiste code.[/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]<form method="post">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="password" name="ww">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="submit" name="submit" value="Inloggen">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</form>[/COLOR][COLOR= #007700];
}[/COLOR]
?>
ff snel gemaakt

Wat is het ww?
0
Berichten
1.054
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$password = array(wachtwoord 1, wachtwoord2);


Dat geeft aan dat je kan inloggen met wachtwoord 1 & wachtwoord2

Die kun je dus wijzigen naar een wachtwoord naar keuze wink
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Quote:
Wat is het ww?

Kan je zelf instellen sm_eerie
$password = array(wachtwoord 1, wachtwoord2);

EDIT >>

Radio was me ff wat te snel
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Als je dat niet handig vind, veranderd dan lijn 2 in

$password = array();
$password[] = Wachtwoord1;
$password[] = Wachtwoord2;


Enz.
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan is het niet beveiligt emo kan je nog altijd naar bestand.txt gaan.
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja, het zal wel moeten, want een txt bestand kan je anders niet beveiligen.
0
Berichten
1.054
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
.txt in een map zetten -> map beveiligen -> klaar
0
Reins

Lid · Topicstarter

Berichten
14.363
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt allemaal biggrin
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