News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Query for non-banned members

Started by SlyBaldGuy, June 16, 2013, 04:40:13 PM

Previous topic - Next topic

SlyBaldGuy

Hey guys, I've written this query, which should give me a list of non-banned members, but I'm not able to get the server to complete the run on it, though I only have 13,000 members.  Any suggestions?

select m.emailAddress,m.memberName from smf_members m, smf_log_banned b where m.ID_MEMBER != b.ID_MEMBER

Matthew K.

Try adding this file and then visiting it in your browser.

<?php
require_once('/path/to/SSI.php');
global 
$user_info;
if (
$user_info['is_admin']) {
$request db_query("SELECT m.emailAddress,m.memberName FROM smf_members m, smf_log_banned b WHERE m.ID_MEMBER != b.ID_MEMBER"falsefalse);
if (!$request)
db_fatal_error();
$bannedMembers = array();
while ($row mysql_fetch_row($request))
$bannedMembers[] = $row;
mysql_free_result($request);
echo '<pre>'print_r($bannedMembers), '</pre>';
}
else {
exit('Sorry, only admins.');
}

I apologize if it doesn't work, I didn't test it, and honestly, I've not coded for 1.1.x in...ages.

SlyBaldGuy

Thanks!  I tried it and I get the following:

Warning: require_once(/SSI.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/s/l/y/slybguy/html/smf/nonbanned.php on line 2

Fatal error: require_once() [function.require]: Failed opening required '/SSI.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/s/l/y/slybguy/html/smf/nonbanned.php on line 2

Matthew K.

Get rid of the beginning slash in the SSI path.

SlyBaldGuy

Thanks again, but still didn't work.  I wish I knew enough to play with it...but this is beyond my scope.

Matthew K.

Okay, so what doesn't work? Any errors?

SlyBaldGuy

Sorry about that...I still get the same errors:

Warning: require_once(/SSI.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/s/l/y/slybguy/html/smf/nonbanned.php on line 2

Fatal error: require_once() [function.require]: Failed opening required '/SSI.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/s/l/y/slybguy/html/smf/nonbanned.php on line 2

Matthew K.

Attach your code please. It doesn't look like you changed the path.

SlyBaldGuy

Here's the path that I'm entering that I got when going to ssi_examples.php

<?php require("/home/content/s/l/y/slybguy/html/smf/SSI.php"); ?>

So it looks like:

<?php
require("/home/content/s/l/y/slybguy/html/smf/SSI.php"); ?>

global $user_info;
if ($user_info['is_admin']) {
    $request = db_query("SELECT m.emailAddress,m.memberName FROM smf_members m, smf_log_banned b WHERE m.ID_MEMBER != b.ID_MEMBER", false, false);
if (!$request)
db_fatal_error();
$bannedMembers = array();
while ($row = mysql_fetch_row($request))
$bannedMembers[] = $row;
mysql_free_result($request);
echo '<pre>', print_r($bannedMembers), '</pre>';
}
else {
exit('Sorry, only admins.');
}

Matthew K.

Why'd you close PHP? Also use a relative path instead of absolute.

SlyBaldGuy

Crap, I didn't see that I closed the php

When I removed the close I get the following now:

Connection Problems

Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later.

Matthew K.

So any errors in SMF's error log?

SlyBaldGuy

I'm not seeing any in the forum error log. 

Matthew K.

I'll try to throw up a 1.1 install tomorrow and see what I am forgetting.





Advertisement: