php forum
php mysql forum
php mysql smarty
 
Page 1 of 2 1 2 >
Topic Options
#53363 - 05/24/02 06:47 AM Log-in Sequence for Other Areas of a Site
stupidboy.com Offline
Member

Registered: 06/14/00
Posts: 114
Loc: West Palm Beach, FL
We would you like to create a few areas in our site where it would be required for a user to log-in in order to participate.

Can this done with just the JavaScript cookie, or do we need to do something a bit further in regards to page / ubb integration?
_________________________
ni·hil·ism (n-lzm, n-)
n.

Philosophy.
An extreme form of skepticism that denies all existence.
A doctrine holding that all values are baseless and that nothing can be known or communicated.

Top
#53364 - 06/02/02 05:02 PM Re: Log-in Sequence for Other Areas of a Site
Chopped Onions Offline
Junior Member

Registered: 09/04/00
Posts: 16
Loc: Michigan, USA
I would also like to see something like this.

This way visitors wouldn't have to create seperate logins for accessing parts of the site. They could simply use the UBB member files.
_________________________
J3i Inc.
Windows Incident Resolution
Perl Script Installation
UBB Modification Installation

Top
#53365 - 06/03/02 10:51 AM Re: Log-in Sequence for Other Areas of a Site
Michael J Offline
Member

Registered: 05/24/02
Posts: 46
Look at the source for your forum summary page and you'll see the javascript code that reads the user cookie. You can use that code anywhere on your site to check to see if someone is logged in or not and include links to the log in page. If you want people to be able to log in and return to the non-UBB page that they came from, you'll need to hack ultimatebb.cgi and change:

Code:
[/code]to

[code]
Otherwise when they log in, it will just take them to the forums and not back to the page they came from. Keep in mind that reading cookies with javascript as a way to keep people out of members only html pages doesn't really work that well. They can just turn off javascript on their browsers and go anywhere on your site if they wanted.

Top
#53366 - 06/03/02 02:47 PM Re: Log-in Sequence for Other Areas of a Site
ScottRoberts Offline
Spotlight Winner

Registered: 02/01/01
Posts: 148
Loc: St. Louis, MO, U.S.A.
Michael J, this may be a "temporary" solution, but the problem is after the user logs in to the UBB and goes back to the non-UBB home page, the message on the home page will still read "You are not logged in. Login or register" instead of "Hello, BlueWave [ log out ]". This is exactly what we want to get accomplished here .
_________________________
Scott Roberts
VH Trade Forums
NetWebPros Hosting and Design

Top
#53367 - 06/03/02 02:55 PM Re: Log-in Sequence for Other Areas of a Site
LK Offline
Admin / Code Breaker

Registered: 03/24/01
Posts: 7396
URL? Make sure you're using the number instead of $vars_config{Cookie_Number}
_________________________

My Hacks Page (will be back with UBB 7!)
UBBDev - We put the class into UBB.classic!

Top
#53368 - 06/03/02 03:43 PM Re: Log-in Sequence for Other Areas of a Site
Michael J Offline
Member

Registered: 05/24/02
Posts: 46
</font><blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr /><font size="2" face="Verdana, Helvetica, sans-serif">Originally posted by BlueWave:
Michael J, this may be a "temporary" solution, but the problem is after the user logs in to the UBB and goes back to the non-UBB home page, the message on the home page will still read "You are not logged in. Login or register" instead of "Hello, BlueWave [ log out ]". This is exactly what we want to get accomplished here .</font><hr /></blockquote><font size="2" face="Verdana, Helvetica, sans-serif">No, it works fine becuase when you log in, it sets the user cookie. When you return to the page it will show that you are logged in as long as you have the javascript code in there properly. Like LK said, you need to use the actual number. The change that I posted ensures that it will accept the value for "refer" on the log in form even if it isn't a UBB page.

Top
#53369 - 06/03/02 03:59 PM Re: Log-in Sequence for Other Areas of a Site
ScottRoberts Offline
Spotlight Winner

Registered: 02/01/01
Posts: 148
Loc: St. Louis, MO, U.S.A.
Code:
[/code]and in the body:

[code]
_________________________
Scott Roberts
VH Trade Forums
NetWebPros Hosting and Design

Top
#53370 - 06/03/02 04:33 PM Re: Log-in Sequence for Other Areas of a Site
Michael J Offline
Member

