Jump to content
MakeWebGames

Help Please (Take 2)


kronow
 Share

Recommended Posts

i am having trouble with my arrays not worknig :S in the annocements script

im trying to implant smiles and make it so in line brakes went enter (return w.e) is pressed.

CODE

 

	if($_POST['topic'] and $_POST['annoucement'] and $_POST['discussion'])
{
$codes = array(":)", ";)", ":o",":O", ":d",":D", ":s", ":S", ":(", ":red", ":clown", ":bashful", ":x", ":green", ":|", ";(", ":]", ":horny", ":cool");
$images  = array("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
$msg=str_replace(array("\n"),array("
"),strip_tags($_POST['annoucement']));
$newmsg = str_replace($codes, $images, $msg);
if($_POST['discussion'] == "Y") 
{ 
	$diss_on=1; 
} else { 
	$diss_on=0; 
}
$time=time();
mysql_query("INSERT INTO `annoucements` (`id`, `topic`, `annoucement`, `from`, `time`, `views`, `discussion`) VALUES ('NULL', '$_POST[topic]', '$newmsg', '$ir[userid]', '$time', '0', '$diss_on');");
mysql_query("UPDATE `users` SET `new_annoucement` = `new_annoucement` + '1' WHERE `userid` = '$ir[userid]'");
print "Annoucement Posted!
[url='ann.php']Back[/url]";

 

and a test annocements comes with like this

tsetsetset br /> br />sdfagsdfgsdfg br /> br />img src=/smilies/smiley1.gif> img src=/smilies/smiley16.gif> br /> br /> br />asdasdasd br /> br />hahaha

can you help please?

 

Cheers

:mrgreen:

Link to comment
Share on other sites

Re: Help Please (Take 2)

Your implementation of Spellbyte's smilies lives on in yet another form. --and it appears correct.

Your problem is likely in the display, (ann.php)

find this about 15-20 lines from the bottom:

print "[b]Views[/b] : ".number_format($r['views'])."
[b]Date Posted[/b] : ".date("F j, Y",$r['time'])." 
</td><td>$r[topic]</td><td><font size=-1>".str_replace('<', '', $r['annoucement'])."</font></td><td>";

 

replace it with:

print "[b]Views[/b] : ".number_format($r['views'])."
[b]Date Posted[/b] : ".date("F j, Y",$r['time'])." 
</td><td>{$r[topic]}</td><td><font size=-1>{$r['annoucement']}</font></td><td>";

 

the string_replace '<' being the real killer here for ya.

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...