Jump to content

[SOLVED] PHP Game Problem


systemseven

Recommended Posts

Hey guys, fairly new here so please bare with me :P

 

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.

Link to comment
Share on other sites

                <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. :)

Link to comment
Share on other sites

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  :shy:

 

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.