HTML5 and CSS3 Coding

Hi. I'm currently building a website using HTML5 and CSS3.

I need some coding help.

Before anyone enters my website, I would like to add a "read and comply with the following conditions before you continue" type agreement. Once the person "Agrees" to what he/she reads, they can continue and enter the website. If he/she doesn't agree to what he/she reads, by clicking on "exit here", he/she is redirected back to Google.com.

What's the best way of going about this?
Kenneth RogersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
You have two options

1. A landing page that shows only the Terms and Conditions
2. A Popup over the site that shows the T&C

Problem with 2 is that it can be bypassed very easily using normal browser tools.

A variation on 2 is to have a popup show over an image of the home page of the site - so that it looks like the site is there but it is just an image - when you accept the terms the page is redirected to the actual home page.

Depending on how stringent you want access to be i.e. do you want to deny access to anyone who has not accepted the terms - then you might want to look at putting a cookie on the users computer when they click Accept - so that future visits to the site do not result in the T&C window showing.

Without knowing more about what you want to do can't be more specific.
0
Marco GasiFreelancerCommented:
Rename your index.html to home.html and create a new index.html page where you put all your agreement terms and two buttons: Agree will bring the user to home.html Decline button will bring the user to google.com. It's really simple.

The problem is when a user has a direct link to one of the other pages: in this case, opening that link would allow him to avoid the agreement page. Now things become a bit more complex.
You should start a php session once the user has clicked agree button.

I can give you a basic example on how to do it. There are other and more sophisticated way to achieve the same result, but if your requirement is just what you said, something like the following should be enough :-)
First use php pages (or set apache to process php in html pages): index.php (the agreement page) and home.php (the real start page of the site.
In the index page place a form to hold Agree button:

index.php
<!-- agreement terms -->
<form action='home.php' method='post'>
   <input type='submit' name='submit' value='Agree' />
</form>

Open in new window


Then in home.php you have to check if the user agree with you and act accordingly

home.php
<?php
if (isset($_POST['submit']))
{
  //we start a php session
    session_start();
  //and put a new item in $_SESSION array: we'll use this to protect other pages
    $_SESSION['agree'] = true;
}
else
{
  //user didn't read agreement nor accepted it so we send him to the index.php
    header('Location: index.php');
}
?>
<!-- the rest of the page -->

Open in new window


In all other pages we just check if the $_SESSION array item agree exist: in fact if it exists we know yet it is true because no code set it to false. More precisely, we'll check the opposit options: if the $_SESSION['agree'] item doesn't exist we redirect the user to the index.php

any page:
<?php
session_start();
if (!isset($_SESSION['agree']))
{
    header('Location: index.php');
}
?>
<!-- The rest of the page here -->

Open in new window


Finally, just to be really meticulous, in index.php we can check if isset($_SESSION['agree']) and if yes we redirect the user to home.php

index.php
<?php
if (isset($_SESSION['agree']))
{
    header('Location: home.php');
}
?>
<!-- agreement terms -->
<form action='home.php' method='post'>
   <input type='submit' name='submit' value='Agree' />
</form>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kenneth RogersAuthor Commented:
@Marco Gasi - I'm really not too familiar with php. Would I need to start over and re-code everything in php? Or can I just, I guess merge html5 and css3 into php?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Kenneth RogersAuthor Commented:
When I look at a professional website online, and they have something that I'm trying to do, is there software that can tell me the exact coding, and what coding was done?

I'm using Chrome, something similar to view page source but something much better?
0
Marco GasiFreelancerCommented:
You can just set Apache to parse php code in html files. Add this line to your httpd.conf or within an .htaccess file placed in the root directory of your site:
AddType application/x-httpd-php .html

Open in new window

If you use IIS you can google a bit to find instructions to do the same.

But you can also just change the extension of your files from html to php.

What you really need is to have php installed in your server. Are you in your localhost? Have you installed Apache and php and mysql (xampp helps you to do it without problems)? I thought you had all this stuff but now I have some doubt :-)
0
Marco GasiFreelancerCommented:
With Chrome and developer tools you can get a lot of useful info. But you can't never see all hte code which is executed server-side: php and asp are server-side language and (fortunately) their code is never visible through a browser.

