function deb_run_query($query, $echo = 'N', $csv = 'N') { global $mysqli; if ($echo == 'Y') { echo "<div><div class='collHead'><i class='icon-minus-sign'></i> Query</div><div class='collDetail'><PRE>\r\n{$query}\r\n</PRE><br/>"; } if ($mysqli->multi_query($query)) { do { // store first or next result set if ($result = $mysqli->store_result()) { // Print header echo '<TABLE class="table table-bordered table-condensed" width="100%"><THEAD><TR>'; while ($finfo = $result->fetch_field()) { printf("<TH>%s</TH>", $finfo->name); } echo "</TR></THEAD><TBODY>"; // Print body if ($csv == 'Y') { echo "<TD COLSPAN='{$numcols}'>"; } while ($row = $result->fetch_row()) { if ($csv != 'Y') { echo "<TR>"; } for ($j = 0; $j < $result->field_count; $j++) { if ($csv == 'Y') { printf("%s,", htmlspecialchars($row[$j])); } else { ?> <td><?php echo utl_xml_table($row[$j]); ?> </TD><?php } } if ($csv != 'Y') { echo "</TR>"; } if ($csv == 'Y') { echo "<br/>"; } } $result->free(); echo "</TBODY></TABLE>"; } // print divider if ($mysqli->more_results()) { echo "<br/>"; $more = 1; $mysqli->next_result(); } else { $more = 0; } } while ($more > 0); } else { die("Bad query - try again <BR/> " . mysqli_error($mysqli)); } if ($echo == 'Y') { echo "</div></div>"; } }
while ($row = $result->fetch_assoc()) { ?> <li> <div class="messageDate"<?php if ($row['message_uts'] > $lastMessageUTS) { echo " style='font-style:normal;font-weight:bold;color:brown'"; } ?> ><?php echo gmdate($dt_format, $row['message_uts'] - $offset * 60); ?> </div> <div class="messageText"<?php if ($row['to_email'] < 0) { echo " style='font-style:italic;color:blue'"; } ?> ><?php echo utl_xml_table($row['message']); ?> </div> </li> <?php } } // Close result $result->close(); // Close connection $mysqli->close(); // Close session session_write_close();
// Set up email address if ($row['email1'] != '') { $email_to = "{$row['username']} <{$row['email1']}>"; } if ($row['email1'] != '' and $row['email2'] != '') { $email_to .= ' , '; } if ($row['email2'] != '') { $email_to .= "{$row['username']} <{$row['email2']}>"; } // Set up title $title = "Message from Game {$row['gameno']}"; // Set up body header $email = $body . "<ul class='breadcrumb'><li><a href='http://game.asup.co.uk/game.php?gameselect={$row['gameno']}'>Message from Game {$row['gameno']}</a></li></ul>"; // Add message $email .= "<div class='row'><div class='span12'>" . utl_xml_table($row['message']) . "</div></div>"; // Finish body $email .= "</div></body></html>"; // Debug info echo "Sending email to {$email_to} : " . htmlentities($email) . "\n\r"; $rx = mail($email_to, $title, wordwrap($email, 70), $headers, "*****@*****.**"); // Update to email marker - -1 becomes visible, -9 is deleted if ($row['to_email'] == -1) { $mysqli->query("Update sp_messages Set to_email={$rx} Where messageno={$row['messageno']}") or die("CRON 005: " . $mysqli->error); } else { if ($row['to_email'] == -9) { $mysqli->query("Delete From sp_messages Where messageno={$row['messageno']}") or die("CRON 006: " . $mysqli->error); } } $mysqli->close(); }
// Process forwards and backwards arrows if (isset($_POST['comms_older'])) { $_SESSION['comms_first'] = min($_SESSION['comms_first'] + $ent, floor($_SESSION['comms_limit'] / $ent) * $ent); } elseif (isset($_POST['comms_newer'])) { $_SESSION['comms_first'] = max($_SESSION['comms_first'] - $ent, 0); } echo "<first>{$_SESSION['comms_first']}</first>"; // Highest message row $query = "Select Distinct message_uts, message {$from} and to_email >= 0 Order By messageno desc"; $result = $mysqli->query($query) or die("Bad query syntax: " . $query); $_SESSION['comms_limit'] = $result->num_rows; echo "<total>{$_SESSION['comms_limit']}</total>"; $result->close(); // Run message query for specified entries $query = "Select Distinct message_uts, message {$from} and to_email >= 0 Order By messageno desc Limit {$_SESSION['comms_first']},{$ent}"; $result = $mysqli->query($query) or die("Bad query syntax: " . $query); echo "<messages>"; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo "<message><messageDate>" . gmdate($dt_format, $row['message_uts'] - $offset * 60) . "</messageDate><messageText><![CDATA[" . utl_xml_table($row['message']) . "]]></messageText></message>"; } } echo "</messages>"; //echo "<qry><![CDATA[$query]]></qry>"; // Close result $result->close(); // Close connection $mysqli->close(); // Close session session_write_close(); echo "</comms>";
?> </td> <td valign='top' class='hidden-phone'><?php echo $row['userno']; ?> </td> <td valign='top'><?php echo $row['ordername']; ?> </td> <td valign='top'><?php echo $row['uts']; ?> </td> <td><?php echo utl_xml_table($row['order_code']); ?> </td> </tr> <?php } } else { ?> <tr><td colspan='4'>No data from <pre><?php print_r($_POST); ?> </pre></td></tr><?php } if ($result) { $result->close(); }