PHP PM Script! Infobox wird nicht angezeigt?

thehacker

Anhänger der Apachen
Hallo,
ich habe ein PM Script runtergeladen als Erweiterung für ein Tutorial.
Leider ein Problem es wird nichts angezeigt ? Wenn ich die inbox.php aufrufe!


Hier mal das script
inbox.php:
PHP:
<?php require('scripts/top.php'); ?>
<title>Info Box</title>
<div id='full'>
<?php
if ($username){
	echo "<a href='create_message.php'>Create Message</a>
	<div id='box'>
	  <b class='corners'>
	  <b class='corners1'><b></b></b>
	  <b class='corners2'><b></b></b>
	  <b class='corners3'></b>
	  <b class='corners4'></b>
	  <b class='corners5'></b></b>
	  <div class='cornersfg'>
		<div id='top'>Inbox for $username</div>
		<div id='bottom' style='padding: 10px;'>";
		////////////////////////////////////////////////////////////////////////
		require('scripts/connect.php');
		$query = mysql_query("SELECT * FROM messages WHERE to_user='$username' ORDER BY id DESC");
		$numrows = mysql_num_rows($query);
		if ($numrows > 0){
			echo "<form action='delete_message.php' method='POST'>";
			echo "<div id='messages'>
			<div id='leftside'><input type='checkbox' name='selectall'><input type='submit' name='deleteinbox' value='Delete' class='button'></div>
			<div id='rightside'>Date</div>
			<div id='center'>Subject and Message</div>
			<div style='clear: both;'></div>
			</div>";
			
			while($row = mysql_fetch_assoc($query)){
				$msg_id = $row['id'];
				$msg_to_user = $row['to_user'];
				$msg_to_id = $row['to_id'];
				$msg_from_user = $row['from_user'];
				$msg_from_id = $row['from_id'];
				$msg_subject = $row['subject'];
				$msg_content = $row['content'];
				$msg_date = $row['date'];
				$msg_from_delete = $row['from_delete'];
				$msg_to_delete = $row['to_delete'];
				
				if (!$msg_to_delete){
					echo "<div id='messages'>";
					echo "<div id='leftside'>
					<input type='checkbox' name='cb$msg_id' value='$msg_id'>
					<a href='profile.php?id=$msg_from_id' target='_blank'>$msg_from_user</a>
					</div>";
					echo "<div id='rightside'>$msg_date</div>";
					
					echo "<div id='center'>
					<span class='toggle'><a href='#'>$msg_subject</a></span>
					<div class='hiddenDiv'>
					<br>$msg_content<br><br>
					<span class='toggle'><a href='#'>REPLY</a></span>
					<div class='hiddenDiv'>
					<form action='reply.php' method='POST'>
						<input type='hidden' value='$msg_id' name='replyid'>
						<input type='text' name='replysubject' style='width: 300px;' class='text-box' value='RE: $msg_subject'><br>
						<textarea name='replycontent' style='width: 298px;' rows='5'></textarea><br><br>
						<input type='submit' name='replybutton' class='button' value='Reply'>
					</form>
					</div>
					</div>
					</div>";
					
					echo "<div style='clear: both;'></div>";
					echo "</div>";
					$num += 1;
				}
			}
			if ($num == 0){
				echo "You have no messages in your inbox.";
			}
			echo "</form>";
		}
		else
			echo "You have no messages in your inbox.";
		////////////////////////////////////////////////////////////////////////
	echo "</div>
	  </div>
	  <b class='corners'>
	  <b class='corners5'></b>
	  <b class='corners4'></b>
	  <b class='corners3'></b>
	  <b class='corners2'><b></b></b>
	  <b class='corners1'><b></b></b></b>
	</div>";
	
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////

	echo "<div id='box'>
	  <b class='corners'>
	  <b class='corners1'><b></b></b>
	  <b class='corners2'><b></b></b>
	  <b class='corners3'></b>
	  <b class='corners4'></b>
	  <b class='corners5'></b></b>
	  <div class='cornersfg'>
		<div id='top'>Outbox for $username</div>
		<div id='bottom' style='padding: 10px;'>";
		////////////////////////////////////////////////////////////////////////
		require('scripts/connect.php');
		$query = mysql_query("SELECT * FROM messages WHERE from_user='$username' ORDER BY id DESC");
		$numrows = mysql_num_rows($query);
		if ($numrows > 0){
			echo "<form action='delete_message.php' method='POST'>";
			echo "<div id='messages'>
			<div id='leftside'><input type='checkbox' name='selectall'><input type='submit' name='deleteoutbox' value='Delete' class='button'></div>
			<div id='rightside'>Date</div>
			<div id='center'>Subject and Message</div>
			<div style='clear: both;'></div>
			</div>";
			
			while($row = mysql_fetch_assoc($query)){
				$msg_id = $row['id'];
				$msg_to_user = $row['to_user'];
				$msg_to_id = $row['to_id'];
				$msg_from_user = $row['from_user'];
				$msg_from_id = $row['from_id'];
				$msg_subject = $row['subject'];
				$msg_content = $row['content'];
				$msg_date = $row['date'];
				$msg_from_delete = $row['from_delete'];
				$msg_to_delete = $row['to_delete'];
				
				if (!$msg_from_delete){
					echo "<div id='messages'>";
					echo "<div id='leftside'>
					<input type='checkbox' name='cb$msg_id' value='$msg_id'>
					<a href='profile.php?id=$msg_from_id' target='_blank'>$msg_from_user</a>
					</div>";
					echo "<div id='rightside'>$msg_date</div>";
					
					echo "<div id='center'>
					<span class='toggle'><a href='#'>$msg_subject</a></span>
					<div class='hiddenDiv'>
					<br>$msg_content<br><br>
					</div>
					</div>";
					
					echo "<div style='clear: both;'></div>";
					echo "</div>";
					$num += 1;
				}
			}
			if ($num == 0){
				echo "You have no messages in your outbox.";
			}
			echo "</form>";
		}
		else
			echo "You have no messages in your outbox.";
		////////////////////////////////////////////////////////////////////////
	echo "</div>
	  </div>
	  <b class='corners'>
	  <b class='corners5'></b>
	  <b class='corners4'></b>
	  <b class='corners3'></b>
	  <b class='corners2'><b></b></b>
	  <b class='corners1'><b></b></b></b>
	</div>";
	
	echo "</div>";
}
else
	echo "<center><h2><font color='red'>You must be logged in to view this page.</font></h2></center>";
