JayLewis Posted April 8, 2007 Share Posted April 8, 2007 Howdy all! i have this script to send messages between members on my site, but when i submit a message, its send everything ie "sender, date, time" but with no message. I have been lookin for days and i can't find out why! If you've got the time, take a look and reply. thanks alot! Jay. <?php session_start(); include "includes/db_connect.php"; include "includes/functions.php"; logincheck(); $username=$_SESSION['username']; echo "<html> $style <center>"; $goody = mysql_query("SELECT `message`, `date`, `from` FROM `inbox` WHERE `id`='$rep'"); while($success = mysql_fetch_row($goody)){ $ini = $success[0]; $dateon = $success[1]; $fromper = $success[2]; } if(strip_tags($_POST['Send'])){ $text=strip_tags(addslashes($text)); $to = strip_tags(addslashes($_POST['to'])); $rep = $_GET['rep']; $sql_username_check = mysql_query("SELECT username FROM users WHERE username='$to'"); $username_check = mysql_num_rows($sql_username_check); if ($username_check == 0){ echo '<font color=red>There is no user with that name! </font>'; }else{ $blocked=mysql_num_rows(mysql_query("SELECT * FROM friends WHERE person='$username' AND type='Blocked' AND username='$to'")); if ($blocked != "0"){ echo "This user has blocked you."; }elseif ($blocked == "0"){ $date = gmdate('Y-m-d h:i:s'); $sql = mysql_query("INSERT INTO `inbox` (`id`, `to`, `from`, `message`, `date`, `read`) VALUES ('', '$to', '$username', '$text', '$date', '0');") or die (mysql_error()); if(!$sql){ echo 'Error please contact an admin.'; }else{ echo "Message sent to <a href=profile.php?viewuser=$to><b>$to</b></a>"; }}}} ?> <html> <link href="includes/in.css" rel="stylesheet" type="text/css"> <center> <form action="" method="post"> <tr> </tr> </table> <p></p> <table align=center border="1" width="474" height="24" class="tdcell"> <tr> <td height="18" width="464" class="tdcell" style="background-image: url('images/menubg.jpg')" colspan="2"> Compose a Message</td> </tr> <tr> <td height="18" width="228" class="tdcell" style="background-image: url('images/menubg2.jpg')"> Recipient</td> <td height="18" width="230" class="tdcell" style="background-image: url('images/menubg2.jpg')"> <input type=text name=to style="border-style:solid; border-width:1px; width:; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px" 60%; value='<?php echo $fromper; ?>' size="20"></td> </tr> <tr> <td height="18" width="228" class="tdcell" style="background-image: url('images/menubg2.jpg')"> Message</td> <td height="18" width="230" class="tdcell" style="background-image: url('images/menubg2.jpg')"> <textarea name='text' style='border:1px solid #000000; width: 98%; height: 175px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px' class=submit rows="1" cols="20"><?php if ($m > 0){ echo "[b]On:[/b] $dateon. $fromper [b] Wrote:[/b] $ini"; }else{ } ?></textarea></td> </tr> <tr> <td height="18" width="228" class="tdcell" style="background-image: url('images/menubg2.jpg')"> </td> <td height="18" width="230" class="tdcell" style="background-image: url('images/menubg2.jpg')"> <input type=submit name=Send value=Send class=submit style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px"></td> </tr> </table> <table align=center border="1" width="474" height="24" class="tdcell"> <tr> <td height="18" width="464" class="tdcell" style="background-image: url('images/menubg.jpg')"> Warning</td> </tr> <tr> <td height="18" width="464" class="tdcell" style="background-image: url('images/menubg2.jpg')"> All messages are saved in the database. Any racism being sent to other users will result in you account being admin killed. So please think be sending.</td> </tr> </table> </form> </td> </tr> <tr class=title> <td colspan=2></table></td> </tr> </table> <br></form> </td> </tr> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="styles.css" rel="stylesheet" type="text/css"> </head> </html> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="styles.css" rel="stylesheet" type="text/css"> <title>Untitled Document</title> <link rel=stylesheet href=includes/in.css type=text/css> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> </body> </html> <body background="images/tdbg.jpg"> </body> </html> Link to comment https://forums.phpfreaks.com/topic/46147-solved-instant-messaging/ Share on other sites More sharing options...
pocobueno1388 Posted April 8, 2007 Share Posted April 8, 2007 You have $text defined like this: $text=strip_tags(addslashes($text)); You need to do it like this: $text=strip_tags(addslashes($_POST['text'])); since it is a post value. Link to comment https://forums.phpfreaks.com/topic/46147-solved-instant-messaging/#findComment-224296 Share on other sites More sharing options...
JayLewis Posted April 8, 2007 Author Share Posted April 8, 2007 I think i love you ... Works perfect, i cant express how much i wanna thank you! Thanks alot man! Link to comment https://forums.phpfreaks.com/topic/46147-solved-instant-messaging/#findComment-224299 Share on other sites More sharing options...
jscix Posted April 8, 2007 Share Posted April 8, 2007 doh, someone got it ;;o Link to comment https://forums.phpfreaks.com/topic/46147-solved-instant-messaging/#findComment-224301 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.