- Readme First! - Read and follow the rules, otherwise your posts will be closed
There are currently, 57 guest(s) and 1 member(s) that are online. You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - QUOTES cause crash in this custom Sub. Reviews form? [ ]
Author
Message
zao
Nuke Soldier
Joined: Apr 16, 2004
Posts: 26
Posted:
Tue Jun 28, 2005 7:17 am
Thank you in advance for any help!
This is a customized Reviews module. I added extra fields and turned it into a band sign up form that posts in the Reviews section.
When a band fills in their awnsers and clicks Preview, everything shows up just fine. When they click submit, all text from the first "quote" on - is lost by the time it shows up in the waiting reviews content boxes. (The reviews_add database.
I know it has something to do with the fixquotes, stripslashes, fixhtml.
The thing is, the original $text input that came with the Reviews works fine with "quotes". So I copied the same fixquotes, etc functions for the other boxes, however they do not work.
The "quote" kill problems are in submitting: $lineup, $interview, $release, $questionone, $questiontwo, $questionthree, $questionfour, $questionfive, $questionsix, $bandcom.
Here is the relevant chunk of the code. (Function Preview Review) then (Function Send Review):
Code:
function preview_review($date, $title, $text, $reviewer, $email, $score, $cover, $url, $url_title, $hits, $id, $rlanguage, $lineup, $interview, $release, $questionone, $questiontwo, $questionthree, $questionfour, $questionfive, $questionsix, $bandcom, $active) {
global $admin, $multilingual, $module_name;
$title = stripslashes(check_html($title, "nohtml"));
$text = stripslashes(check_html($text, ""));
$reviewer = stripslashes(check_html($reviewer, "nohtml"));
$url_title = stripslashes(check_html($url_title, "nohtml"));
$lineup = stripslashes(check_html($lineup, ""));
$interview = stripslashes(check_html($interview, ""));
$release = stripslashes(check_html($release, ""));
$questionone = stripslashes(check_html($questionone, ""));
$questiontwo = stripslashes(check_html($questiontwo, ""));
$questionthree = stripslashes(check_html($questionthree, ""));
$questionfour = stripslashes(check_html($questionfour, ""));
$questionfive = stripslashes(check_html($questionfive, ""));
$questionsix = stripslashes(check_html($questionsix, ""));
$bandcom = stripslashes(check_html($bandcom, ""));
include ('header.php');
OpenTable();
echo "<form method=\"post\" action=\"modules.php?name=$module_name\">";
if ($title == "") {
$error = 1;
echo "Your band name is required.<br>";
}
if ($text == "") {
$error = 1;
echo "Your band bio is required.<br>";
}
if (($score < 1) || ($score > 10)) {
$error = 1;
echo "Your band genre is required.<br>";
}
if (($hits < 0) && ($id != 0)) {
$error = 1;
echo ""._INVALIDHITS."<br>";
}
if ($reviewer == "" || $email == "") {
$error = 1;
echo "Your name is required.<br>";
} else if ($reviewer != "" && $email != "")
if (!(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email))) {
$error = 1;
/* eregi checks for a valid email! works nicely for me! */
echo "Your real email address is required.<br>";
}
if (($url_title != "" && $url =="") || ($url_title == "" && $url != "")) {
$error = 1;
echo ""._INVALIDLINK."<br>";
} else if (($url != "") && (!(eregi('(^http[s]*:[/]+)(.*)', $url))))
$url = "http://" . $url;
/* If the user ommited the http, this nifty eregi will add it */
if ($lineup == "") {
$error = 1;
echo "Your band line-up is required<br>";
}
if ($error == 1)
echo "<br>"._GOBACK."";
else
{
if ($date == "")
$date = date("Y-m-d", time());
$year2 = substr($date,0,4);
$month = substr($date,5,2);
$day = substr($date,8,2);
$fdate = date("F jS Y",mktime (0,0,0,$month,$day,$year2));
echo "<table border=\"0\" width=\"100%\"><tr><td colspan=\"2\">";
echo "<blockquote><p>";
if ($cover != "")
echo "<center><img src=\"images/talentfiles/$cover\" border=\"1\"></center>";
echo "<b>Your Name:</b><br> <a href=\"mailto:$email\">$reviewer</a><br><br>";
echo "<b>Band Name:</b><br>$title<br><br>";
if ($active != "")
echo "<b>Band Status:</b> $active<br><i>1 = Active Band. 0 = Broken up or Inactive.</i><br><br>";
echo "<b>Band Lineup:</b><br>$lineup<br><br>";
echo "<b>Genre:</b><br> ";
display_score($score);
echo "<br><br><b>Bio:</b><br>$text<br><br>";
if ($interview != "")
echo "<b>Interview:</b><br> $interview<br>";
if ($releases != "")
echo "<br><b>Releases:</b><br> $release<br>";
if ($questionone != "")
echo "<br><b>"._QUESTIONONE."</b><br> $questionone<br>";
if ($questiontwo != "")
echo "<br><b>"._QUESTIONTWO."</b><br> $questiontwo<br>";
if ($questionthree != "")
echo "<br><b>"._QUESTIONTHREE."</b><br> $questionthree<br>";
if ($questionfour != "")
echo "<br><b>"._QUESTIONFOUR."</b><br> $questionfour<br>";
if ($questionfive != "")
echo "<br><b>"._QUESTIONFIVE."</b><br> $questionfive<br>";
if ($questionsix != "")
echo "<br><b>"._QUESTIONSIX."</b><br> $questionsix<br>";
if ($bandcom != "")
echo "<br><b>"._BANDCOM."</b><br> $bandcom<br>";
if ($url != "")
echo "<br><b>"._RELATEDLINK.":</b> <a href=\"$url\" target=\"new\">$url_title</a>";
if ($id != 0) {
echo "<br><b>"._REVIEWID.":</b> $id<br>";
echo "<b>"._HITS.":</b> $hits<br>";
}
echo "</font></blockquote>";
echo "</td></tr></table>";
$text = urlencode($text);
echo "<p><i>Does everything look right above?</i>";
echo "<input type=\"hidden\" name=\"id\" value=$id>
<input type=\"hidden\" name=\"hits\" value=\"$hits\">
<input type=\"hidden\" name=\"rop\" value=send_review>
<input type=\"hidden\" name=\"date\" value=\"$date\">
<input type=\"hidden\" name=\"title\" value=\"$title\">
<input type=\"hidden\" name=\"text\" value=\"$text\">
<input type=\"hidden\" name=\"reviewer\" value=\"$reviewer\">
<input type=\"hidden\" name=\"email\" value=\"$email\">
<input type=\"hidden\" name=\"score\" value=\"$score\">
<input type=\"hidden\" name=\"url\" value=\"$url\">
<input type=\"hidden\" name=\"url_title\" value=\"$url_title\">
<input type=\"hidden\" name=\"cover\" value=\"$cover\">
<input type=\"hidden\" name=\"lineup\" value=\"$lineup\">
<input type=\"hidden\" name=\"interview\" value=\"$interview\">
<input type=\"hidden\" name=\"release\" value=\"$release\">
<input type=\"hidden\" name=\"questionone\" value=\"$questionone\">
<input type=\"hidden\" name=\"questiontwo\" value=\"$questiontwo\">
<input type=\"hidden\" name=\"questionthree\" value=\"$questionthree\">
<input type=\"hidden\" name=\"questionfour\" value=\"$questionfour\">
<input type=\"hidden\" name=\"questionfive\" value=\"$questionfive\">
<input type=\"hidden\" name=\"questionsix\" value=\"$questionsix\">
<input type=\"hidden\" name=\"bandcom\" value=\"$bandcom\">
<input type=\"hidden\" name=\"active\" value=\"$active\">";
echo "<input type=\"hidden\" name=\"rlanguage\" value=\"$rlanguage\">";
echo "<input type=\"submit\" name=\"rop\" value=\""._YES."\"> <input type=\"button\" onClick=\"history.go(-1)\" value=\""._NO."\">";
if($id != 0)
$word = ""._RMODIFIED."";
else
$word = ""._RADDED."";
if(is_admin($admin))
echo "<br><br><b>"._NOTE."</b> "._ADMINLOGGED." $word.";
}
CloseTable();
include ("footer.php");
}
function send_review($date, $title, $text, $reviewer, $email, $score, $cover, $url, $url_title, $hits, $id, $rlanguage, $lineup, $interview, $release, $questionone, $questiontwo, $questionthree, $questionfour, $questionfive, $questionsix, $bandcom, $active) {
global $admin, $EditedMessage, $prefix, $dbi, $module_name;
include ('header.php');
$title = stripslashes(FixQuotes(check_html($title, "nohtml")));
$text = stripslashes(Fixquotes(urldecode(check_html($text, ""))));
if (eregi("<!--pagebreak-->", $text)) {
$text = ereg_replace("<!--pagebreak-->","<!--pagebreak-->",$text);
$lineup = stripslashes(Fixquotes(urldecode(check_html($lineup, ""))));
$interview = stripslashes(Fixquotes(urldecode(check_html($interview, ""))));
$release = stripslashes(Fixquotes(urldecode(check_html($release, ""))));
$questionone = stripslashes(Fixquotes(urldecode(check_html($questionone, ""))));
$questiontwo = stripslashes(Fixquotes(urldecode(check_html($questiontwo, ""))));
$questionthree = stripslashes(Fixquotes(urldecode(check_html($questionthree, ""))));
$questionfour = stripslashes(Fixquotes(urldecode(check_html($questionfour, ""))));
$questionfive = stripslashes(Fixquotes(urldecode(check_html($questionfive, ""))));
$questionsix = stripslashes(Fixquotes(urldecode(check_html($questionsix, ""))));
$bandcom = stripslashes(Fixquotes(urldecode(check_html($bandcom, ""))));
}
OpenTable();
echo "<br><center>Thanks for telling us about your band";
if ($id != 0)
echo "Thanks for telling us about your band";
else
echo " $reviewer";
echo "!<br>";
if ((is_admin($admin)) && ($id == 0)) {
sql_query("INSERT INTO ".$prefix."_reviews VALUES (NULL, '$date', '$title', '$text', '$reviewer', '$email', '$score', '$cover', '$url', '$url_title', '1', '$rlanguage', '$lineup', '$interview', '$release', '$questionone', '$questiontwo', '$questionthree', '$questionfour', '$questionfive', '$questionsix', '$bandcom', '$active')", $dbi);
echo "The Talent File is now available.";
} else if ((is_admin($admin)) && ($id != 0)) {
sql_query("UPDATE ".$prefix."_reviews SET date='$date', title='$title', text='$text', reviewer='$reviewer', email='$email', score='$score', cover='$cover', url='$url', url_title='$url_title', hits='$hits', rlanguage='$rlanguage', lineup='$lineup', interview='$interview', release='$release', questionone='$questionone', questiontwo='$questiontwo', questionthree='$questionthree', questionfour='$questionfour', questionfive='$questionfive', questionsix='$questionsix', bandcom='$bandcom', active='$active' where id = $id", $dbi);
echo "The Talent File is now available.";
} else {
sql_query("INSERT INTO ".$prefix."_reviews_add VALUES (NULL, '$date', '$title', '$text', '$reviewer', '$email', '$score', '$url', '$url_title', '$rlanguage', '$lineup', '$interview', '$release', '$questionone', '$questiontwo', '$questionthree', '$questionfour', '$questionfive', '$questionsix', '$bandcom', '$active')", $dbi);
echo "Thanks!";
}
echo "<br><br>[ <a href=\"modules.php?name=$module_name\">"._RBACK."</a> ]<br></center>";
CloseTable();
include ("footer.php");
}
Evaders99
Site Admin
Joined: Aug 17, 2003
Posts: 12383
Posted:
Tue Jun 28, 2005 10:52 am
zao
Nuke Soldier
Joined: Apr 16, 2004
Posts: 26
Posted:
Tue Jun 28, 2005 1:27 pm
Anyone else have any ideas? I think in the send reviews function, the fixquotes / stripslashes stuff needs adjusting.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum