Jump to content

Can it be done in the PHP?


dcuellar

Recommended Posts

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>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.