Re: help : apostrophe/single quotation mark



dajava wrote:

$query = "INSERT INTO `Dora_Board` (`Title` , `Writer`,
`Password`, `Contents`, `Date`, `Ip`) ";
$query = $query . "VALUES ('" . (string)$title . "', '" .
(string)$writer . "', '" . (string)$password . "', ";
$query = $query . "'" . (string)$contents . "', '" . (string)
$date . "', '" . (string)$ip . "')";

As I said -- mysql_real_escape_string(). Replace the above with:

$query = sprintf("INSERT INTO Dora_Board (Title, Writer, Password, Contents, Date, Ip)
VALUES ('%s', '%s', '%s', '%s', '%s', '%s');",
mysql_real_escape_string($title),
mysql_real_escape_string($writer),
mysql_real_escape_string($password),
mysql_real_escape_string($contents),
mysql_real_escape_string($date),
mysql_real_escape_string($ip));

There are several other chunks of code that need rewriting similarly, but
that should fix the immediate problem.

If you don't fix these problems your site is open to being cracked by
nasty people. Yes, really.

Google: mysql_real_escape_string.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
.



Relevant Pages

  • DVDRW stops XP from responding
    ... >Windows should return to normal. ... What writer are you using... ... dvdwriters use udma now, also, check for firmware updates ... No fix, returned it, got a slightly revised ...
    (microsoft.public.windowsxp.hardware)
  • Re: Date Parameters
    ... to fix the immediate problem you could probably use something like the following. ... I would venture to guess that there would be a much simpler way to fix this problem. ... University of Maryland Baltimore County ...
    (microsoft.public.access.reports)
  • Re: Speeding teen kills self and friend - Described as an " incredibly outgoing, beautiful perso
    ... >>themselves or ask the writer to fix it. ... >Having looked at quite a bit of Open Source source code, ... >obvious that public derision is not a major deterrent. ...
    (rec.autos.driving)
  • Within-document links break when migrating from Word 2000 to Word 2003
    ... even OpenOffice.org Writer, and the links all work correctly. ... messages like "Error: Invalid Link". ... How can I fix this without having to strip out all the links and do ...
    (microsoft.public.word.application.errors)
  • Re: [WR] the most difficult aspect of writing?
    ... out the words and go back to fix them later. ... copyediting. ... I agree with don't fix it if it ain't broke. ... I don't agree, though, that getting it down fast -- if that's how it comes for a writer -- isn't a valid method. ...
    (misc.writing)