ambo Posted January 8, 2009 Share Posted January 8, 2009 Im having trouble figuring this one out You type in your comment and hit submit and it grabs the author and the dat but wont grab the comment or the user the comment is intended could this have to do with the word filter Java Word Filter <SCRIPT LANGUAGE="JavaScript"> var swear_words_arr=new Array("bloody","war","terror"); var swear_alert_arr=new Array; var swear_alert_count=0; function reset_alert_count() { swear_alert_count=0; } function validate_user_text() { reset_alert_count(); var compare_text=document.form1.user_text.value; for(var i=0; i<swear_words_arr.length; i++) { for(var j=0; j<(compare_text.length); j++) { if(swear_words_arr[i]==compare_text.substring(j,(j+swear_words_arr[i].length)).toLowerCase()) { swear_alert_arr[swear_alert_count]=compare_text.substring(j,(j+swear_words_arr[i].length)); swear_alert_count++; } } } var alert_text=""; for(var k=1; k<=swear_alert_count; k++) { alert_text+="\n" + "(" + k + ") " + swear_alert_arr[k-1]; } if(swear_alert_count>0) { alert("The form cannot be submitted.\nThe following illegal words were found:\n_______________________________\n" + alert_text + "\n_______________________________"); document.form1.user_text.select(); } else { document.form1.submit(); } } function select_area() { document.form1.user_text.select(); } window.onload=reset_alert_count; </script> Form <form action="commentpros.php" name="form1"> <textarea rows="3" cols="60" name="user_text" style="border:2 solid #808080; font-family:verdana,arial,helvetica; font-weight:normal; font-size:10pt" onclick="select_area()">Enter your comment here....</textarea> To: <input name="user" type="text" id="" value="<? print $req_user_info['username']; ?>" /><br /> <input name="Submit" type="submit" style="background:#EFEFEF; border:2 solid #808080; width:25%; cursor:pointer" onclick="validate_user_text();" value="Submit"> </form> PHP PROCESS <?php echo "$variable"; $comment = $_POST["user_text"]; $user = $_POST["user"]; $author = $session->username; //gets mysql info include("admin/dbconnect.php"); //gets the current date... putenv("TZ=US/Eastern"); $date = date("m/j/y h:i a"); $sql = "INSERT INTO comments (author,user,comment,date)". "VALUES ('{$author}', '{$user}', '{$comment}', '{$date}')"; MYSQL_QUERY($sql); //success... echo "<meta http-equiv=\"refresh\" content=\"5;url=profile.php?user=$user\"/>"; echo "To: $user<br>" ."From: $author<br>" ."$comment"; ?> (edited to change the [/noobc] tags to [nobbc] tags) Link to comment https://forums.phpfreaks.com/topic/140070-solved-posting-error/ Share on other sites More sharing options...
Rushyo Posted January 8, 2009 Share Posted January 8, 2009 <?php <form action="commentpros.php" name="form1" method="post"> ?> Should solve at least one problem. A form sends GET requests by default, but you were expecting a POST request. By the way, your code is very insecure. I suggest you have somebody take a look at it or look at some PHP security tip sites. Link to comment https://forums.phpfreaks.com/topic/140070-solved-posting-error/#findComment-732884 Share on other sites More sharing options...
ambo Posted January 8, 2009 Author Share Posted January 8, 2009 Yup Im a 1d10t Thank you so much Link to comment https://forums.phpfreaks.com/topic/140070-solved-posting-error/#findComment-732908 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.