systemseven Posted September 8, 2009 Share Posted September 8, 2009 Hey guys, fairly new here so please bare with me Basically, i have been working on a text based browser game for the past few weeks. It was a basic script given to me by a friend some time ago, and i have only just rediscovered it on my hard drive. Everything has been going well, except for one thing....the messaging system. The problem seems to be with the text input on the message page. Users still receive a PM, but the message field is blank. When i check the database, i can see that no text has been inputted, but on the users side, it has. Any ideas on where i could be going wrong? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/173482-solved-php-game-problem/ Share on other sites More sharing options...
RussellReal Posted September 8, 2009 Share Posted September 8, 2009 couldn't tell you unless theres some sort of code shown.. preferably an excerpt from where the possible problems lay. Quote Link to comment https://forums.phpfreaks.com/topic/173482-solved-php-game-problem/#findComment-914459 Share on other sites More sharing options...
Philip Posted September 8, 2009 Share Posted September 8, 2009 When i check the database, i can see that no text has been inputted Did you check your script that inserts that data to the DB? Quote Link to comment https://forums.phpfreaks.com/topic/173482-solved-php-game-problem/#findComment-914461 Share on other sites More sharing options...
systemseven Posted September 8, 2009 Author Share Posted September 8, 2009 <tr class=text> <td colspan=2>Message:</td> </tr> <tr class=sub> <td colspan=2><textarea name='text' style='width: 98%; height: 175px' class=submit><?php if ($message > 0){ echo "[b]On:[/b] $dateon. $fromper [b] Wrote:[/b] $ini"; }else{ } ?></textarea></td> </tr> <tr class=title> <td colspan=2><input type=submit name=Send value=Send class=submit></td> </tr> That is where the problem seems to be, as i said, fairly new to this lol. If i need to post more i can post the whole thing. Quote Link to comment https://forums.phpfreaks.com/topic/173482-solved-php-game-problem/#findComment-914462 Share on other sites More sharing options...
peranha Posted September 8, 2009 Share Posted September 8, 2009 We need the input to database part, not the receive part of the script since you said that there is nothing in the database, the error is inputing it. Quote Link to comment https://forums.phpfreaks.com/topic/173482-solved-php-game-problem/#findComment-914465 Share on other sites More sharing options...
systemseven Posted September 8, 2009 Author Share Posted September 8, 2009 We need the input to database part, not the receive part of the script since you said that there is nothing in the database, the error is inputing it. oh okay, sorry This is the whole top: <?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>"; }}}} ?> And this is the message input area: <tr class=text> <td colspan=2>Message:</td> </tr> <tr class=sub> <td colspan=2><textarea name='text' style='width: 98%; height: 175px' class=submit><?php if ($message > 0){ echo "[b]On:[/b] $dateon. $fromper [b] Wrote:[/b] $ini"; }else{ } ?></textarea></td> </tr> <tr class=title> <td colspan=2><input type=submit name=Send value=Send class=submit></td> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/173482-solved-php-game-problem/#findComment-914468 Share on other sites More sharing options...
Philip Posted September 8, 2009 Share Posted September 8, 2009 if(strip_tags($_POST['Send'])){ $text=strip_tags(addslashes($text)); Shouldn't that be: if(strip_tags($_POST['Send'])){ $text=strip_tags(addslashes($_POST['text'])); Quote Link to comment https://forums.phpfreaks.com/topic/173482-solved-php-game-problem/#findComment-914471 Share on other sites More sharing options...
systemseven Posted September 8, 2009 Author Share Posted September 8, 2009 if(strip_tags($_POST['Send'])){ $text=strip_tags(addslashes($text)); Shouldn't that be: if(strip_tags($_POST['Send'])){ $text=strip_tags(addslashes($_POST['text'])); Thank you! Problem solved, and i seriously appreciate it haha. Quote Link to comment https://forums.phpfreaks.com/topic/173482-solved-php-game-problem/#findComment-914472 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.