dcuellar Posted January 30, 2008 Share Posted January 30, 2008 I'd like to add an "Agree to terms" page before a visitor is allowed to view my store. Much like what you see before you register for a forum. Can I include that within the PHP? What steps must I take? Quote Link to comment https://forums.phpfreaks.com/topic/88618-can-it-be-done-in-the-php/ Share on other sites More sharing options...
aebstract Posted January 30, 2008 Share Posted January 30, 2008 When they check the box and hit continue, create a session for it. Then on each page of the store, check to see if that session is set, if it isn't you kick them back to a page saying that they need to agree to the terms first. Quote Link to comment https://forums.phpfreaks.com/topic/88618-can-it-be-done-in-the-php/#findComment-453743 Share on other sites More sharing options...
pocobueno1388 Posted January 30, 2008 Share Posted January 30, 2008 Yes you can. You need to create the HTML form, when submitted you need to make sure they checked the "agree" box, if they did then display the store and set session. Here is a little snippet to look at <?php if (isset($_POST['agree'])){ //they agreed to terms, show the store and register session } else { //They did NOT agree, give error } <form action="url.com" method="post"> <input type="radio" name="agree"> <input type="submit"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/88618-can-it-be-done-in-the-php/#findComment-453745 Share on other sites More sharing options...
dcuellar Posted January 30, 2008 Author Share Posted January 30, 2008 I'm really starting from scratch here, and to top it off I don't know much. this is what I have before the main script: <?php /********************************************************************************************* CartPlog Lite License ============================================================================================== This software is as-is, no warranty of any kind, use at your own risk. You are granted free use of this software. However, you are not permitted under any circumstances to redistribute the software, whether in whole or in part. Also, the 'powered by' links must remain intact and visible. Make sure to understand that this is *not GPL software. Do not redistribute it, and do not use parts of it in other software. This software is copyrighted in its entirety to 'calorie' a/k/a � ThinkDing LLC 2007, all rights reserved. The software author/entity are in no way responsible for your site content. All copyright notices and 'powered by' links must not be changed or removed. Do not use this software if obtained from a warez site! *********************************************************************************************/ // ####################### SET PHP ENVIRONMENT ############################ error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ######################## define('THIS_SCRIPT', 'cartplog'); define('CARTPLOG_VERSION', 'Lite v.1.0.0'); if ($_REQUEST['do'] == 'postback') { define('SKIP_SESSIONCREATE', 1); } // ################### PRE-CACHE TEMPLATES AND DATA ####################### if (empty($_REQUEST['do'])) { $_REQUEST['do'] = 'viewindex'; } $phrasegroups = array('cartplogfrontend'); $specialtemplates = array(); $globaltemplates = array(); $actiontemplates = array( 'checkout' => array( 'cartplog_basket_item', 'cartplog_view_cart' ), 'viewcart' => array( 'cartplog_basket_item', 'cartplog_view_cart' ), 'viewcategory' => array( 'cartplog_category_item', 'cartplog_view_category' ), 'viewhistory' => array( 'cartplog_history_item', 'cartplog_history_list', 'cartplog_view_history' ), 'viewindex' => array( 'cartplog_category_list', 'cartplog_basket_summary', 'cartplog_product_item', 'cartplog_view_index' ), 'viewitem' => array( 'cartplog_view_item' ) ); // ####################### REQUIRE VB BACK-END ############################ // cartplog in main forum directory require_once('./global.php'); // ###################### CHECK CARTPLOG ACCESS ########################### // #################### INITIALIZE SOME VARIABLES ######################### $cartplog = array(); // do not remove this !!! // do not hide, change, remove, etcetera !!! $cartplog['powered_by'] = '<br /><div class="smallfont" align="center"><a href="http://www.photoplog.com/">' . $vbphrase['cartplog_powered_by_cartplog'] . ' ' . CARTPLOG_VERSION . '</a></div>'; // do not hide, change, remove, etcetera !!! $footer = $cartplog['powered_by'] . $footer; $cartplog_currencies = array('AUD', 'CAD', 'EUR', 'GBP', 'USD'); $cartplog['currency_code'] = 'USD'; if (isset($cartplog_currencies[$vbulletin->options['cartplog_currency']])) { $cartplog['currency_code'] = $cartplog_currencies[$vbulletin->options['cartplog_currency']]; } // #################### INITIALIZE COOKIE SESSION ######################### if ($_REQUEST['do'] != 'postback') { $vbulletin->input->clean_array_gpc('c', array( COOKIE_PREFIX . 'cartplog' => TYPE_NOHTML )); $cartplog['cookie'] = $vbulletin->GPC[COOKIE_PREFIX . 'cartplog']; if ($cartplog['cookie']) { $cartplog_count_check = $db->query_first("SELECT COUNT(*) AS cnt FROM " . TABLE_PREFIX . "cartplog_sessions WHERE userid = " . intval($vbulletin->userinfo['userid']) . " AND sessionid = '" . $db->escape_string($cartplog['cookie']) . "' AND completed = 0 "); if ($cartplog_count_check['cnt'] != 1) { $cartplog['cookie'] = ''; vbsetcookie('cartplog', '', false); } } if (empty($cartplog['cookie'])) { $cartplog_hash = rand() . TIMENOW . uniqid(microtime(), true) . $vbulletin->userinfo['userid']; $cartplog['cookie'] = md5($cartplog_hash); $cartplog_flag = true; while ($cartplog_flag) { $cartplog_count_check = $db->query_first("SELECT COUNT(*) AS cnt FROM " . TABLE_PREFIX . "cartplog_sessions WHERE userid = " . intval($vbulletin->userinfo['userid']) . " AND sessionid = '" . $db->escape_string($cartplog['cookie']) . "' "); if ($cartplog_count_check['cnt']) { $cartplog_hash = rand() . TIMENOW . uniqid(microtime(), true) . $vbulletin->userinfo['userid']; $cartplog['cookie'] = md5($cartplog_hash); } else { $cartplog_flag = false; $db->query_write("INSERT INTO " . TABLE_PREFIX . "cartplog_sessions (sessionid, userid, completed, dateline, products) VALUES ( '" . $db->escape_string($cartplog['cookie']) . "', " . intval($vbulletin->userinfo['userid']) . ", 0, " . intval(TIMENOW) . ", 'a:0:{}' ) "); vbsetcookie('cartplog', $cartplog['cookie']); } } } } else if ($_REQUEST['do'] == 'postback') { $vbulletin->nozip = true; } That is my php for the store itself. I don't have a terms and agreement made yet, partly because I don't know how. I'm sorry, my forum was put together by a template and controlled within the adminCP. This is the furthest I've gone away from that. Any help? Quote Link to comment https://forums.phpfreaks.com/topic/88618-can-it-be-done-in-the-php/#findComment-453757 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.