Registered: 05/24/02
Posts: 46
Your javascript looks fine. The ultimatebb.cgi hack doesn't effect the cookie at all so the problem lies somewhere else. If you put that javascript code on any page of your site it will read the cookie and let you know if you are logged in or not even if you don't do any hacks to UBB whatsoever. As log as you don't logout first, when you go to a non-UBB page on your site the cookie is still there and shows you as logged in which is why you don't need to log in again if you return to the forums.

The only things that I can think of that could be wrong is that your UBB and pages either aren't on the same domain (cookies can only be read by the domain that wrote them) or you have a typo in your cookie number.

Top
#53371 - 06/04/02 02:05 PM Re: Log-in Sequence for Other Areas of a Site
LK Offline
Admin / Code Breaker

Registered: 03/24/01
Posts: 7396
One thing I can think about is that you forgot to copy function get Cookie tipsy [code][/code]
_________________________

My Hacks Page (will be back with UBB 7!)
UBBDev - We put the class into UBB.classic!

Top
#53372 - 06/07/02 09:20 AM Re: Log-in Sequence for Other Areas of a Site
ScottRoberts Offline
Spotlight Winner

Registered: 02/01/01
Posts: 148
Loc: St. Louis, MO, U.S.A.
Thanks for the help MIchael J and LK. I'll try LK's JS and see if that does the trick.
_________________________
Scott Roberts
VH Trade Forums
NetWebPros Hosting and Design

Top
#53373 - 07/13/02 12:51 PM Re: Log-in Sequence for Other Areas of a Site
stupidboy.com Offline
Member

Registered: 06/14/00
Posts: 114
Loc: West Palm Beach, FL
Did it work?

How about the cookie for private messages?
_________________________
ni·hil·ism (n-lzm, n-)
n.

Philosophy.
An extreme form of skepticism that denies all existence.
A doctrine holding that all values are baseless and that nothing can be known or communicated.

Top
#53374 - 07/15/02 05:08 AM Re: Log-in Sequence for Other Areas of a Site
Paulus Magnus Offline
Content Kidman

Registered: 10/15/01
Posts: 80
I've done this on my site using PHP. Being a member of the site allows my members to do lots of things like rate pictures, links and write reviews. They can also sign-up to a newswire service. If they're not logged in (no UBB cookie set) most of the pages remind them to login. This is a simple PHP page that asks them for their login details before comparing them to the UBB files to make sure they're accurate. If it works, I create the UBB cookie with PHP so it works on the forums when or if they move to that area of the site.

It works really well and the UBBmemberID is written to the MySQL tables when they rate or write a review and a check is made the next time they come around and says "sorry, you've already rated this picture" etc.

The newswire page just collects UBBmemderIDs and puts them in a MySQL table. When I send out an email it then reads through the MySQL table, extracts the current email address from the UBB Member file and sends the email to them.

It means the UBB member database is used across the site and the UBB blends in with everything else.
_________________________
» Team Nicole | UBB v6.3.0 «

Top
#53375 - 07/17/02 12:04 AM Re: Log-in Sequence for Other Areas of a Site
yosaid Offline
User

Registered: 07/13/01
Posts: 34
Loc: minneapolis
That was helpful guys. Thanks.

I have a quick question about DENYING entry to a page outside of the forum if the user isn't logged in the forums. Just like the PROFILE section where it says "YOU ARE NOT LOGGED IN" whenever someone tries to click on the profile link.

Thanks guys

Top
#53376 - 07/18/02 08:35 PM Re: Log-in Sequence for Other Areas of a Site
Michael J Offline
Member

Registered: 05/24/02
Posts: 46
Just add some code to your page to read the cookie. Don't just do this in JavaScript because if someone has JavaScript disabled they will be able access your page. I actually have both PHP code and JavaScript code on the same page to read the cookie. That way, if the user clicks the back button after they have logged out, JavaScript will catch it (the page will be cached on their computer so PHP code won't catch it).

Top
#53377 - 07/22/02 06:47 PM Re: Log-in Sequence for Other Areas of a Site
Paulus Magnus Offline
Content Kidman

Registered: 10/15/01
Posts: 80
If you put in a meta tag to stop caching on your PHP page, it will work.

