Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 43 in /home/cloud/public_html/modules/members/main/messaging.php on line 10
ermm the script is this:
<?php
global $root, $msgUsername, $username, $msgAction, $msgMessage, $whom, $method, $who, $to, $rquote, $record;
$msgUsername = $username;
if($msgAction=="Send") {
$msgMessage .= "\n\n- $msgUsername";
formatText($msgMessage);
if($who) {
$reply = mysql_result(mysql_query("SELECT email FROM {$GLOBALS['prefix']}_members WHERE name='$msgUsername'"), 0);
if(in_array("The clan", $who)) {
mysql_query("INSERT INTO {$GLOBALS['prefix']}_messages (sent_to,sent_from,message) VALUES ('The clan','$msgUsername','$msgMessage')");
$addresses = mysql_query("SELECT name,email FROM {$GLOBALS['prefix']}_members");
while($row = mysql_fetch_row($addresses))
$to?$to.=", ".$row[0]." <".$row[1].">":$to = $row[0]." <".$row[1].">";
unformatText($msgMessage);
mail($to, "Clan message from $msgUsername, sent to whole clan", $msgMessage, "From: $msgUsername <$reply>\nReply-To: $reply");
Alert("Message sent to The clan via on-site messaging and/or to every member via e-mail.<BR><BR>");
}
else {
foreach($who as $whom) {
if($method=="site" || $method=="both")
mysql_query("INSERT INTO {$GLOBALS['prefix']}_messages (sent_to,sent_from,message) VALUES ('$whom','$msgUsername','$msgMessage')");
if($method=="mail" || $method=="both") {
$to = mysql_result(mysql_query("SELECT email FROM {$GLOBALS['prefix']}_members WHERE name='$whom'"), 0);
$clan_tag = $GLOBALS['tag'];
unformatText($msgMessage);
mail($to, "Clan $clan_tag message from $msgUsername", $msgMessage, "From: $msgUsername <$reply>\nReply-To: $reply");
}
Alert("Message sent to $whom.<BR>");
}
print "<BR>";
}
}
else
Alert("Error: You must select at least one recipient.<BR><BR>");
}
else if($msgAction=="delete") {
$result = mysql_query("DELETE FROM {$GLOBALS['prefix']}_messages WHERE id=$record");
Alert("Message deleted.<BR><BR>");
}
print <<<EOT
You can send a message via email, the site, or both, depending on importance.<BR><BR>
Messages can be sent to any combination of clan members. Sending to 'The Clan' mails everyone and adds a message to the site.<BR><BR>
Admins have the ability to archive messages, so they dont clutter the main messages list, but can still be kept for future reference.<BR><BR>
<a href="?page=account_details&sub=changeemail">Change email address</a><BR><BR>
Send a message:<BR>
<form name="SendMessage" action="$root" method="POST">
<table>
<tr>
<td>To: </td>
<td>
EOT;
selectMembers($to, 1);
If($rquote){
$quote = mysql_query("SELECT id,sent_at,message,sent_from,sent_to FROM {$GLOBALS['prefix']}_messages WHERE id=$rquote");
$qrow = mysql_fetch_row($quote);
}
print <<<EOT
</td>
</tr>
<tr>
<td>Via: </td>
<td><input type="radio" name="method" value="mail">email<BR>
<input type="radio" name="method" value="site" checked>on-site<BR>
<input type="radio" name="method" value="both">both</td>
</tr>
<tr>
<td>Message: </td>
<td><textarea cols="60" rows="8" name="msgMessage" wrap="soft">
EOT;
If($quote){
echo("\nReplying to:");
echo("\n$qrow[2]");
}
print <<<EOT
</textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><br><input type="submit" name="msgAction" value="Send"></td>
</tr>
</table>
</form><BR><BR>
EOT;
$msgMessages = mysql_query("SELECT id,sent_at,message,sent_from,sent_to FROM {$GLOBALS['prefix']}_messages WHERE sent_to='$msgUsername' OR sent_to='The clan' ORDER BY sent_at DESC");
if(!mysql_num_rows($msgMessages))
print "You have no new messages.<BR><BR><BR>";
else {
echo"<table width='85%'>";
print <<<EOT
<tr>
<td class="title">Messages recieved:</td>
</tr>
</table>
EOT;
while($row = mysql_fetch_row($msgMessages)) {
OpenTable();
echo "<BR>";
$date = createDate($row[1]);
$time = createTime($row[1]);
$reply_to = mysql_result(mysql_query("SELECT email FROM {$GLOBALS['prefix']}_members WHERE name='$row[3]'"), 0);
print <<<EOT
<table width="100%">
<tr>
<td class="title">Recieved on $date at $time</td>
<td rowspan="2" align="right" valign="middle"><table>
</table></td>
</tr>
<tr>
<td><BR>$row[2]</td>
</tr>
<tr><td class="title"><BR>From <BR><a href="mailto:$reply_to">$row[3]</a></td></tr>
<tr align="center">
<td colspan="2">
<div align=center>
| <a href="$root&to=$row[3]">Reply</a> |
<a href="$root&to=$row[3]&rquote=$row[0]">Reply w/Quote</a> |
EOT;
if($sent_to!="The clan")
print <<<EOT
<a href="$root&msgAction=delete&record=$row[0]">Delete</a> |
</div>
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
</table>
EOT;
CloseTable();
print "<BR>";
}
}
$msgMessages = mysql_query("SELECT id,sent_at,message,sent_to FROM {$GLOBALS['prefix']}_messages WHERE sent_from='$msgUsername' ORDER BY sent_at DESC");
if(!mysql_num_rows($msgMessages))
print "All your sent messages have been viewed/deleted.<BR><BR>";
else {
print <<<EOT
<BR><table width="100%">
<tr>
<td class="title">Messages sent:</td>
</tr>
</table>
EOT;
OpenTable();
echo "<BR>";
while($row = mysql_fetch_row($msgMessages)) {
$date = createDate($row[1]);
$time = createTime($row[1]);
$qryReply = mysql_query("SELECT email FROM {$GLOBALS['prefix']}_members WHERE name='$row[3]'");
if(mysql_num_rows($qryReply))
$reply_to = "<a href=\"mailto:".mysql_result(($qryReply), 0)."\">";
else
$reply_to = "";
print <<<EOT
<table width="100%">
<tr>
<td class="title">Sent on $date at $time to $reply_to$row[3]</a></td>
EOT;
if($author=="The clan") {
$temp = " colspan='2'";
print <<<EOT
<td rowspan="2" align="right" valign="middle"><table>
</table></td>
EOT;
}
else
$temp = "";
print <<<EOT
</tr>
<tr>
<td>$row[2]</td>
</tr>
EOT;
if($author=="The clan") {
print <<<EOT
<tr>
<td><BR>| <a href="$root&msgAction=delete&record=$row[0]">Delete</a> |</td>
</tr>
EOT;
}
print <<<EOT
<tr>
<td$temp><BR></td>
</tr>
</table>
EOT;
}
CloseTable();
}
?>