shaunNO2007
New Member
- Messages
- 57
- Reaction score
- 0
- Points
- 0
ok look at my code. this is my php code that send the information on my website to the database and then displays it back on my website.
if you want to know what i mean look here www.crazynoise.x10hosting.com
r8 the code
what i want to know is how do i get the send comments that are displayed on my website. for the last comment to go to the top because when people send to comment it goes to the bottom does anyone know how to do this ?????????????????????????
thanks
Shaun
if you want to know what i mean look here www.crazynoise.x10hosting.com
r8 the code
PHP:
<?php
$dbhost = 'localhost';
$dbuser = '-------';
$dbpass = '-------';
$dbname = 'shaunm_crazynoise';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'shaunm_crazynoise';
mysql_select_db($dbname);
if(isset($_POST['add']))
{
// when you can't find post vars use this.
// print_r($_POST);
$comment = mysql_real_escape_string(strip_tags($_POST['comment']));
$bad_words = explode('|', '****|f/u/c/k|f/uck|fu/ck|fuc/k|twat|t/w/a/t|t/wat|tw/at|twa/t|cunt|c/u/n/t|c/unt|cu/nt|cun/t|bastard|b/a/s/t/a/r/d|b/astard|ba/stard|bas/tard|bast/ard|basta/rd|bastar/d|wank|w/a/n/k|w/ank|wa/nk|wan/k|dick|d/i/c/k|d/ick|di/ck|dic/k|****|f,u,c,k|f,uck|fu,ck|fuc,k|twat|t,w,a,t|t,wat|tw,at|twa,t|cunt|c,u,n,t|c,unt|cu,nt|cun,t|bastard|b,a,s,t,a,r,d|b,astard|ba,stard|bas,tard|bast,ard|basta,rd|bastar,d|wank|w,a,n,k|w,ank|wa,nk|wan,k|dick|d,i,c,k|d,ick|di,ck|dic,k|****|f-u-c-k|f-uck|fu-ck|fuc-k|twat|t-w-a-t|t-wat|tw-at|twa-t|cunt|c-u-n-t|c-unt|cu-nt|cun-t|bastard|b-a-s-t-a-r-d|b-astard|ba-stard|bas-tard|bast-ard|basta-rd|bastar-d|wank|w-a-n-k|w-ank|wa-nk|wan-k|dick|d-i-c-k|d-ick|di-ck|dic-k|****|f.u.c.k|f.uck|fu.ck|fuc.k|twat|t.w.a.t|t.wat|tw.at|twa.t|cunt|c.u.n.t|c.unt|cu.nt|cun.t|bastard|b.a.s.t.a.r.d|b.astard|ba.stard|bas.tard|bast.ard|basta.rd|bastar.d|wank|w.a.n.k|w.ank|wa.nk|wan.k|dick|d.i.c.k|d.ick|di.ck|dic.k');
foreach ($bad_words as $naughty)
{
$comment = eregi_replace($naughty, "****", $comment);
}
//Please encrypt the password also (some encryptions you can use are:
//$body = sha1($body);
//$body = md5($body):
// Or any others. But when you have the login, it has to encrypt the password typed or else it will not work.
$query = mysql_query("insert into the_video_comments set comment = '$comment'");
echo "<b>comment added</b><br> ";
}
else
{
?>
<form name="comment" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label><span class="style18">Your Comment</span> <br />
<textarea name="comment" cols="50" rows="5" class="commentbox" id="eBann" onkeyup="toCount('eBann','sBann','{CHAR} characters left',500);"></textarea>
<span id="sBann" class="minitext">500 characters left.</span>
</label>
<br />
<br />
<label>
<input name="add" type="submit" class="submitButton" id="add" onmouseover="checkForm();" value="Submit Your Comment" />
<br />
</label>
</form>
<?php
}
?>
<?php
$query = "SELECT * FROM `the_video_comments`";
$result = mysql_query($query);
echo"<br><b>All Comments</b><br><br>";
//Loop through found results
while($row = mysql_fetch_array($result)) {
echo $row['comment']." | <b><u>submitted at</u>:</b> ";
echo $row['created_at']."<br/>";
echo "----------------------------------------------------------------------------------------------------------------<br>";
}
?>
what i want to know is how do i get the send comments that are displayed on my website. for the last comment to go to the top because when people send to comment it goes to the bottom does anyone know how to do this ?????????????????????????
thanks
Shaun