Customizing SMF > SMF Coding Discussion
Need Help.
Devicon:
I currently have a downloads page, and in order to get there you must agree to a TOS. Well that worked out fine until i decided i would like users to be logged in, a solution would be the SMF SSI.php. A quick fix was to add a 3rd page, the first being the login page (requestdownload.php), after that if the user is logged in it will go two the second page (download.php) which checks if they have signed the TOS, and if so it directs them to the 3rd page. Now i have a nice setup where if a player tries to visit the third without accepting the TOS it takes them back to the 2d. The only problem is that someone could easily bypass the 1st page, and the solutions i found online required the use of a header. The problem is i already have headers used in the other two pages, and you cant have two. So what is my solution? Below ill post the code for the three pages.
1st Page:
--- Code: ---<?php
require('smf/SSI.php');
if ($context['user']['is_logged']) {
header( 'Location: http://www.deviconcreations.com/download.php' ) ;
}
else {
echo '<div class="page" style="border:thin inset; padding:6px; width:800px; position: relative; left: 20%; height:195px; overflow:auto;background-color:#dddddd;"">';
echo' <center> ';
ssi_login();
echo 'You Must First Login Or <A HREF="http://www.deviconcreations.com/smf/index.php?action=register">Register</A> To Access This Page!';
echo '</center>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Devicon Creations, Terms and Conditions</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
</style>
</head>
<body background="smf/background.jpg">
--- End code ---
2nd Page:
--- Code: ---<?php session_start(); //make sure this is the first thing in the file
$include=true;
require('current_agreement.php');
//page to redirect user if they agree
$redirect='downloads.php';
//check if they have agreed before
if(isset($_SESSION['agreement']) AND $_SESSION['agreement'] == $current_agreement)
{
header('location: ' . $redirect);
exit;
}
//if not, check if form is submitted
elseif(isset($_POST['submit']))
{
//if the user has agreed
if(isset($_POST['agreement']))
{
//set a cookie so we don't ask them again
//setcookie('agreement',$current_agreement,mktime(0, 0, 0, 12, 31, 2020));
//set a session variable so we don't ask them until next visit
$_SESSION['agreement']=$current_agreement;
//redirect
header('location: ' . $redirect);
exit;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Devicon Creations, Terms and Conditions</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
</style>
</head>
<body background="smf/background.jpg">
<div>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<div>
<?php
if(isset($_POST['submit']) AND !isset($_POST['agreement']))
{
//if they subbmited the form and did not agree
echo '<span style="color:red">You have not agreed to our rules:</span>';
}
else
{
if(isset($_GET['new']))
{
echo 'Our terms have changed:';
}
else
{
echo '';
}
}
?>
<tr>
<td>
<center>
<p><strong><FONT COLOR="FCFCFC">Program Terms Of Use</FONT></strong></p></center>
<div class="page" style="border:thin inset; padding:6px; width:800px; position: relative; left: 20%; height:195px; overflow:auto;background-color:#dddddd;"">
<!-- regular forum rules -->
<h3>
1. IMPORTANT INFORMATION
</h3>
<p>
You should carefully read the following Terms and Conditions. Your purchase or use of our products implies that you have read and accepted these Terms and Conditions.
</p>
<h3>
2. Use License
</h3>
<ol type="a">
<li>
Permission is granted to temporarily download one copy of the materials
(information or software) on Devicon Creations's web site for personal,
non-commercial transitory viewing only. This is the grant of a license,
not a transfer of title, and under this license you may not:
<ol type="i">
<li>modify or copy the materials;</li>
<li>use the materials for any commercial purpose, or for any public display (commercial or non-commercial);</li>
<li>attempt to decompile or reverse engineer any software contained on Devicon Creations's web site;</li>
<li>remove any copyright or other proprietary notations from the materials; or</li>
<li>transfer the materials to another person or "mirror" the materials on any other server.</li>
</ol>
</li>
<li>
This license shall automatically terminate if you violate any of these restrictions and may be terminated by Devicon Creations at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format.
</li>
</ol>
<h3>
3. Disclaimer
</h3>
<ol type="a">
<li>
The materials on Devicon Creations's web site are provided "as is". Devicon Creations makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, Devicon Creations does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its Internet web site or otherwise relating to such materials or on any sites linked to this site.
</li>
</ol>
<h3>
4. Limitations
</h3>
<p>
In no event shall Devicon Creations or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption,) arising out of the use or inability to use the materials on Devicon Creations's Internet site, even if Devicon Creations or a Devicon Creations authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you.
</p>
<h3>
5. Revisions and Errata
</h3>
<p>
The materials appearing on Devicon Creations's web site could include technical, typographical, or photographic errors. Devicon Creations does not warrant that any of the materials on its web site are accurate, complete, or current. Devicon Creations may make changes to the materials contained on its web site at any time without notice. Devicon Creations does not, however, make any commitment to update the materials.
</p>
<h3>
6. Links
</h3>
<p>
Devicon Creations has not reviewed all of the sites linked to its Internet web site and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by Devicon Creations of the site. Use of any such linked web site is at the user's own risk.
</p>
<h3>
7. Site Terms of Use Modifications
</h3>
<p>
Devicon Creations may revise these terms of use for its web site at any time without notice. By using this web site you are agreeing to be bound by the then current version of these Terms and Conditions of Use.
</p>
<h3>
8. Governing Law
</h3>
<p>
Any claim relating to Devicon Creations's web site shall be governed by the laws of the State of South Carilona without regard to its conflict of law provisions.
</p>
<p>
General Terms and Conditions applicable to Use of a Web Site.
</p>
<h2>
Privacy Policy
</h2>
<p>
Your privacy is very important to us. Accordingly, we have developed this Policy in order for you to understand how we collect, use, communicate and disclose and make use of personal information. The following outlines our privacy policy.
</p>
<ul>
<li>
Before or at the time of collecting personal information, we will identify the purposes for which information is being collected.
</li>
<li>
We will collect and use of personal information solely with the objective of fulfilling those purposes specified by us and for other compatible purposes, unless we obtain the consent of the individual concerned or as required by law.
</li>
<li>
We will only retain personal information as long as necessary for the fulfillment of those purposes.
</li>
<li>
We will collect personal information by lawful and fair means and, where appropriate, with the knowledge or consent of the individual concerned.
</li>
<li>
Personal data should be relevant to the purposes for which it is to be used, and, to the extent necessary for those purposes, should be accurate, complete, and up-to-date.
</li>
<li>
We will protect personal information by reasonable security safeguards against loss or theft, as well as unauthorized access, disclosure, copying, use or modification.
</li>
<li>
We will make readily available to customers information about our policies and practices relating to the management of personal information.
</li>
</ul>
<p>sad
We are committed to conducting our business in accordance with these principles in order to ensure that the confidentiality of personal information is protected and maintained.
</p>
</div>
</div>
<center>
<div><input type="checkbox" name="agreement" /><FONT COLOR="FCFCFC">I agree to the Terms and Conditions</FONT></div>
<div><input type="submit" name="submit" value="Proceed" /></div></center>
</form>
</div>
</body>
</html>
--- End code ---
And the final page
--- Code: ---<?php session_start();
$include=true;
require('current_agreement.php');
$redirect='download.php';
if(!isset($_SESSION['agreement']))
{
header('location: ' . $redirect);
exit;
}
elseif($_SESSION['agreement'] != $current_agreement)
{
header('location: ' . $redirect . '?new');
exit;
}
?>
<html>
<head>
<title>Downloads</title>
<body background="smf/background.jpg">
<center>
<h1><FONT COLOR="white">Devicon Creations's Software:</FONT></h1>
<TABLE BORDER=2 CELLSPACING=4 CELLPADDING=4 bordercolor="#112255">
<tr>
<td BGCOLOR="#666688"><center><h4>OpenFun Free Rpg Maker </h4></center></td>
<td BGCOLOR="#666688"><center><form><input type="button" value="Currently Unavailable" onClick="window.location.href='#'"></form></center></td>
</tr>
<tr>
<td BGCOLOR="#666688"><center><h4>EZScanner </h4></center></td>
<td BGCOLOR="#666688"><center>
<form><input type="button" value="Download Now" onClick="window.location.href='/downloads/EZScann.rar'"></form></center></td>
</tr>
<tr>
<td BGCOLOR="#666688"><center><h4><FONT COLOR="#dd4400">Mirage Fun</FONT></h4><h5>-Buggy-</h5></center></td>
<td BGCOLOR="#666688"><center>
<form><input type="button" value="Download Now" onClick="window.location.href='/downloads/Mirage.rar'"></form><h6>*Terms Of Service Not Applied*</h6></center></td>
</tr>
<tr>
<td BGCOLOR="#666688"><center><h4><FONT COLOR="#dd4400">OpenFun Visual Basic 6.0</FONT></h4><h5>-Buggy-</h5></center></td>
<td BGCOLOR="#666688"><center>
<form><input type="button" value="Download Now" onClick="window.location.href='/downloads/OpenFun.rar'"></form><h6>*Buggy & Unfinished.*</h6></center></td>
</tr>
</table>
<h3><font color="white"> History Downloads, TOS Not Applied.</FONT></h3>
<HR WIDTH="50%" SIZE="3" NOSHADE>
<TABLE BORDER=2 CELLSPACING=4 CELLPADDING=4 bordercolor="#112255">
<tr>
<td BGCOLOR="#666688"><center><h4>Spirea Beta - 1.1.0 </h4></center></td>
<td BGCOLOR="#666688"><center><form><input type="button" value="Download Now" onClick="window.location.href='/downloads/Spirea.rar'"></form></center></td>
</tr>
<tr>
<td BGCOLOR="#666688"><center><h4>Mirage Realms DE - 0.3</h4></center></td>
<td BGCOLOR="#666688"><center><form><input type="button" value="Download Now" onClick="window.location.href='/downloads/mr_de_v03.rar'"></form></center></td>
</tr>
</table>
<h3><A HREF="javascript:history.back()"><FONT COLOR="#6677ff">Return To The Previous Page</FONT></A></h3>
<h4><A HREF="http://www.deviconcreations.com"><FONT COLOR="#6677ff">Devicon Creations Homepage</FONT></A></h4>
<!-- Counter Code START --><a href="http://www.e-zeeinternet.com/" target="_blank"><img src="http://www.e-zeeinternet.com/count.php?page=842763&style=katt154&nbdigits=5&reloads=1" alt="Hit Counter" border="0" ></a><br><a href="http://www.e-zeeinternet.com/" title="Hit Counter" target="_blank" style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000; text-decoration: none;">Hit Counter</a><!-- Counter Code END --></center>
</body>
--- End code ---
Thanks in advance,
Devicon
Kindred:
why not do the islogged check again on the second page and if not, bounce the user back to the first page?
and why this:
header( 'Location: http://www.deviconcreations.com/download.php' ) ;
??
why are you loading download.php into the HEADER?
actually, why bother loading separate pages at all? Why not handle the conditionals in one file and then just use "include" or "require" for the content?
Devicon:
I need the header of the TOS.
You cannot have two headers.
Kindred:
you need what "header"?
Do you mean the code in the <head> tags? or do you mean a displayed header?
because you can have as many "headers" displayed as you want, but you are right, you can have only one <head> tag...
that being said, you are using php... you can use conditionals in the <head> just as you do in the <body>....
Devicon:
--- Quote from: Kindred on August 07, 2012, 04:38:25 PM ---you need what "header"?
Do you mean the code in the <head> tags? or do you mean a displayed header?
because you can have as many "headers" displayed as you want, but you are right, you can have only one <head> tag...
that being said, you are using php... you can use conditionals in the <head> just as you do in the <body>....
--- End quote ---
I'm really sorry for not coming on to what your saying. Is their a way i can combine all of these into one page, hiding the content until each action is done.
Log In > TOS > Downloads.
Navigation
[0] Message Index
[#] Next page
Go to full version