Jump to content

Recommended Posts

Really looking for some help as soon as possible as I'm going round the twist with this one.

 

I've been an online shop for a client and Google Adwords have stipulated that it needs to have an Age gate before entering the site. Obviously this will impact SEO so what I want to do is have some javascript that will hide all of the home page content and show the age verification form, then if the visitor clicks to say they're over 18, the home page content 'unhides' itself for the rest of that visit.. If they click they're not over 18, they're taken to a page to say they're not old enough to enter.

 

Can anyone PLEASE help me?

Link to comment
https://forums.phpfreaks.com/topic/244929-age-verification-script/
Share on other sites

Well then as it's for a *client*, and you will be paid for the work, I think you would be better posting this in the freelance section. Don't want to sound obnoxious here, but you have the theory in your head so it's a case of putting it into code. If you need help writing that code, then whoever helps you should rightly get part of your earnings.

Well then as it's for a *client*, and you will be paid for the work, I think you would be better posting this in the freelance section. Don't want to sound obnoxious here, but you have the theory in your head so it's a case of putting it into code. If you need help writing that code, then whoever helps you should rightly get part of your earnings.

Well techincally I'm not getting paid for it because I've been paid for developing the online shop. They've now thrown in this problem and I'm not getting paid anymore for it. Also I was asking if someone can point me in the direction of tutorials or something. Afterall, the point of this site is to help people is it not?

That's correct, PHPFreaks is here to teach. At the same time though, as I'm sure you can appreciate, I don't believe the aim is take away paid-jobs from hard-working developers. Just giving the solution away for free to someone who doesn't put in the time to learn it, ultimately makes them easy money off the community that should have gone to someone else. Anyway, it was just a misunderstanding. Your first post struck me as a specification more than anything else.

 

Back to your original question...

 

Personally I would avoid JavaScript as much as possible for this, as anyone with JS disabled would bypass the verification without knowing. You can detect if they have the cookie set on the PHP-side, and then display the overlay hiding the content if it's not. The overlay itself would be just simple HTML/CSS mark-up included at the end of the page, and would only be a 'gate' to anybody visually viewing the content - not search engines.

 

Also be aware of how cookies work, as when you set them they're not actually available until the next request. So when the user enters their age, assuming it's valid, you need to ensure that both the cookie isn't set and a valid age hasn't been posted, before displaying the overlay.

 

Aopart from that there's not really much I can suggest right now.

I'll point you in the correct direction, but I'm not doin' the work for ya when you're gettin' paid.

 

From the sounds of it, you want two options before the page shows it's contents.  To do this a bit of a 'nicer' way, you can have it, when click, load the contents of an external page into a div.

JQuery: click()

 

When they click, you wanna get the contents of the other page, and put them into the div.

JQuery: load()

 

If you wanted to throw me a few bucks, I'd happily write it for ya. :)

As I mentioned before, I would avoid JavaScript for this. That said, you can of course add some JavaScript richness to it, but you should first concentrate on ensuring it works without it. I'm not at all familiar with Google's verification policies, but using JS alone may invalidate it for reasons I mentioned before.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.