Vragen topic van mij

Gestart doorJesper117 reacties633 weergaven

118 berichten · pagina 6 van 8

Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jespar schreef:
[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]==[/COLOR]voorbeeld[COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Goedzo[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]();[/COLOR] [COLOR= #FF8000]// dit is uitzondering, weet dat het afgeraden is[/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]Kijk hem nog eens na![/COLOR][COLOR= #007700];
}[/COLOR]

?>
<form method="post" action="index.php">

            Wachtwoord<br />
            <input type="password" name="password" /><br />
            <input type="submit" name="submit" value="Log in" />

</form>
Ik weet niet of ik goed bezig ben maar ik wil een licentie systeem in, als je het wachtwoord voorbeeld intypt is ie goed en de rest niet goed. Als hij goed is moet hij een pagina showen
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
http://manxi.nl/nieuws/index.php

toevoeging op 18 februari 2012, 17:00:45:
Hij werkt dus niet..
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Leer het eens. Kijk op de vorige pagina en controleer dus of er wel op het submit knopje is gedrukt.

toevoeging op 18 februari 2012, 17:03:02:
En $password bestaat niet. Het zal $_POST[password] moeten zijn.
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja, dacht er net aan

toevoeging op 18 februari 2012, 17:04:35:
Hij werkt!
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[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]"DELETE FROM moppen WHERE id = "[/COLOR][COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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]Succesvol verwijderd! <a href="index.php">Klik hier</a>[/COLOR][COLOR= #007700]; 


    
}[/COLOR]

?>


Waarom laat hij succesvol verwijderd al zien, terwijl hij hem nog niet eens verzonden heeft?

toevoeging op 19 februari 2012, 19:42:01:
Laatmaar Met:
if(isset($_POST[submit]))
Werkt hij

En met:
if($_SERVER[REQUEST_METHOD]="POST")

Faalt ie!
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jespar schreef:
[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]
[COLOR= #FF8000]// hierboven moet == ipv =[/COLOR]

        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DELETE FROM moppen WHERE id = "[/COLOR][COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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]Succesvol verwijderd! <a href="index.php">Klik hier</a>[/COLOR][COLOR= #007700];
}[/COLOR]

?>
Waarom laat hij succesvol verwijderd al zien, terwijl hij hem nog niet eens verzonden heeft?

toevoeging op 19 februari 2012, 19:42:01:
Laatmaar Met:
if(isset($_POST[submit]))
Werkt hij

En met:
if($_SERVER[REQUEST_METHOD]="POST")

Faalt ie!

Ik heb gefixt. Gebruik deze. Andere is onveilig en slecht.
0
Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wtf is dat voor uitlijning? emo
toevoeging op 19 februari 2012, 19:45:45:
@Jespar.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
if($_SERVER[REQUEST_METHOD]="POST")


is fout. Je doet een vergelijking met POST, dus gebruik dan ==.
Een enkele = staat voor een toewijzing.

En doe wat aan je foutafhandeling....
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]database.php[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<h1>Categorie veranderen</h1>[/COLOR][COLOR= #007700];[/COLOR]




[COLOR= #0000BB]$sqla[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM categorie ORDER BY id DESC LIMIT 10"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$resa[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sqla[/COLOR][COLOR= #007700])) {[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$resa[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"</b> | <b>ID: "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$resa[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]"</b> <br />"[/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/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE categorie SET categorie="[/COLOR][COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/COLOR][COLOR= #007700]])) .[/COLOR] [COLOR= #DD0000]" WHERE id="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/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]Succesvol veranderd! <a href="index.php">Klik hier</a>[/COLOR][COLOR= #007700];
}[/COLOR]


?>

<form method="post" action="cveranderen.php">
ID: <input type="text" name="id" /><br />
Naam: <input type="text" name="categorie" /><br />
<input type="submit" name="submit" value="Verwijder" />
</form>


Waarom past hij niks aan, alles doet hij hij zeg succesvol veranderd maar hij past niks aan?!?!
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Wordt het niet eerst even tijd voor fatsoenlijke foutafhandeling om je querys heen?
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Jespar schreef:
Nee
In dat geval: Kap met PHP en ga lekker punnikken. Als je toch zo laf bent om niks met andermands adviezen te doen, dan is PHP echt niet voor je weggelegd.

je maakt je eigen trouwens wel een beetje belachelijk met die signature zo...
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt, iemand anders een oplossing
Jespar schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]database.php[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<h1>Categorie veranderen</h1>[/COLOR][COLOR= #007700];[/COLOR]




[COLOR= #0000BB]$sqla[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM categorie ORDER BY id DESC LIMIT 10"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$resa[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sqla[/COLOR][COLOR= #007700])) {[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$resa[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"</b> | <b>ID: "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$resa[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]"</b> <br />"[/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/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE categorie SET categorie="[/COLOR][COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/COLOR][COLOR= #007700]])) .[/COLOR] [COLOR= #DD0000]" WHERE id="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]categorie[/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]Succesvol veranderd! <a href="index.php">Klik hier</a>[/COLOR][COLOR= #007700];
}[/COLOR]


?>

<form method="post" action="cveranderen.php">
ID: <input type="text" name="id" /><br />
Naam: <input type="text" name="categorie" /><br />
<input type="submit" name="submit" value="Verwijder" />
</form>
Waarom past hij niks aan, alles doet hij hij zeg succesvol veranderd maar hij past niks aan?!?!
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Zie mijn advies, en steek niet je kop in het zand.
En je bent ook behoorlijk vatbaar voor hackers. (sql injection enzo)
0
Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je escaped het de eerste keer wel, en de andere keer niet? Ja, lekker veilig, zoals Aarclay al zegt.
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