Click to See Complete Forum and Search --> : pop-up user agreement


lmpb17
January 18th, 2009, 03:08 PM
I have a page on my site which shows an instructional video. When the page loads I would like it to have a pop-up (something like lightbox or greybox) where the user has to agree to the terms before the window closes and they can use my site. I have also seen this being referred to as content protection but havent been able to find much information. I cannot get greybox or lightbox to work and am wondering if theres a better solution for this, hopefully more friendly to all browsers

PeejAvery
January 18th, 2009, 07:24 PM
This solution is a combination of server-side and client-side scripts. The client must send information to the server to know whether or not the user has clicked the "agree" button. But, then the server will have to store that information relative to the user in either a database or a cookie.

lmpb17
January 19th, 2009, 01:36 PM
Oh I know that part, I guess I should have made this more clear. I just want to know how to actually make that "pop-up" on the screen which is the lightbox effect. I want to have the background grayed out and a small window show up .

Heres an example:
http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm

I just havent been able to get their code to work so Im seeing if theres an easier way to do it myself, without all the extra effects

PeejAvery
January 19th, 2009, 02:46 PM
All you need is a <div> set to position absolute. Then, set the zIndex high. It will cover all other elements.

lmpb17
January 19th, 2009, 05:20 PM
I actually found some css code that does exactly what you said and i have it working but now i hav run into another problem. The way I decided to track the user's action is by ip.
I have the following setup:
1. user comes to site
2. php script checks their ip and compares to sql database.
3. - if user is not in database, show them lightbox.
- else let them use the page as normal

The problem i have is how would i actually load the lightbox from the php script?

PeejAvery
January 19th, 2009, 10:47 PM
The way I decided to track the user's action is by ip.
Remember that IP addresses are NATed. You won't be getting the actual user's IP address, but the IP address of the ISP. You really should be using registered users or cookies.

The problem i have is how would i actually load the lightbox from the php script?
PHP always outputs to the client. Simply output the lightbox code.

<?php if ($agree) { ?>
<div id="overlay"></div>
<div id="lightbox"></div>
<?php } ?>

lmpb17
January 20th, 2009, 07:44 AM
Wow its that easy? I thought I would have to implement some kind of html parser :)

Im not experienced with network programming so Im not really sure how NAT works, but from the quick research I did it appears that something like $_SERVER['REMOTE_ADDR']; is useless because people on DSL lines constantly get different ips?

PeejAvery
January 20th, 2009, 08:33 AM
NATing means that the routers through which people connect to the internet do not forward their actual IPs. First, it would be impossible since there are more connections to the internet than their are IPv4 addresses. Second, it would be a huge security issue.