You can use the plain html to do what you want as I explained in the first part of my firt comment. But if you want a more sophisticated control over yourt pages, you need a server side language, php or asp.
0
Slick812Commented:
greetings Kenneth Rogers, ,  You seem to believe that there is some add-on component, or an easy to use code source to do what you need done, without you being much aware of how or what the code thing does it's work. You keep saying that your site is in "HTML5 and CSS3" and you do not seem to have any "SERVER SIDE" code working (like JAVA, CGI, ASP, PHP, RUBY), and without "SERVER SIDE" code to use, then what will be needed is a Browser Side Programming using Javascript. Because you need to do Selective "fail or pass" CODE TESTS, using the javsscript "IF Tests" to test if - "the person Agrees" by touching an ICON, which gets the javascript to do the code work initiated by the touch event on that  'AGREE ICON'.

You can look at the source code at a site that does this, BUT it will usually use a SERVER SIDE code working, which will NOT show in the HTML browser code lines.
Even if it does use SERVER SIDE code, then it will most likely also use Javascript browser code to Help get the web page to be better for the user to see (display) and do choices by touching the AGREE ICON  or the EXIT HERE ICON,

I have never seen a developer "Tool" (or other) that does what you seem to want - "is there software that can tell me the exact coding, and what coding was done" , , , so it may take a person with some experience to unravel the code work in a page and have an Idea of what code processes are used for the AGREEMEMT user choice? ?

Can you tell us what "terms" and "conditions" the user will be AGREE to for entrance to ur site, this is NOT for specific detailes, but to give us some IDEA of the security precautions needed, as in will it involve MONEY or payments or other info that might require security?
0
Kenneth RogersAuthor Commented:
@Slick812 - I'm using PHP.
0
Kenneth RogersAuthor Commented:
@Slick812 - Sure, I don't know if I'm violating and rules or agreement with Experts-Exchange If, but I'll explain, It's a pornographic site.

I'll give you guys an example, I did a quick Google search, but if you go Bangbros website, you can see that there is a following conditions message before you enter the website. If you don't agree you're redirected back to Google.com

It's to prevent minors from access to the website, and to notify other's before entering that the material may be offensive.
0
Slick812Commented:
On the page link you gave, there is NO security concerns whatsoever that I can see, there is a javascript function called on the touch of the "I Agree" statement, but the next page is the same web address as in the <a href="">, there is a cookie placed in the browser, so if I go back to the base site web addy, it will forward me (bypass the base web addy) to the SUB DOMAIN of -
   new.ban--------
which has the functioning pages.

Not sure if the "Agree" cookie is placed by the browser javascript or the Server Side code, but this does not seem to be difficult operations to achieve.

Marco Gasi in his comment  ID: 41039601  above, outlines a workable operation of code, why don't u try that?
0
Slick812Commented:
Had time to find my setup that I did ago, that has a php redirect -
     header('Location: index.php');
If there has not been a acceptance of whats on the index.php, , changed it to an an agreement thing as you seem to require, , This all depends on PHP setting and reading a COOKIE value -
     setcookie('hitcount', 'passed-in', time()+86400, '/');

the index.php page will be the landing page for the web site, and shows the agreement choice, it has this PHP at the top -

<?php
if(isset($_COOKIE['hitcount']) && $_COOKIE['hitcount'] == 'passed-in') {
  header('Location: start.php');
  exit;
}
?>

which tests for the cookie and if there is a valid cookie  isset($_COOKIE['hitcount'])   and value then no need to agree, and it redirects to the actual start of content on the start.php  page

the start.php page has this php at top -

