Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2001
Posts: 50
Journeyman
Journeyman
Offline
Joined: Apr 2001
Posts: 50
I'm browsing those scripts and found the following codes:



// Require the library
require ("main.inc.php");

// -----------------
// Get the user info
$Username = $w3t_myname;
$Password = $w3t_mypass;

$userob = new user;
$user = $userob -> authenticate("$Username","$Password","U_Username, U_Password, U_Groups, U_TimeOffset");


then can I simply use


if ($user['U_Username'])
{
echo "Welcome home, $user[U_Username] !";
}
else
echo "YOU'RE NOT LOGINED.";


to check the user's login state?

Is that right?

Sponsored Links
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Yep, that should work fine.


UBB.threads Developer
Joined: Apr 2001
Posts: 50
Journeyman
Journeyman
Offline
Joined: Apr 2001
Posts: 50
Rick, I've got a strange problem on this.

I'm having these codes: (in a different directory to w3t)

[:blue]
<html>
<head>
[:orange]
<?
// Require the library
require ("../forum/main.inc.php");
require ("../forum/languages/$lang[THIS_FILE]/wwwthreads.php");

// -----------------
// Get the user info
$Username = $w3t_myname;
$Password = $w3t_mypass;

$userob = new user;
$user = $userob -> authenticate("$Username","$Password","U_Username, U_Password, U_Groups, U_TimeOffset");

}
?>


<title>mediafront</title>
blah..blah..blah...

[:orange]
<?

if ($user['U_Username'])
{
echo "$lang[INTRO_SUB], $user[U_Username]";
}
else
{
echo "
<form method=POST action="$config[phpurl]/start_page.php">
<input type=HIDDEN name=Cat value="">
<font size=1>Your ID:</font>
<input type=text name = Loginname class="formboxes" size="8"><br>
<font size=1>Password:</font>
<input type=password name=Loginpass class="formboxes" size="8">
<input type=submit name=option value="Login" class="buttons">
<font size=1 color=#FF0000><a href=$config[phpurl]/newuser.php>Register Now!</a></font>
</form>
";
}
?>


blah..blah..
</body>
</html>


But the variable $user['U_Username'] seems not worked.
When I try to strip the above paragraph of codes to only:
[:orange]
echo "$lang[INTRO_SUB], $user[U_Username]";

I can see only [:orange]Welcome, on the screen.
But the same codes could be worked simply fine when this scripts was located in w3t's directory. What's the problem?

BTW, I use session for user authentication.

Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
I'm not sure. I don't know all the details on sessions if they work domain wide or if they are limited to certain directories. If they are limited to the directory they are created within then that is probably the reason as the session variables can't be accessed from a different directory.


UBB.threads Developer
Joined: Apr 2001
Posts: 50
Journeyman
Journeyman
Offline
Joined: Apr 2001
Posts: 50
I've try to do some more test on this issue and found this:

The require is using a absolute path to the server but not the web server. So when someone tried to write their own scripts and put them in the root of their web site, they should use require ('/www/forum/main.inc.php'); instead of using require ('/forum/main.inc.php'); .

And also if there were require commands located in main.inc.php, they should be all changed to absolute path too.

But I still can't find the problem on the session issue.
Maybe it's not a session problem but the absolute path and relative path problem (w3t is currently using a relative path on all of its configured path and it might worked fine if it was a absolute path I guess)

Sponsored Links
Joined: Mar 2000
Posts: 84
Member
Member
Offline
Joined: Mar 2000
Posts: 84
You may want to consider adding an extra table to your database to store the session information in, so regardless of whatever page the user is visiting, you can query the table for the session information, and empty the table upon exit.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)