Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
RevCMS Help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Meap" data-source="post: 350672" data-attributes="member: 1553"><p>yeah it works fine but im on about searching chatlogs on housekeeping, Ill post the code for the whole file I have for it for my housekeeping</p><p>[PHP]<?php</p><p> </p><p>$searchResults = null;</p><p></p><p>if (isset($_GET['timeSearch']))</p><p>{</p><p> $_POST['searchQuery'] = $_GET['timeSearch'];</p><p> $_POST['searchType'] = '4';</p><p>}</p><p></p><p>if (isset($_POST['searchQuery']))</p><p>{</p><p> $query = filter($_POST['searchQuery']);</p><p> $type = $_POST['searchType'];</p><p> </p><p> $q = "SELECT * FROM users_chatlogs WHERE ";</p><p> </p><p> switch ($type)</p><p> {</p><p> default:</p><p> case '1':</p><p> </p><p> $q .= "user_id = '" . $query . "'";</p><p> break;</p><p> </p><p> case '2':</p><p> </p><p> $q .= "message LIKE '%" . $query . "%'";</p><p> break;</p><p> </p><p> case '3':</p><p> </p><p> $q .= "room_id = '" . $query . "'";</p><p> break;</p><p> </p><p> case '4':</p><p> </p><p> $cutMin = intval($query) - 300;</p><p> $cutMax = intval($query) + 300;</p><p> </p><p> $q .= "timestamp >= " . $cutMin . " AND timestamp <= " . $cutMax;</p><p> }</p><p> </p><p> $searchResults = mysql_query($q);</p><p>}</p><p></p><p></p><p>?> </p><p><?php</p><p></p><p>if (isset($searchResults))</p><p>{</p><p> echo '<h2>Show</p><p>Results: - You have Searched for "<span style="font-size: 125%;">' . filter($_POST['searchQuery']) . '</span>"</h2>';</p><p> echo '<br /><p><a href="chatlogs" class="btn btn-small btn-primary">Back to Search</a></p><br /></p><p> </p><p> </p><p><table class="table table-striped"></p><p> <thead></p><p> <tr></p><p> <th>User</th></p><p> <th>Room</th></p><p> <th>Message</th></p><p> <th>Timestamp</th></p><p> </tr></p><p> </thead></p><p> <tbody> ';</p><p> </p><p> </p><p> </p><p>while ($result = mysql_fetch_assoc($searchResults))</p><p> {</p><p> </p><p> $grabRoom2 = mysql_query("SELECT * FROM rooms_data WHERE id = '" . $result['room_id'] . "'");</p><p> while ($room2 = mysql_fetch_assoc($grabRoom2))</p><p> {</p><p> $grabUser2 = mysql_query("SELECT * FROM users WHERE id = '" . $result['user_id'] . "'");</p><p> while ($user2 = mysql_fetch_assoc($grabUser2))</p><p> {</p><p> </p><p> echo '<tr">';</p><p> </p><p> // Username of sender</p><p> echo '<td align="left" valign="top">' . $user2['username'] . '</td>';</p><p> </p><p> // Room ID</p><p> echo '<td align="left" valign="top">' . $room2['caption'] . '</td>';</p><p> </p><p> // Message</p><p> echo '<td align="left" valign="top">' . htmlspecialchars($result['message']) . '</td>';</p><p> </p><p> // Timestamp (UNIX Timestamp)</p><p> echo '<td align="left" valign="top">' . date('m.d.y, g:i a', $result['timestamp']) . '</td>';</p><p> </p><p> echo '</tr>';</p><p> </p><p> echo '</tbody></p><p> </thead></p><p> </table>';</p><p> }</p><p> }</p><p> }</p><p> ?></p><p><?php } else { ?></p><p> <?php</p><p> </p><p> echo '<h2>Search Chatlogs</h2></p><p> </p><p> <br /></p><p> </p><p> <form method="post"></p><p> </p><p> Search Type:&nbsp;</p><p> <select name="searchType"></p><p> <option value="1">By User</option></p><p> <option value="2">By message content</option></p><p> <option value="3">By Room (Single ID)</option></p><p> <option value="4">By timestamp (600 seconds range)</option></p><p> </select></p><p> </p><p> <br /><br /></p><p> </p><p> Search:&nbsp;</p><p> <input type="text" name="searchQuery"></p><p> </p><p> <br /></p><p> </p><p> <input type="submit" class="btn btn-small btn-primary" value="Search Records"></p><p> </p><p> </form></p><p> </p><p> </p><p> </br><h2>Recent Activity</h2></p><p> </p><p><table class="table table-striped"></p><p> <thead></p><p> <tr></p><p> <th>User</th></p><p> <th>Room</th></p><p> <th>Message</th></p><p> <th>Timestamp</th></p><p> </tr></p><p> </thead></p><p> <tbody> ';</p><p> </p><p> </p><p>$getWhisper = mysql_query("SELECT * FROM users_chatlogs ORDER BY id DESC LIMIT 30");</p><p> while ($whisper = mysql_fetch_assoc($getWhisper))</p><p> {</p><p> </p><p> $getWhisper2 = mysql_query("SELECT * FROM users WHERE id = '" . $whisper['user_id'] . "'");</p><p> while ($whisper2 = mysql_fetch_assoc($getWhisper2))</p><p> {</p><p> </p><p> $grabRoom = mysql_query("SELECT * FROM rooms_data WHERE id = '" . $whisper['room_id'] . "'");</p><p> while ($room = mysql_fetch_assoc($grabRoom))</p><p> {</p><p> </p><p> echo '<tr">';</p><p> </p><p> // Username of sender</p><p> echo '<td align="left" valign="top">' . $whisper2['username'] . '</td>';</p><p> </p><p> // Room ID</p><p> echo '<td align="left" valign="top">' . $room['caption'] . '</td>';</p><p> </p><p> // Message</p><p> echo '<td align="left" valign="top">' . htmlspecialchars($whisper['message']) . '</td>';</p><p> </p><p> // Timestamp (UNIX Timestamp)</p><p> echo '<td align="left" valign="top">' . date('m.d.y, g:i a', $whisper['timestamp']) . '</td>';</p><p> </p><p> echo '</tr>';</p><p> </p><p> }</p><p> }</p><p> }</p><p> }</p><p>?>[/PHP]</p></blockquote><p></p>
[QUOTE="Meap, post: 350672, member: 1553"] yeah it works fine but im on about searching chatlogs on housekeeping, Ill post the code for the whole file I have for it for my housekeeping [PHP]<?php $searchResults = null; if (isset($_GET['timeSearch'])) { $_POST['searchQuery'] = $_GET['timeSearch']; $_POST['searchType'] = '4'; } if (isset($_POST['searchQuery'])) { $query = filter($_POST['searchQuery']); $type = $_POST['searchType']; $q = "SELECT * FROM users_chatlogs WHERE "; switch ($type) { default: case '1': $q .= "user_id = '" . $query . "'"; break; case '2': $q .= "message LIKE '%" . $query . "%'"; break; case '3': $q .= "room_id = '" . $query . "'"; break; case '4': $cutMin = intval($query) - 300; $cutMax = intval($query) + 300; $q .= "timestamp >= " . $cutMin . " AND timestamp <= " . $cutMax; } $searchResults = mysql_query($q); } ?> <?php if (isset($searchResults)) { echo '<h2>Show Results: - You have Searched for "<span style="font-size: 125%;">' . filter($_POST['searchQuery']) . '</span>"</h2>'; echo '<br /><p><a href="chatlogs" class="btn btn-small btn-primary">Back to Search</a></p><br /> <table class="table table-striped"> <thead> <tr> <th>User</th> <th>Room</th> <th>Message</th> <th>Timestamp</th> </tr> </thead> <tbody> '; while ($result = mysql_fetch_assoc($searchResults)) { $grabRoom2 = mysql_query("SELECT * FROM rooms_data WHERE id = '" . $result['room_id'] . "'"); while ($room2 = mysql_fetch_assoc($grabRoom2)) { $grabUser2 = mysql_query("SELECT * FROM users WHERE id = '" . $result['user_id'] . "'"); while ($user2 = mysql_fetch_assoc($grabUser2)) { echo '<tr">'; // Username of sender echo '<td align="left" valign="top">' . $user2['username'] . '</td>'; // Room ID echo '<td align="left" valign="top">' . $room2['caption'] . '</td>'; // Message echo '<td align="left" valign="top">' . htmlspecialchars($result['message']) . '</td>'; // Timestamp (UNIX Timestamp) echo '<td align="left" valign="top">' . date('m.d.y, g:i a', $result['timestamp']) . '</td>'; echo '</tr>'; echo '</tbody> </thead> </table>'; } } } ?> <?php } else { ?> <?php echo '<h2>Search Chatlogs</h2> <br /> <form method="post"> Search Type: <select name="searchType"> <option value="1">By User</option> <option value="2">By message content</option> <option value="3">By Room (Single ID)</option> <option value="4">By timestamp (600 seconds range)</option> </select> <br /><br /> Search: <input type="text" name="searchQuery"> <br /> <input type="submit" class="btn btn-small btn-primary" value="Search Records"> </form> </br><h2>Recent Activity</h2> <table class="table table-striped"> <thead> <tr> <th>User</th> <th>Room</th> <th>Message</th> <th>Timestamp</th> </tr> </thead> <tbody> '; $getWhisper = mysql_query("SELECT * FROM users_chatlogs ORDER BY id DESC LIMIT 30"); while ($whisper = mysql_fetch_assoc($getWhisper)) { $getWhisper2 = mysql_query("SELECT * FROM users WHERE id = '" . $whisper['user_id'] . "'"); while ($whisper2 = mysql_fetch_assoc($getWhisper2)) { $grabRoom = mysql_query("SELECT * FROM rooms_data WHERE id = '" . $whisper['room_id'] . "'"); while ($room = mysql_fetch_assoc($grabRoom)) { echo '<tr">'; // Username of sender echo '<td align="left" valign="top">' . $whisper2['username'] . '</td>'; // Room ID echo '<td align="left" valign="top">' . $room['caption'] . '</td>'; // Message echo '<td align="left" valign="top">' . htmlspecialchars($whisper['message']) . '</td>'; // Timestamp (UNIX Timestamp) echo '<td align="left" valign="top">' . date('m.d.y, g:i a', $whisper['timestamp']) . '</td>'; echo '</tr>'; } } } } ?>[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
RevCMS Help
Top