<meta http-equiv="Pragma" content="no-cache">
_________________________
» Team Nicole | UBB v6.3.0 «

Top
#53378 - 07/23/02 12:38 PM Re: Log-in Sequence for Other Areas of a Site
yosaid Offline
User

Registered: 07/13/01
Posts: 34
Loc: minneapolis
Micheal J and Paulus Magnus, Thanks

For a person like me who isn't good at Java at all,

what java code do you suggest to block an access to a NON-FORUM outside page if the user isn't logged in the forums in the first place.

Please give me a sample code.

Thanks. I appreciate it

Top
#53379 - 07/24/02 12:59 AM Re: Log-in Sequence for Other Areas of a Site
CaCoffin Offline
Member

Registered: 12/02/00
Posts: 152
Loc: Las Vegas, NV
Now a question from one who can sometimes figure things out, most of the time cannot....

I was able to create a test page using just the Javascript to test for the cookie.

If I want to use this on external pages how do I fit those pages into the Javascript?

If I put the HTML below all the Javascript it shows up whether I am logged in or not.

(Psst... I know I am an idiot when it comes to this stuff but please humor a fool and teach him a new trick.)

Top
#53380 - 07/24/02 09:03 AM Re: Log-in Sequence for Other Areas of a Site
Paulus Magnus Offline
Content Kidman

Registered: 10/15/01
Posts: 80
Hmmm... I'm not convinced you can use Javascript to do this effectively as the user simply disables Javascript and they see your page anyhow.

The best way you could get around this is by putting your member pages in a subdirectory with an unguessable name and then use a public page with a Javascript redirect if the cookie is set correctly.

However, if you add Javascript to a page that tests for the cookie and then redirects if they're not logged in so as to "hide" the page content the user just disables Javascript and they see the page anyhow.

I'm a fan of PHP as it's server side and I can choose not to send the page contents with a few lines of PHP.

This is largely why I'll advocate using PHP for doing these things but I only see weaknesses with a Javascript solution.
_________________________
» Team Nicole | UBB v6.3.0 «

Top
#53381 - 07/24/02 09:37 AM Re: Log-in Sequence for Other Areas of a Site
CaCoffin Offline
Member

Registered: 12/02/00
Posts: 152
Loc: Las Vegas, NV
sooooooooooooooooooo

enlighten us on how this is done, please

Top
#53382 - 07/24/02 04:44 PM Re: Log-in Sequence for Other Areas of a Site
Paulus Magnus Offline
Content Kidman

Registered: 10/15/01
Posts: 80
Something like this, just change the code for your cookie number. Note the '.' in the cookie name is translated to a '_' with PHP.

If the cookie is present, it extracts a couple of values from it and then uses a large if/else construct around the HTML. It means that you can still use your HTML editing software to format all your HTML correctly and have the logged-in and not-logged-in parts on the same page. Just add this into the body of your HTML page and change the extension to PHP.

Code:
<?
if (isset($ubber2452191_1937)) {
  $ubbinfo = split("&",$ubber2452191_1937);
  $ubbdisplayname = $ubbinfo[2];
  $ubbmemberid = $ubbinfo[4];
?>
  

Hi <?=$ubbdisplayname?>, you're logged in, here's some HTML.
<?
} else {
?>
  

Sorry, you're not logged in.
<?
}
?>
_________________________
» Team Nicole | UBB v6.3.0 «

Top
Page 1 of 2 1 2 >


Moderator:  Gizmo 
Who's Online
1 registered (Deb), 28 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
How to hide sub forums from summary page
by Ruben Rocha
Today at 02:58 PM
Spell Check [beta]
by Bill B
Yesterday at 09:16 PM
PhotoPost BB Code Popup
by AllenAyres
Yesterday at 09:41 AM
Problems reading a lot of old posts here
by AllenAyres
Yesterday at 09:35 AM
Forum 'Trader Ratings'.
by AllenAyres
Yesterday at 09:33 AM
Customization needed
by Gizmo
11/12/08 12:28 PM
Team UBBDev Rides Again!
by AllenAyres
11/11/08 02:16 PM
New Mods
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Spell Check [beta]
by
10/17/06 09:24 PM
Newest Members
David DelMonte, nick1, Begbie, cenk, MATTO
13363 Registered Users
Top Posters
AllenAyres 25452
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks