Hello Expert,
I have one php script which has like a subscription system like 1 month, 2 months , 3 months, Quarterly and 1 year
The subscription system is Standard And Premium.
What I wanted to know Is I am using WORLDPAY FUTUREPAY . I have everything the WORLDPAY is working fine but the thing
is the subscribtion are 1month,2month,3months,Quar
terly & 1Year with Future pay we can charge our customer
who ever select either 1month,2month,3months,Quar
terly & 1Year Subscription.
So my question is How I am going to do that.
There are two main scripts which is register.php and other one is regster_pay.php
I will appreciate if you please kindly help me so that I can easily charge my customer with the help of
WORLDPAY FUTUREPAY.
Please look below for 2 Scripts register.php and register_pay.php
=-=-=-=-=-=-=-=-=--=-=-=-=
--=-=-=-=-
=--
=-=-=-=-=-=-=-=-=--=-=-=-=
--=-=-=-=-
=--
Register.php Statrs Here ------
<?php
include ("config_file.php");
$form_action_file="registe
r.php";
?>
<br>
<?
if ($HTTP_GET_VARS['login']==
"buyers") {
if ($buyers_register_button)
{
if(empty($HTTP_POST_VARS['
username']
) || strlen($HTTP_POST_VARS['us
ername'])<
ENTRY_USER
NAME_MIN_L
ENGTH )
{
$username_error="yes";
}
else
{
$username_error="no";
}
if(!empty($HTTP_POST_VARS[
'username'
]))
{
$username_query=mysql_quer
y("select * from buyers where username = '".$HTTP_POST_VARS['userna
me']."'");
$username_number=@mysql_nu
m_rows($us
ername_que
ry);
if ($username_number!=0)
{
$username_result=mysql_fet
ch_array($
username_q
uery);
if ($username_result['usernam
e']==$HTTP
_POST_VARS
['username
'])
{
$already_username_error="y
es";
}
else
{
$already_username_error="n
o";
}
}
else
{
$already_username_error="n
o";
}
}
if (empty($HTTP_POST_VARS['pa
ssword']) || (strlen($HTTP_POST_VARS['p
assword'])
<ENTRY_PAS
SWORD_MIN_
LENGTH) || (verify($HTTP_POST_VARS['p
assword'],
"string_in
t")==1))
{
$password_error="yes";
}
else
{
$password_error="no";
}
if (($HTTP_POST_VARS['passwor
d']!=$HTTP
_POST_VARS
['repasswo
rd']) || (strlen($HTTP_POST_VARS['r
epassword'
])<ENTRY_P
ASSWORD_MI
N_LENGTH) || (verify($HTTP_POST_VARS['r
epassword'
],"string_
int")==1))
{
$repassword_error="yes";
}
else
{
$repassword_error="no";
}
if (empty($HTTP_POST_VARS['em
ail']) || (strlen($HTTP_POST_VARS['e
mail'])<EN
TRY_EMAIL_
MIN_LENGTH
) || (!eregi("(@)(.*)",$HTTP_PO
ST_VARS['e
mail'],$re
gs)) || (!eregi("([.])(.*)",$HTTP_
POST_VARS[
'email'],$
regs)) || (verify($HTTP_POST_VARS['e
mail'],"st
ring_int_e
mail")==1)
)
{
$email_error="yes";
}
else
{
$email_error="no";
}
if (!empty($HTTP_POST_VARS['e
mail'])) {
$email_query=mysql_query("
select * from buyers where email like '".$HTTP_POST_VARS['email'
]."'");
$email_number=@mysql_num_r
ows($email
_query);
if ($email_number!=0)
{
$email_result=mysql_fetch_
array($ema
il_query);
if ($email_result['email']==$
HTTP_POST_
VARS['emai
l'])
{
$already_email_error="yes"
;
}
else
{
$already_email_error="no";
}
}
else
{
$already_email_error="no";
}
}
if(empty($HTTP_POST_VARS['
first_name
']))
{
$first_name_error="yes";
}
else
{
$first_name_error="no";
}
if(empty($HTTP_POST_VARS['
last_name'
]))
{
$last_name_error="yes";
}
else
{
$last_name_error="no";
}
if(empty($HTTP_POST_VARS['
address'])
)
{
$address_error="yes";
}
else
{
$address_error="no";
}
if(empty($HTTP_POST_VARS['
city']))
{
$city_error="yes";
}
else
{
$city_error="no";
}
if(empty($HTTP_POST_VARS['
zip_code']
))
{
$zip_code_error="yes";
}
else
{
$zip_code_error="no";
}
if(empty($HTTP_POST_VARS['
phone']))
{
$phone_error="yes";
}
else
{
$phone_error="no";
}
if ($username_error=="yes" || $already_username_error=="
yes" || $password_error=="yes" || $repassword_error=="yes" || $email_error=="yes" || $already_email_error=="yes
" || $first_name_error=="yes" || $last_name_error=="yes" || $address_error=="yes" || $city_error=="yes" || $zip_code_error=="yes" || $phone_error=="yes") {
include("forms/buyers_regi
ster_form.
php");
}
else {
$insert_buyer = bx_db_query("insert into $bx_db_table_buyers values('','".$HTTP_POST_VA
RS['userna
me']."','"
.$HTTP_POS
T_VARS['pa
ssword']."
','".$HTTP
_POST_VARS
['email'].
"','".$HTT
P_POST_VAR
S['first_n
ame']."','
".$HTTP_PO
ST_VARS['l
ast_name']
."','".$HT
TP_POST_VA
RS['addres
s']."','".
$HTTP_POST
_VARS['add
ress2']."'
,'".$HTTP_
POST_VARS[
'city']."'
,'".$HTTP_
POST_VARS[
'state']."
','".$HTTP
_POST_VARS
['zip_code
']."','".$
HTTP_POST_
VARS['phon
e']."','".
$HTTP_POST
_VARS['cou
ntry']."',
'".$HTTP_P
OST_VARS['
currency']
."','$date
_time', 'active')");
$user_id=mysql_insert_id()
;
bx_session_register("user_
id");
$user=$HTTP_POST_VARS['use
rname'];
bx_session_register("user"
);
$type="buyers";
bx_session_register("type"
);
?>
<br>
<table border="0" cellpadding="4" cellspacing="0" align="center">
<tr>
<td class="text1">
<b>Congratulations!</b><br
><br> You are now registered to buy services.<br>
<font class="bigtext"><?echo $user;?></font> , look at <b> What's next</b> to see how to get started.<br><br>
What's next:<br><br>
? Create your buyer <a href="profile.php" class="bigtext"> Profile</a><br>
? <a href="postjob.php" class="bigtext">Post a Project</a>
</td>
</tr>
</table>
<br>
<?
}
}
else {
include("forms/buyers_regi
ster_form.
php");
}
}
if ($HTTP_GET_VARS['login']==
"sellers")
{
if ($sellers_register_button)
{
if(empty($HTTP_POST_VARS['
username']
) || strlen($HTTP_POST_VARS['us
ername'])<
ENTRY_USER
NAME_MIN_L
ENGTH )
{
$username_error="yes";
}
else
{
$username_error="no";
}
if(!empty($HTTP_POST_VARS[
'username'
]))
{
$username_query=mysql_quer
y("select * from $bx_db_table_sellers where username = '".$HTTP_POST_VARS['userna
me']."'");
$username_number=@mysql_nu
m_rows($us
ername_que
ry);
if ($username_number!=0)
{
$username_result=mysql_fet
ch_array($
username_q
uery);
if ($username_result['usernam
e']==$HTTP
_POST_VARS
['username
'])
{
$already_username_error="y
es";
}
else
{
$already_username_error="n
o";
}
}
else
{
$already_username_error="n
o";
}
}
if (empty($HTTP_POST_VARS['pa
ssword']) || (strlen($HTTP_POST_VARS['p
assword'])
<ENTRY_PAS
SWORD_MIN_
LENGTH) || (verify($HTTP_POST_VARS['p
assword'],
"string_in
t")==1))
{
$password_error="yes";
}
else
{
$password_error="no";
}
if (($HTTP_POST_VARS['passwor
d']!=$HTTP
_POST_VARS
['repasswo
rd']) || (strlen($HTTP_POST_VARS['r
epassword'
])<ENTRY_P
ASSWORD_MI
N_LENGTH) || (verify($HTTP_POST_VARS['r
epassword'
],"string_
int")==1))
{
$repassword_error="yes";
}
else
{
$repassword_error="no";
}
if (empty($HTTP_POST_VARS['em
ail']) || (strlen($HTTP_POST_VARS['e
mail'])<EN
TRY_EMAIL_
MIN_LENGTH
) || (!eregi("(@)(.*)",$HTTP_PO
ST_VARS['e
mail'],$re
gs)) || (!eregi("([.])(.*)",$HTTP_
POST_VARS[
'email'],$
regs)) || (verify($HTTP_POST_VARS['e
mail'],"st
ring_int_e
mail")==1)
)
{
$email_error="yes";
}
else
{
$email_error="no";
}
if (!empty($HTTP_POST_VARS['e
mail'])) {
$email_query=mysql_query("
select * from $bx_db_table_sellers where email like '".$HTTP_POST_VARS['email'
]."'");
$email_number=@mysql_num_r
ows($email
_query);
if ($email_number!=0)
{
$email_result=mysql_fetch_
array($ema
il_query);
if ($email_result['email']==$
HTTP_POST_
VARS['emai
l'])
{
$already_email_error="yes"
;
}
else
{
$already_email_error="no";
}
}
else
{
$already_email_error="no";
}
}
if(empty($HTTP_POST_VARS['
first_name
']))
{
$first_name_error="yes";
}
else
{
$first_name_error="no";
}
if(empty($HTTP_POST_VARS['
last_name'
]))
{
$last_name_error="yes";
}
else
{
$last_name_error="no";
}
if(empty($HTTP_POST_VARS['
address'])
)
{
$address_error="yes";
}
else
{
$address_error="no";
}
if(empty($HTTP_POST_VARS['
city']))
{
$city_error="yes";
}
else
{
$city_error="no";
}
if(empty($HTTP_POST_VARS['
zip_code']
))
{
$zip_code_error="yes";
}
else
{
$zip_code_error="no";
}
if(empty($HTTP_POST_VARS['
phone']))
{
$phone_error="yes";
}
else
{
$phone_error="no";
}
/*
if($HTTP_POST_VARS['subcat
egory_id']
==0)
{
$subcategory_error="yes";
}
else
{
$subcategory_error="no";
}
*/
if ($username_error=="yes" || $already_username_error=="
yes" || $password_error=="yes" || $repassword_error=="yes" || $email_error=="yes" || $already_email_error=="yes
" || $first_name_error=="yes" || $last_name_error=="yes" || $address_error=="yes" || $city_error=="yes" || $zip_code_error=="yes" || $phone_error=="yes" || $subcategory_error=="yes")
{
include("forms/sellers_reg
ister_form
.php");
}
else {
/*$insert_buyer = bx_db_query("insert into $bx_db_table_sellers values('','".$HTTP_POST_VA
RS['userna
me']."','"
.$HTTP_POS
T_VARS['pa
ssword']."
','".$HTTP
_POST_VARS
['email'].
"','".$HTT
P_POST_VAR
S['first_n
ame']."','
".$HTTP_PO
ST_VARS['l
ast_name']
."','".$HT
TP_POST_VA
RS['addres
s']."','".
$HTTP_POST
_VARS['add
ress2']."'
,'".$HTTP_
POST_VARS[
'city']."'
,'".$HTTP_
POST_VARS[
'state']."
','".$HTTP
_POST_VARS
['zip_code
']."','".$
HTTP_POST_
VARS['phon
e']."','".
$HTTP_POST
_VARS['cou
ntry']."',
'$date_tim
e','$HTTP_
POST_VARS[
subcategor
y_id]', 'active')");
$user_id=mysql_insert_id()
;
bx_session_register("user_
id");
$user=$HTTP_POST_VARS['use
rname'];
bx_session_register("user"
);
$type="sellers";
bx_session_register("type"
);
*/
if ($HTTP_POST_VARS['option']
=="premium
")
{
/*$ins = bx_db_query("insert into $bx_db_table_sellers values('','".$HTTP_POST_VA
RS['userna
me']."','"
.$HTTP_POS
T_VARS['pa
ssword']."
','".$HTTP
_POST_VARS
['email'].
"','".$HTT
P_POST_VAR
S['first_n
ame']."','
".$HTTP_PO
ST_VARS['l
ast_name']
."','".$HT
TP_POST_VA
RS['addres
s']."','".
$HTTP_POST
_VARS['add
ress2']."'
,'".$HTTP_
POST_VARS[
'city']."'
,'".$HTTP_
POST_VARS[
'state']."
','".$HTTP
_POST_VARS
['zip_code
']."','".$
HTTP_POST_
VARS['phon
e']."','".
$HTTP_POST
_VARS['cou
ntry']."',
NOW(),'pre
mium','act
ive','no')
");
$insert_id=mysql_insert_id
();
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
*/
include(DIR_FORMS."/seller
s_register
_premium_f
orm.php");
}
elseif($HTTP_POST_VARS['op
tion']=="s
tandard")
{
include(DIR_FORMS."/seller
s_register
_standard_
form.php")
;
}
}
}
else
{
include("forms/sellers_reg
ister_form
.php");
}
}
if ($HTTP_POST_VARS['add_prem
ium_seller
_button'] && $HTTP_POST_VARS['q']=="1")
{
$M=0;
$N=0;
for ($i=1;$i<sizeof($HTTP_POST
_VARS['cat
egory_id']
)+1;$i++)
{
if ($HTTP_POST_VARS['category
_price'.$i
]!="none")
{
$N=$N+$i;
}
else
{
$M=$M+$i;
}
}
if ($N==1)
{
//verify if already exist this member
$sel = bx_db_query("select username, password, email from $bx_db_table_sellers where username='".$HTTP_POST_VAR
S['usernam
e']."' and password='".$HTTP_POST_VAR
S['passwor
d']."' and email='".$HTTP_POST_VARS['
email']."'
");
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
if(bx_db_num_rows($sel)==0
)
{
$ins = bx_db_query("insert into $bx_db_table_sellers values('','".$HTTP_POST_VA
RS['userna
me']."','"
.$HTTP_POS
T_VARS['pa
ssword']."
','".$HTTP
_POST_VARS
['email'].
"','".$HTT
P_POST_VAR
S['first_n
ame']."','
".$HTTP_PO
ST_VARS['l
ast_name']
."','".$HT
TP_POST_VA
RS['addres
s']."','".
$HTTP_POST
_VARS['add
ress2']."'
,'".$HTTP_
POST_VARS[
'city']."'
,'".$HTTP_
POST_VARS[
'state']."
','".$HTTP
_POST_VARS
['zip_code
']."','".$
HTTP_POST_
VARS['phon
e']."','".
$HTTP_POST
_VARS['cou
ntry']."',
NOW(),'pre
mium','act
ive','no')
");
$insert_id=mysql_insert_id
();
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
}
else
{
refresh(HTTP_SERVER);
exit();
}
}
$res=0;
for ($i=1;$i<=sizeof($HTTP_POS
T_VARS['ca
tegory_id'
]);$i++)
{
if ($HTTP_POST_VARS['category
_price'.$i
]!="none")
{
$sel = bx_db_query("select * from $bx_db_table_project_categ
ory where category_id='".$HTTP_POST_
VARS['cate
gory_id'][
$i-1]."'")
;
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
if(bx_db_num_rows($sel)!=0
)
{
$result=bx_db_fetch_array(
$sel);
if ($HTTP_POST_VARS['category
_price'.$i
]=="3")
{
$price=$result['annually_s
ubscribe_p
rice'];
}
elseif($HTTP_POST_VARS['ca
tegory_pri
ce'.$i]=="
2")
{
$price=$result['quarterly_
subscribe_
price'];
}
elseif($HTTP_POST_VARS['ca
tegory_pri
ce'.$i]=="
1")
{
$price=$result['monthly_su
bscribe_pr
ice'];
}
else{}
}
$ins_premium_seller = bx_db_query("insert into $bx_db_table_sellers_premi
um values('','".$insert_id."'
,'".$HTTP_
POST_VARS[
'category_
id'][$i-1]
."','".$HT
TP_POST_VA
RS['catego
ry_price'.
$i]."','$p
rice', NOW(),'')");
//echo("insert into $bx_db_table_sellers_premi
um values('','".$insert_id."'
,'".$HTTP_
POST_VARS[
'category_
id'][$i-1]
."','".$HT
TP_POST_VA
RS['catego
ry_price'.
$i]."','$p
rice', NOW(),'')");
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
$total+=$price;
}
}
$res=$total;
if ($res==0.00)
{
echo "<br><br><center><font color=\"".ERROR_TEXT_COLOR
."\" class=\"text1\">Please Select a Category!</font></center><
br><br>";
}
else
{
//$insert_id=mysql_insert_
id();
$user_id=$insert_id;
bx_session_register("user_
id");
$user=$HTTP_POST_VARS['use
rname'];
bx_session_register("user"
);
$type="sellers";
bx_session_register("type"
);
refresh(HTTP_SERVER."/regi
ster_pay.p
hp?seller=
premium");
}
}
if ($HTTP_POST_VARS['calculat
e_button']
)
{
for ($i=1;$i<sizeof($HTTP_POST
_VARS['cat
egory_id']
)+1;$i++)
{
if ($HTTP_POST_VARS['category
_price'.$i
]!="none")
{
$sel = bx_db_query("select * from $bx_db_table_project_categ
ory where category_id='".$HTTP_POST_
VARS['cate
gory_id'][
$i-1]."'")
;
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
if(bx_db_num_rows($sel)!=0
)
{
$result=bx_db_fetch_array(
$sel);
if ($HTTP_POST_VARS['category
_price'.$i
]=="3")
{
$price=$result['annually_s
ubscribe_p
rice'];
}
elseif($HTTP_POST_VARS['ca
tegory_pri
ce'.$i]=="
2")
{
$price=$result['quarterly_
subscribe_
price'];
}
elseif($HTTP_POST_VARS['ca
tegory_pri
ce'.$i]=="
1")
{
$price=$result['monthly_su
bscribe_pr
ice'];
}
else{}
}
$total+=$price;
}
}
//$total=$price;
include(DIR_FORMS."/seller
s_register
_premium_f
orm.php");
}
if ($HTTP_POST_VARS['add_stan
dard_selle
r_button']
)
{
if ($HTTP_POST_VARS['standard
_sub']=="1
")
{
$standard_price=number_for
mat($stand
ard_subscr
iption_pri
ce,2);
}
elseif ($HTTP_POST_VARS['standard
_sub']=="2
")
{
$standard_price=number_for
mat((($sta
ndard_subs
cription_p
rice*3)*$s
tandard_qu
arterly_su
bscription
_discount)
,2);
}
elseif ($HTTP_POST_VARS['standard
_sub']=="3
")
{
$standard_price=number_for
mat((($sta
ndard_subs
cription_p
rice*12)*$
standard_a
nnually_su
bscription
_discount)
,2);
}
$ins = bx_db_query("insert into $bx_db_table_sellers values('','".$HTTP_POST_VA
RS['userna
me']."','"
.$HTTP_POS
T_VARS['pa
ssword']."
','".$HTTP
_POST_VARS
['email'].
"','".$HTT
P_POST_VAR
S['first_n
ame']."','
".$HTTP_PO
ST_VARS['l
ast_name']
."','".$HT
TP_POST_VA
RS['addres
s']."','".
$HTTP_POST
_VARS['add
ress2']."'
,'".$HTTP_
POST_VARS[
'city']."'
,'".$HTTP_
POST_VARS[
'state']."
','".$HTTP
_POST_VARS
['zip_code
']."','".$
HTTP_POST_
VARS['phon
e']."','".
$HTTP_POST
_VARS['cou
ntry']."',
NOW(),'sta
ndard','ac
tive','no'
)");
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
//$insert_seller_id=mysql_
insert_id(
);
$user_id=mysql_insert_id()
;
bx_session_register("user_
id");
$user=$HTTP_POST_VARS['use
rname'];
bx_session_register("user"
);
$type="sellers";
bx_session_register("type"
);
$ins_standard_seller = bx_db_query("insert into $bx_db_table_sellers_stand
ard values('','$user_id','".$H
TTP_POST_V
ARS['stand
ard_sub'].
"','$stand
ard_price'
,NOW(),'')
");
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
refresh(HTTP_SERVER."/regi
ster_pay.p
hp?seller=
standard")
;
}
?>
<br>
<?
include (DIR_FORMS."footer.php");
?>
============== END
Register_Pay.php -------- Starts Here
<?
include("config_file.php")
;
?>
<br>
<table border="0" cellpadding="4" cellspacing="0" align="center">
<tr>
<td class="text1">
<b>Congratulations!</b><br
><br> You are now registered to sell services.<br>
<font class="bigtext"><?echo $user;?></font> , look at <b> What's next</b> to see how to get started.<br><br>
What's next:<br><br>
<!-- ? Create your seller <a href="profile.php" class="bigtext"> Profile</a><br> -->
<br>
</td>
</tr>
<tr><td class="text1">
<?
$SQL = "select * from $bx_db_table_paydetails";
$sel_details = bx_db_query($SQL);
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
$res_details = bx_db_fetch_array($sel_det
ails);
$pay_email = $res_details['pay_email'];
$company_name = $res_details['company_name
'];
$company_address = $res_details['company_addr
ess'];
if ($HTTP_GET_VARS['seller']=
="premium"
)
{
$table_name=$bx_db_table_s
ellers_pre
mium;
}
elseif ($HTTP_GET_VARS['seller']=
="standard
")
{
$table_name=$bx_db_table_s
ellers_sta
ndard;
}
$sel = bx_db_query("select sum(subscribe_price) as subscribe_price_sum from $table_name where seller_user_id='$user_id'"
);
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1
));
$sum_subscribe_price = bx_db_fetch_array($sel);
$sum = $sum_subscribe_price['subs
cribe_pric
e_sum'];
?>
First You must pay through Worldpay<b>US$ <?=$sum?></b> for your account validation
<br><br>
<FORM ACTION="
https://select.worldpay.com/wcc/purchase" METHOD="POST" NAME="wp">
<input type=hidden name=instId value="00000">
<input type=hidden name=amount value="<?=$sum?>">
<input type=hidden name=cartId value="000000">
<input type=hidden name=currency value="USD">
<input type=hidden name=desc value="Project Bidder <?=$user?>' subscription <?=$sum?> ">
<input type=hidden name=testMode value="100">
<INPUT TYPE="HIDDEN" NAME="futurePayType" VALUE="regular">
<INPUT TYPE="HIDDEN" NAME="option" VALUE="0">
<INPUT TYPE="HIDDEN" NAME="startDelayMult" VALUE="1">
<INPUT TYPE="HIDDEN" NAME="startDelayUnit" VALUE="4">
<INPUT TYPE="HIDDEN" NAME="noOfPayments" VALUE="0">
<INPUT TYPE="HIDDEN" NAME="intervalMult" VALUE="1">
<INPUT TYPE="HIDDEN" NAME="intervalUnit" VALUE="4">
<INPUT TYPE="HIDDEN" NAME="normalAmount" VALUE="<?=$sum?>">
<input type="hidden" name="return" value="<?=HTTP_SERVER?>/re
gister_ret
urn.php?id
=<?echo $user_id?>&sum=<?=$sum?>">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="item_name" value="'<?=$user?>' user subscription">
<input type="hidden" name="cancel_return" value="<?=HTTP_SERVER?>/ca
ncel.php">
For the payment click on the Worldpay logo:
<input type="image" src="images/worldpay.gif" name="submit" class="button" onClick="return confirm('You will be transferred to PayPal secure site to make payment! Do you want to proceed?');">
</form>
</td></tr>
</table>
<br>
<?
include(DIR_FORMS."footer.
php");
?>
=============== End
Start Free Trial