Waarom geen update?

Gestart doorWouterp26 reacties69 weergaven

27 berichten · pagina 1 van 2

Wouterp

Lid · Topicstarter

Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waarom word er niet geupdated? De verbinding is oke en alles(Script is nog niet helemaal veilig maar dat komt nog)
@aarclay SORRY VOOR DE GEEN FOUT AFHANDELING ;(

[COLOR= #0000BB]<?php[/COLOR]

[COLOR= #FF8000]/**
 * @author      Wouter Polman
 * @copyright   2012
 * @link        Letsweb.nl
 * @version     1.0
 * @license     Personal
 */[/COLOR]
[URL="http://www.php.net/require"]require[/URL] [COLOR= #DD0000]connect.php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$name[/COLOR]   [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$get[/COLOR]    [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$id[/COLOR]     [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruiker[/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 * FROM gebruikers WHERE gebruikersnaam = "[/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]username[/COLOR][COLOR= #007700]]) .[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$row[/COLOR]     [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$email[/COLOR]      [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$username[/COLOR]     [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$id[/COLOR]         [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$rank[/COLOR]        [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rank[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$reg_ip[/COLOR]        [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]reg_ip[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$log_ip[/COLOR]        [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]log_ip[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$ban[/COLOR]        [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ban[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$punten[/COLOR]      [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]punten[/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]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruiker[/COLOR][COLOR= #007700]]))
{[/COLOR]

    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rank[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt geen toestemming om deze pagina te bekijken[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rank[/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 gebruikers SET
        gebruikersnaam="[/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]username[/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][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        id="[/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]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        rank="[/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]rank[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        reg_ip="[/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]reg_ip[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        log_ip="[/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]log_ip[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        ban="[/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]ban[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        punten="[/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]punten[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        WHERE gebruikersnaam="[/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]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]")
     "[/COLOR][COLOR= #007700]);
}}
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        
?>
        <head>
        <title>Leden beheren</title>
        </head>
        <body>
        <form name="input" method="post">
        <b>Naam</b></br>
        <input type="text" name="username" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$username[/COLOR] ?>"/></br>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]){[/COLOR] ?>
        <b>Rank</b></br>
        <input type="text" name="rank" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rank[/COLOR][COLOR= #007700];[/COLOR] ?>"/></br>
        <b>Id</b></br>
        <input type="text" name="id" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$id[/COLOR][COLOR= #007700];[/COLOR] ?>"/></br>
        <b>Email</b></br>
        <input type="text" name="email" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700];[/COLOR] ?>"></br>
        <b>Registratie IP</b></br>
        <input type="text" name="reg_ip" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$reg_ip[/COLOR][COLOR= #007700];[/COLOR] ?>"/></br>
        <b>Laatst ingelogd ip</b></br>
        <input type="text" name="log_ip" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$log_ip[/COLOR][COLOR= #007700];[/COLOR] ?>"/></br>
        <b>Punten</b></br>
        <input type="text" name="punten" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$punten[/COLOR][COLOR= #007700];[/COLOR] ?>" /></br>
        <b>Ban</b></br>
        <input type="text" name="ban" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$ban[/COLOR][COLOR= #007700];[/COLOR] ?>"/></br>
        <input type="submit" value"Zoek" />
        <form>
        </body>
[COLOR= #0000BB]<?php[/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 niet ingelogd[/COLOR][COLOR= #007700];
    
}[/COLOR]
    
?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Tsssss.......Waarom verontschuldigen als je weet dat je niet zonder kan?
Niet miepen, gewoon toepassen........ wink
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
if ($_SESSION[rank] == 0)
    {
        
        echo Je hebt geen toestemming om deze pagina te bekijken;


en daarna ga je door met updaten?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ik zie de fout al. Met corect gebruik van mysql_error() moet je het zien. Hint¦ komma.
0
Wouterp

Lid · Topicstarter

Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near WHERE gebruikersnaam=Wouter) at line 10

Maar toch begrijp ik niet wat ik nu fout doe ;(
0
Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
WHERE gebruikersnaam=".mysql_real_escape_string($_POST[username])."");
0
Wouterp

Lid · Topicstarter

Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sebastiaanh schreef:
WHERE gebruikersnaam=".mysql_real_escape_string($_POST[username])."");
Werkt ook niet.
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Tip 2: Regel 43

Tip Aarclay: Komma

Nu moet je toch wel de fout vinden emo
0
Wouterp

Lid · Topicstarter

Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heb die komma weg gehaald nog steeds hetzelfde probleem..
0
Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Regel 43
Plaats deze code:

punten=" . mysql_real_escape_string($_POST[punten]) . "


op regel 43
0
Wouterp

Lid · Topicstarter

Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heeft niks opgelost.
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
mysql_query("UPDATE gebruikers SET
        gebruikersnaam=" . mysql_real_escape_string($_POST[username]) . ",
        email=" . mysql_real_escape_string($_POST[email]) . ",
        id=" . mysql_real_escape_string($_POST[id]) . ",
        rank=" . mysql_real_escape_string($_POST[rank]) . ",
        reg_ip=" . mysql_real_escape_string($_POST[reg_ip]) . ",
        log_ip=" . mysql_real_escape_string($_POST[log_ip]) . ",
        ban=" . mysql_real_escape_string($_POST[ban]) . ",
        punten=" . mysql_real_escape_string($_POST[punten]) . ",
        WHERE gebruikersnaam=".mysql_real_escape_string($_POST[username])."");
0
Wouterp

Lid · Topicstarter

Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near WHERE gebruikersnaam=Wouter at line 10
Zelfde probleem
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?[/COLOR]        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE gebruikers SET
        gebruikersnaam="[/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]username[/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][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        id="[/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]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        rank="[/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]rank[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        reg_ip="[/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]reg_ip[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        log_ip="[/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]log_ip[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        ban="[/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]ban[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
        punten="[/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]punten[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]"
        WHERE gebruikersnaam="[/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]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]


Komma vergeten weghalen bloos
0
Wouterp

Lid · Topicstarter

Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
YEEES NA AL DIE TIJD KLOTEN biggrin DANKJEWEL redface.

P.s. je vergat de mysql_error pas op voor Aarclay nu.
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