-Trying to retrieve user info via their last visit IP.
-This PHP script is not in myforum.net/forum/, it's in subdomain.myforum.net.
Why isn't anything "echoed"?
PHP Code:
<?php
error_reporting(E_ALL);
define('IN_MYBB', 1);
require_once '/home/vol4/byethost11.com/username/myforum.net/htdocs/forum/global.php';
$ip = $_SERVER['REMOTE_ADDR'];
$query = $db->query("SELECT username,postnum,usergroup,additionalgroups,lastip FROM mybb_users WHERE lastip='$ip'");
$user = $db->fetch_array($query);
if($user['username'] == NULL)
{
die("Invalid User");
}
$username = $user['username'];
$posts = $user['postnum'];
$usergroup = $user['usergroup'];
$additional = $user['additionalgroups'];
echo $username . "<br>";
echo $posts . "<br>";
echo $usergroup . "<br>";
echo $additional . "<br>";
?>
|
(12-05-2010 12:18 PM)Iamazn Wrote: [ -> ]
PHP Code:
<?php
require_once '/home/vol4/byethost11.com/username/myforum.net/htdocs/forum/global.php';
|
That will most likely break. Best to chdir() to the correct directory. Defining MYBB_ROOT manually may work too (cbf checking).
(12-05-2010 01:35 PM)ZiNgA BuRgA Wrote: [ -> ] (12-05-2010 12:18 PM)Iamazn Wrote: [ -> ]
PHP Code:
<?php
require_once '/home/vol4/byethost11.com/username/myforum.net/htdocs/forum/global.php';
|
That will most likely break. Best to chdir() to the correct directory. Defining MYBB_ROOT manually may work too (cbf checking).
How do I "define" MYBB_ROOT?
(12-05-2010 03:40 PM)ZiNgA BuRgA Wrote: [ -> ]http://au.php.net/manual/en/function.define.php
Can chdir() "go back" directories?
I tried:
Code:
chdir(/home/vol4/byethost11.com/username/myforum.net/htdocs/forum/);
|
and it didn't change the directory. (used "echo getcwd();")
Here's my FTP "structure":
Home: /home/vol4/byethost11.com/username/
Forum: /home/vol4/byethost11.com/username/myforum.net/htdocs/forum/
The PHP Script: /home/vol4/byethost11.com/username/test.myforum.net/htdocs/
(12-05-2010 03:53 PM)Iamazn Wrote: [ -> ]Can chdir() "go back" directories?
Yes. Do you have some safe mode restrictions?
IDK much about safe mode - maybe it only likes relative paths. Try that and see if that works.
EDIT:
http://php.net/manual/en/function.chdir.php Wrote:Note: When safe mode is enabled, PHP checks whether the directory in which the script is operating has the same UID (owner) as the script that is being executed.
Quote:When using PHP safe mode and trying to change to a dir that is not accessible due to the safe mode restrictions, the function simply fails without generating any kind of error message.
Perhaps check those.
I did say to use a relative path in your thread on the MyBB forums... even offered to login to your file system to see what it'd need to be for you.
Would chdir('/home/vol4/byethost11.com/username/myforum.net/htdocs/forum/');
work?
How do I get relative paths?
It's the path to the file you want relative to where you are currently. Say your structure was this:
You're in file.php, you need to include global.php, the relative path would be this:
You're currently in /site/, ../ means go back a folder, so you go back to /public_html/, then into /forum/, and then global.php
(12-06-2010 05:36 AM)MattR Wrote: [ -> ]It's the path to the file you want relative to where you are currently. Say your structure was this:
You're in file.php, you need to include global.php, the relative path would be this:
You're currently in /site/, ../ means go back a folder, so you go back to /public_html/, then into /forum/, and then global.php
This is the structure:
/ = root
/sub.myforum.net/htdocs/scr.php = script
/myforum.net/htdocs/forum/global.php = Global.php