require('scripts/bottom.php'); ?>

Danke schon mal für Hilfen :D
 
Schmeiss mal die zwei folgenden Zeilen oben isn Script, damit Fehler ausgegeben werden
PHP:
error_reporting(E_ALL);
ini_set('display_errors', 1);
 
1. THX
2. Ich habe folgende fehlermeldungen:
Warning: require(scripts/top.php) [function.require]: failed to open stream: No such file or directory in /usr/export/www/vhosts/funnetwork/hosting/maxikoch1996/inbox.php on line 3

Fatal error: require() [function.require]: Failed opening required 'scripts/top.php' (include_path='.:/usr/share/php') in /usr/export/www/vhosts/funnetwork/hosting/maxikoch1996/inbox.php on line 3
 
Ok angezeigt wird es jetzt aber:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /usr/export/www/vhosts/funnetwork/hosting/maxikoch1996/inbox.php on line 23

Was soll das heissen?
 
So nach dem Verschicken einer Nachrich bekomme ich noch mehr Fehler:
nbox for Admin

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /usr/export/www/vhosts/funnetwork/hosting/maxikoch1996/inbox.php on line 23
You have no messages in your inbox.
Outbox for Admin

Date
Subject and Message

Notice: Undefined index: to_user in /usr/export/www/vhosts/funnetwork/hosting/maxikoch1996/inbox.php on line 122

Notice: Undefined index: from_delete in /usr/export/www/vhosts/funnetwork/hosting/maxikoch1996/inbox.php on line 129

Notice: Undefined index: to_delete in /usr/export/www/vhosts/funnetwork/hosting/maxikoch1996/inbox.php on line 130
Admin
Jun 13, 2011
hi

Hi wie geht es dir?


Notice: Undefined variable: num in /usr/export/www/vhosts/funnetwork/hosting/maxikoch1996/inbox.php on line 149
 
Hi,

also am besten wäre es, wenn du hinter jede mysql_query()-Funktion mal den or-die-mysql_error-Schwanz anfügst. Beispiel:

PHP:
 $query = mysql_query("SELECT * FROM messages WHERE to_user='$username' ORDER BY id DESC") or die(mysql_error());

Dann findest du bestimmt schnell die Ursache dafür, dass du keine Results (boolean = false oder true, in diesem Falle also "false") bekommst.
 
Da die diese Art von Fragen sehr oft kommt, habe ich mal ein Tutorial geschrieben wie man am besten auf Fehlersuche geht.
PHP MySQL Debug Queries
Geh es doch mal durch und falls du die Lösung nicht findest, poste mal das ausgegebe SQL-Statement ins Forum.
 
Zurück