Terms of Service (cannot be by-passed)
I've created a basic terms of service system for rs-private servers. This script forces people to agree to terms of service on any website you "require" (will be explained later) the check file.
---
Features:
Design changing in configuration including border colors, text color, backgrounds, etc
TOS Updater - Change $UpdateVersion to force users to re-agree to the terms if you
change them
User-Friendly frontend and backend
---
Preview with default settings:
To use this, do the following:
1)
Create a file called tos.php in your web directory and put this code in it:
Code:
<?php
//!!!!!!! Make sure to modify tosconfig.php !!!!!!!!
$from=1;
require("tosconfig.php");
if($I_HAVE_MODIFIED_TOS_CONFIG == false) {
die("You MUST modify the tosconfig.php file first. Change \"\$I_HAVE_MODIFIED_TOS_CONFIG = false\" to \"\$I_HAVE_MODIFIED_TOS_CONFIG = true\"");
}
if(isset($_COOKIE['tos']))
$tos = $_COOKIE['tos'];
if(isset($_POST['dg'])) {
header("Location: {$redirectDeclined}");
die;
}
if(isset($_POST['ag'])) {
setcookie("tos", $UpdateVersion);
$tos = $UpdateVersion;
}
if(isset($_GET['resetTOSCookie']) || $tos != $UpdateVersion) {
setCookie("tos", null, time() - 3600);
$tos = null;
}
if($tos == null || $tos != $UpdateVersion) {
echo "<center>";
echo "<title>{$page['title']}</title>";
echo "<body style='background-color:{$style['background']};'>";
echo "<div style=\"text-align:center;background-color:{$style['background-tos']};border-color:{$style['border']};border-width:{$style['border_style']};border-style:solid;color:{$style['color']};width:50%;height:100%;\">";
echo "<h1>{$page['title']}</h1>";
?>
<center>
<h2>Terms of Service</h2>
<div style="margin-left:20px;margin-right:20px;">
By continuing you agree to all of the following statements:<br />
<br />
<li style="margin-left:20px;text-align:left;">You are not an employee, lawyer or contractor of Jagex Ltd, RuneScape, FunOrb, MechScape, Stellar Dawn, War of Legends or Adlex Solicitors, and are not a family member or acquaintance of the aforementioned.<br /><br /></li>
<li style="margin-left:20px;text-align:left;">All of the information on this site is solely for learning purposes, as the main purpose of this site is to instruct people in the art of programming.<br /><br /></li>
<li style="margin-left:20px;text-align:left;">All programs provided for download from this site are entirely programmed by the members of this community and are not the intellectual property of any business or organization.<br /><br /></li>
<li style="margin-left:20px;text-align:left;">No profit is made from this website: all proceeds go directly into server costs.<br /><br /></li>
<li style="margin-left:20px;text-align:left;">The authors of this website are in no way responsible legally for its contents, or the content that users post on it.<br /><br /></li>
<li style="margin-left:20px;text-align:left;">Nothing is sold (i.e. ownership transferred) on this website. Only the service of updating our database is provided.<br /><br /></li>
<li style="margin-left:20px;text-align:left;">All of the above terms involve anything under this domain of <?php echo $mysite; ?>.<br /><br /></li>
<br />
In no event shall the authors of this website nor the company hosting it be liable for any claim, damages, or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.<br />
<br />
If you understand and accept the terms of service, please click 'I Agree' below. If you do not understand, or do not accept, click 'I Disagree' and you will be redirected away from this site. Please note, this is a binding contract under law. If you breach this contract, it will be legally disputed.<br />
<br /><br />
<form action="" method="post" name="agree">
<input type="submit" name="dg" value=" I Disagree " />
<input type="submit" name="ag" value=" I Agree " />
</form>
<br /><br />
If you do not agree to the statements above and click 'I Agree', this means you are accessing the website without authorization. This is an offence under the Computer Misuse Act 1990 and is punishable by law in the USA with a fine and up to 6 months in prison. This also applies in all other countries where similar laws exist.
<br />
</div>
</div>
</center>
<?php
} else {
echo "<br />";
if($advanced == 1) {
echo "Term Version: {$UpdateVersion} - Your Version: {$tos}<br />
Cookie Reading: {$_COOKIE['tos']}<br />";
die;
}
//Uses JavaScript as redirect
echo "Redirecting.. You must have Javascript enabled.";
die("<script>window.location='{$redirectSuccess}'</script>");
}
?>
<!-- Created by Cameron (OneHitHS Rune-server) !-->
2) Create another file in the SAME DIRECTORY called tosconfig.php and put this code in it
Code:
<?php
if($from != 1) {
die("You cannot access this page directly.");
}
$I_HAVE_MODIFIED_TOS_CONFIG = false;
// Redirects
$redirectSuccess = "http://myserverwebsite.com/webclient"; //Redirect to this location if the agreement is accepted or if it has already been accepted.
$redirectDeclined = "http://google.com/"; //If they do not agree to the terms, redirect them here instead.
$tos_php_file = "http://mywebsite.com/tos.php";
//General
$UpdateVersion = 1; //If you want players to re-agree to the terms (for instance: If you modify them), add to int (ie: 1 to 2)
$advanced = 0; //For testing purposes only. This shows advanced settings when the agreement is accepted or if the cookie is detected.
$mysite = "yourserverwebsite.com"; //NO WWW. NO HTTP://
//CSS Settings
$style['background-tos'] = "#1B1B1B";
$style['background'] = "black";
$style['border'] = "white";
$style['border_style'] = "thin";
$style['color'] = "white";
//Page Settings
$page['server'] = "My Server"; // Your Server Name
$page['title'] = "{$page['server']} - Terms of Service";
?>
Modify those settings to your liking. Change the
$I_HAVE_MODIFIED_TOS_CONFIG = false;
to
$I_HAVE_MODIFIED_TOS_CONFIG = true;
to make the script usable.
3) Create the last file called "check.php" in the SAME DIRECTORY and put this code in it
Code:
<?php
$from=1;
include("tosconfig.php");
if(!isset($_COOKIE['tos'])) {
header("Location: {$tos_php_file}");
die;
}
if($_COOKIE['tos'] != $UpdateVersion) {
header("Location: {$tos_php_file}");
die;
}
?>
And that's it. Your terms of service file can be accessed from [Only registered and activated users can see links. Click Here To Register...]
To require users to agree to the terms of service on one of your pages, open the PHP page (example: in smf it would be index.php) and put this near the top:
Code:
require("http://yourwebsite.com/path/to/check.php");
Should be easy to get from there. Questions, respond.
PS: Yes the script is basic, but it works and the code is easy to read/modify to your liking.