2017-07-05, 05:51 PM
Pages: 1 2
2017-07-06, 03:58 AM
you can use code like below in a php file,
upload it to your MyBB files main folder & visit it with browser & copy the output
upload it to your MyBB files main folder & visit it with browser & copy the output
<?php
define("IN_MYBB",1);
include("global.php");
$result = $db->query("SELECT * FROM ".TABLE_PREFIX."users");
while ($row = $db->fetch_array($result)) {
echo $row['username'].','.$row['email'].'<br />';
}
2017-10-08, 02:21 PM
Is there a way to make sure the file isn't accessible to the general public?
2017-10-08, 02:27 PM
you can use mybb variable for your uid
like
like
if ($mybb->user['uid'] = 4){
your code goes here
}
here 4 indicates your user id on your forum. Just make sure to add code after global.php include variable.2017-10-08, 02:31 PM
Just use SQL to select the email column in the mybb_users table...
2017-10-08, 02:53 PM
(2017-10-08, 02:31 PM)Wires Wrote: [ -> ]Just use SQL to select the email column in the mybb_users table...
I'm a total noob. How would I go about doing that?
2017-10-08, 03:01 PM
(2017-10-08, 02:53 PM)ajkelsey Wrote: [ -> ]I'm a total noob. How would I go about doing that?
(2017-07-06, 03:58 AM).m. Wrote: [ -> ]you can use code like below in a php file,
upload it to your MyBB files main folder & visit it with browser & copy the output
<?php define("IN_MYBB",1); include("global.php"); $result = $db->query("SELECT * FROM ".TABLE_PREFIX."users"); while ($row = $db->fetch_array($result)) { echo $row['username'].','.$row['email'].'<br />'; }
2017-10-08, 03:34 PM
(2017-10-08, 03:01 PM)Dark-Power-Invader Wrote: [ -> ](2017-10-08, 02:53 PM)ajkelsey Wrote: [ -> ]I'm a total noob. How would I go about doing that?
(2017-07-06, 03:58 AM).m. Wrote: [ -> ]you can use code like below in a php file,
upload it to your MyBB files main folder & visit it with browser & copy the output
<?php define("IN_MYBB",1); include("global.php"); $result = $db->query("SELECT * FROM ".TABLE_PREFIX."users"); while ($row = $db->fetch_array($result)) { echo $row['username'].','.$row['email'].'<br />'; }
I did that and I tried inserting your suggested addition about the user id. While I did receive the output of email addresses, your suggestion seemed to have no effect on limiting who could use the file.
2017-10-08, 03:40 PM
Change the file with this code:
<?php
define("IN_MYBB",1);
include("global.php");
if ($mybb->user['uid'] == 1) {
$result = $db->query("SELECT * FROM ".TABLE_PREFIX."users");
while ($row = $db->fetch_array($result)) {
echo $row['username'].','.$row['email'].'<br />';
}
} else {
error_no_permission();
}
2017-10-08, 03:49 PM
That worked. Thanks!
How do I find my user id? Since my user account is the admin, I guessed it as 1.
How do I find my user id? Since my user account is the admin, I guessed it as 1.
Pages: 1 2