[PHP&MYSQL] Hulp gevraagd!

Gestart doorJosnl24 reacties36 weergaven

25 berichten · pagina 1 van 2

Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heey allemaal!

Ik ben bezig met een chatboxscript, maar op de een of andere manier zet ie de gegevens niet in de database...

Dit is chatbox.php:

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chatbox</title>
</head>

<body>

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

[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$mysql[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #DD0000]"INSERT_INTO 
                        chatbox 
                        
                        VALUES 
                        (
                            name,
                            bericht
                        )
                        "[/COLOR][COLOR= #007700]);[/COLOR]
                        
[COLOR= #0000BB]$mysql_insert[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]);[/COLOR]


?>
        

    <form action="chatbox.php" method="post">
   <table border="0">
      <tr>
         <th></th>
         <td><input type="text" name="naam" value="Naam"></td>
      </tr>
      <tr>
         <th></th>
         <td><textarea type="text" name="bericht" maxlength="150" rows="5" cols="45">Typ hier je bericht van maximaal 150 woorden.</textarea></td>
      </tr>
      <tr>
         <td> </td>
         <td><input type="submit" naam="Verstuur"></td>
      </tr>
   </table>
</form>

</body>
</html>


Alvast bedankt voor jullie hulp!

Gr.

Josshiny
Edit: Code aangepast.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Gast...
title boven head?
head boven html?
Wtf cry
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
iddconfusedconfused
0
Berichten
10.409
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
bagger script.
uuhm ff vraagje zelf gemaakt?
0
Berichten
9.969
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jongens ik wil niet lullig doen, maar Luuk heeft er al wat van gezegt, dit hoeft niet 100 keer herhaalt te worden, dus reageer alleen als je wat toe te voegen hebt aan dit topic.
Ik irriteer me de laatste tijd mateloos aan dat soort reacties.
Afbeelding
Afbeelding
Afbeelding
0
Berichten
5.795
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kingunit: hoe weet je nou dat het een bagger script is emo hij is bezig met scripten neem ik aan en alles wordt verbeterd en als je iemand wilt afkraken doe het dan via pm en onderbouw je reactie gewoon

jij zult dat ook niet leuk vinden dat wij dit in jouw topics gaan doen doe het dan ook bij een ander niet
Afbeelding
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sorry dat het nu nog zo flut is, maar het gaat me nu eigenlijk om dat de gegevens in de database worden gezet.

Alvast bedankt voor jullie hulp, enneh, ik zal het bovenste gedeelte even aanpassen.

Gr

Jos

(PS: Kijk even naar de tijd dat ik het geplaatst heb, was er niet helemaal bijbloos)

En Daiman, bedankt, ben er inderdaad nog mee bezig dus alles wordt nog verbeterd en beveiligd.
0
Berichten
1.053
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dit moet wel werken.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Chatbox</title>
</head>
<body>

[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][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]invoegen[/COLOR][COLOR= #007700]])){[/COLOR]
    [COLOR= #0000BB]$naam[/COLOR]   [COLOR= #007700]=[/COLOR]  [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR]  [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/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]bericht[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen bericht ingevoerd!"[/COLOR][COLOR= #007700];
    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL] [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/echo"]echo[/URL] [COLOR= #DD0000]"Je hebt geen naam ingevoerd!"[/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 `chatbox`(naam,bericht) values({$naam},{$bericht})"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je bericht is toegevoed!"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
<form action="chatbox.php" method="post">
<table border="0">
    <tr>
        <th></th>
    <td><input type="text" name="naam" value="Naam"></td>
        </tr><tr>
    <th></th>
    <td><textarea type="text" name="bericht" maxlength="150" rows="5" cols="45">
        Typ hier je bericht van maximaal 150 woorden.</textarea></td>
    </tr><tr>
        <td> </td>
    <td><input type=submit name=invoegen value=Verstuur />
        </td></tr>
</table>
</form>

</body>
</html>
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hij werkt, met deze code:

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chatbox</title>
</head>

<body>        

    <form action="chatbox.php" method="post">
   <table border="0">
      <tr>
         <th></th>
         <td><input type="text" name="naam" value="naam"></td>
      </tr>
      <tr>
         <th></th>
         <td><textarea type="text" name="bericht" maxlength="150" rows="5" cols="45">Typ hier je bericht van maximaal 150 woorden.</textarea></td>
      </tr>
      <tr>
         <td> </td>
         <td><input type="submit" naam="Verstuur"></td>
      </tr>
   </table>
</form>

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

[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]

                [COLOR= #0000BB]$insert[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO 
                                         `chatbox` (naam,bericht)  
                                         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]naam[/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]bericht[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]" 
                                                )"[/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= #0000BB]$insert[/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] 


?> 

</body>
</html>
0
Berichten
1.053
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Die van mij is Veeel beter. Maarja.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Noem jij

values({$naam},{$bericht})


beter? schater
0
Berichten
1.053
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja erzijn verschillende manieren. {$var} ".$var." $var
Ze zijn bijna allemaal het zelfde.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan wel zijn maar die van jou is ook nog niet eens tegen mysql injections beveiligd emo
0
Berichten
1.053
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat weet ik zelf ook. Ik ga niet veel moeite doen om een ander te helpenyummie
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Omfg, als je iemand helpt doe het dan goed en geen nutteloze scripts
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