I have been working on a guestbook for my website. All is going good but
I have come across 2 problems that I can't seem to fix. I have googled and
searched several tutorials. I am sure it is something small that I am
overlooking so I thought I would ask for help. I wrote some smiley code
and and swear word filter and when I use this code it works fine
Code: Select all
$oldemo = array(":-)", ":-(", ":-[", ":-]", ";-)", ":+(", "badword", "badword", "badword");
$newemo = array("<img src=images/1.gif>", "<img src=images/2.gif>",
"<img src=images/3.gif>","<img src=images/4.gif>", "<img src=images/5.gif>",
"<img src=images/6.gif>","*&%@#$%","*&%@#$%","*&%@#$%");
$newtext = str_replace($oldemo, $newemo, $comment);case sensative. So I tried to use the eregi_replace like this
Code: Select all
$oldemo = array(":-)", ":-(", ":-[", ":-]", ";-)", ":+(", "badword", "badword", "badword");
$newemo = array("<img src=images/1.gif>", "<img src=images/2.gif>",
"<img src=images/3.gif>","<img src=images/4.gif>", "<img src=images/5.gif>",
"<img src=images/6.gif>","*&%@#$%","*&%@#$%","*&%@#$%");
$newtext = eregi_replace($oldemo, $newemo, $comment);str_replace function?
The next problem I have is formatting a timestamp from the sql server. When
I have done this in other queries it works fine but this is the first query
where I am pulling data from multiple tables? Could that have something to do
with it? Here is the code I usually use
Code: Select all
DATE_FORMAT(gbook.date, '%a %b %d, %Y | %r' )Code: Select all
SELECT gbook.id,gbook.name,gbook.email,gbook.location,gbook.homepage,
gbook.icq,gbook.aim,gbook.comment,gbook.gender,
DATE_FORMAT(gbook.date, '%a %b %d, %Y | %r' ),gbook.browser,gbook.os,styles.pagebackground,
styles.headerbackground,styles.tablebackground,styles.contentbackground,
styles.headertextcolor,styles.headertextsize,styles.timecolor,styles.nametextcolor,
styles.nametextsize, styles.infotextcolor, styles.infotextsize,styles.datetextcolor,
styles.datetextsize, styles.commenttextcolor, styles.commenttextsize,styles.infobackground,
styles.commentbackground,styles.timeborder,styles.contentborder,styles.bannerborder,
styles.linkcolors,styles.swear FROM gbook,styles