Hi, here is what I want to accomplish:
I have a journalling program where a user makes a journal entry and it is saved to the database. The code for that is here:
echo " <br>Title:<br>\n"
." <input type=text name=jnl[title] style=\"width: 300px;\" maxlength=80 value=\"$jnl[title]\"><br>\n"
." Text:<br>\n"
// .showBBcodeBTN()
." <textarea name=bodytext style=\"width: 300px; height: 100px;\">$jnl[bodytext]</textarea><br>\n";
if ($jconfig[pic_conv] != "noimgs")
echo " Picture:<br>\n"
." <input type=file name=pic style=\"width: 300px;\"><br>\n";
echo " Mood Icon:<br>\n";
$format = 0;
for ($i = 0; $i < count($moods_titles); $i++) {
echo " <input type=radio name=jnl[icon] value=$i";
if ($i == '0') echo " CHECKED";
echo "><a href=\"JavaScript: dosmiley('document.journalfrm','$moods_emoticons[$i]');\"><img src=\"modules/$ModName/images/moods/$moods_images[$i]\" alt=\"$moods_titles[$i]\" border=0></a> \n";
//
if ($format <= 5) $format++;
else {
echo " <br>\n";
$format = 0;
}
}
echo " <br>\n"
." <table border=0 width=300>\n"
." <tr><td width=150>\n"
." Public:<br>\n"
." <input type=radio name=jnl[public] value=1 id=\"pub_true\" CHECKED><label for=\"pub_true\"> YES</label><br>\n"
." <input type=radio name=jnl[public] value=0 id=\"pub_false\"><label for=\"pub_false\"> NO</label>\n"
." </td><td width=150>\n"
." Enable Comments:<br>\n"
." <input type=radio name=jnl[com_enbl] value=1 id=\"com_true\" CHECKED><label for=\"com_true\"> YES</label><br>\n"
." <input type=radio name=jnl[com_enbl] value=0 id=\"com_false\"><label for=\"com_false\"> NO</label>\n"
." </td></tr>\n"
." <tr><td colspan=2 align=right>\n"
." <br>\n"
." <input type=submit value=Publish>\n"
." </td></tr>\n"
." </table>\n"
." </form>\n";
That all works fine, what I want to do is include some google adsense in the entry that is published to the database so that when it is shown, the adsense is part of the entry. The routine to retrieve it from the database is as follows:
$jrs = mysql_query("SELECT uid, public, title, posttime, icon, bodytext, picname, com_enbl FROM $pntable[j_entries] WHERE id='$id'");
if (!mysql_num_rows($jrs)) die ("Entry doesn't exist in database...");
list ($uid,$public,$title,$posttime,$icon,$bodytext,$picname,$com_enbl) = mysql_fetch_row($jrs);
if (!$public && ($vid != $uid)) die ("You do not have permission to view this private entry!");
list ($uname,$name,$femail,$url) = mysql_fetch_row(mysql_query("SELECT pn_uname, pn_name, pn_femail, pn_url FROM $pntable[users] WHERE pn_uid='$uid'"));
echo " <table border=0 width=100%>\n"
." <tr>\n"
." <td>\n"
." <b style=\"font-size: 18px;\">".(($icon)?("<img src=\"modules/$ModName/images/moods/$moods_images[$icon]\" alt=\"$moods_titles[$icon]\"> ")🙁""))."$title</b>\n"
." </td>\n"
." <td align=right>\n"
." <b>Posted by ".(($uname)?($uname)🙁$uname))."</b>\n"
." <a href=\"user.php?op=userinfo&uname=$uname\"><img src=\"modules/$ModName/images/profile.gif\" alt=\"View $uname's Profile\" border=0></a>\n"
.(($url)?(" <a href=\"$url\"><img src=\"modules/$ModName/images/homepage.gif\" alt=\"Visit $uname Online\" border=0></a>\n")🙁""))
.(($femail)?(" <a href=\"mailto:$femail?subject=$title\"><img src=\"modules/$ModName/images/email.gif\" alt=\"eMail $uname\" border=0></a>\n")🙁""))
." <br>\n"
." ".date("l, F d, Y @ g:i A",(strtotime($posttime)+($tzoffset*3600)))."\n"
." </td>\n"
." </tr>\n"
." </table>\n";
if ($picname) echo " <hr style=\"height: 1px; width: 100%; color: $bgcolor2;\">\n"
." <center>\n"
." <img src=\"modules.php?op=modload&name=$ModName&file=img&id=$id&picname=$picname\">\n"
." </center>\n";
//$bodytext = bbencode($bodytext);
$bodytext = preg_replace("/\r/","",$bodytext);
$bodytext = preg_replace("/\n/","<br>",$bodytext);
$bodytext = stripslashes($bodytext);
echo " <hr style=\"height: 1px; width: 100%; color: $bgcolor2;\">\n"
From what I can tell, it is all stored in $bodytext, so how would I go about including the google adsense script in what is stored in bodytext? Any ideas?
Thanks...Lunas.