<?php
if((!isset($_COOKIE['hitcount']))  || $_COOKIE['hitcount'] != 'passed-in') {
if(isset($_GET["agree"]) && $_GET["agree"] == 'yes'){
  setcookie('hitcount', 'passed-in', time()+86400, '/');
  } else {
  header('Location: index.php');
  exit;
  }
}
?>

this tests 4 cookie and then tests for the agree in the  $_GET["agree"], and sets a cookie if test success.

all other pages (second.php code here) should have this at the top -

<?php
if((!isset($_COOKIE['hitcount']))  || $_COOKIE['hitcount'] != 'passed-in') {
  header('Location: index.php');
  exit;
  }
?>

so if NO agreement (no cookie) it goes to the agreement page index.php

index.php code -
<?php
if(isset($_COOKIE['hitcount']) && $_COOKIE['hitcount'] == 'passed-in') {
  header('Location: start.php');
  exit;
}
?><!doctype html>
<html><head><title>Fun Code Site</title></head>
<body bgcolor="#e3f7ff">
<h2 style="text-align:center;"><span style="background: #600; color: #eef;">- If you Need FUN CODE -</span></h2>
<p style="font-size:120%; max-width: 760px;">
Only fun code is at this site!<br />
If you AGREE to seeing only Fun Code then Enter this SITE --> 
<a href="start.php?agree=yes" style="color:#fff;background:#0d0;">-Let Me In!-</a><br /><br />
No Way, don't need No Fun Code --> 
<a href="http://google.com" style="color:#11e;background:#d11;">^ Get Me Out Of Here ^</a>
</p>
</body></html>

Open in new window


start.php code -
<?php
if((!isset($_COOKIE['hitcount']))  || $_COOKIE['hitcount'] != 'passed-in') {
if(isset($_GET["agree"]) && $_GET["agree"] == 'yes'){
  setcookie('hitcount', 'passed-in', time()+86400, '/');
  } else {
  header('Location: index.php');
  exit;
  }
}
?><!doctype html>
<html><head><title>Start of the Fun Code</title></head>
<body bgcolor="#fff7e3">
<h2 style="text-align:center;"><span style="background: #600; color: #eef;">- All the Fun Code You'll Ever Need -</span></h2>
<p style="font-size:110%;">
<pre>
include slopy.javo:
iff(a.cvd !!== 'krap") hod-&lt;find{Mutton}:
radio{"low')= ;homer simpson;
#If FrenchVersion Then
  ' &lt;code thats Fun&gt;.
</pre>
</p>More stuff at <a href="second.php" style="color:#cd0; background:#0ac;">- Second Page -</a>

</body></html>

Open in new window


second page (and all other "content" pages cookie test) code -
<?php
if((!isset($_COOKIE['hitcount']))  || $_COOKIE['hitcount'] != 'passed-in') {
  header('Location: index.php');
  exit;
  }
?><!doctype html>
<html><head><title>Second of the Fun Code</title></head>
<body bgcolor="#fff7e3">
<h2 style="text-align:center;"><span style="background: #600; color: #eef;">- All the Fun Code You'll Ever Need page2-</span></h2>
<p style="font-size:110%;">
<pre>
include second.asx:
iff(a.cvd !!== 'krap") hod-&lt;find{Mutton}:
radio{"low')= ;homer simpson;
#If FrenchVersion Then
  ' &lt;code thats BAD&gt;.
</pre>
</p>
</body></html>

Open in new window


this is a basic way to get the page responses I guess you need, ask questions if you don't see the code uses in these
0
Kenneth RogersAuthor Commented:
Sorry for getting back to everyone late.

I'll play around with the code(s) you've provided and get back ASAP!
0
Kenneth RogersAuthor Commented:
Please give points to the following experts.
0
Slick812Commented:
EE is a info Exchange Place, maybe you can say what you found to to do the job you need done for clickin the "Agree" and clickin the "exit here", so that others that are EE searching for info, and see this page can know what to try.
0
provenzojohnCommented:
Sorry I was out of town. I'd have to get back, to actually try these codes.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.