11
peterr
Re: Web Hosting module
  • 2004/8/10 5:04

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Hi,

Quote:

Bassman wrote:
Recent intensive practice :) I've converted a few scripts to modules. It's not hard, especially if there's no database access involved. If you want it to have a look at how it's put together, let me know & i'll put it up for download.


Yes thanks, that would be good. I'll look into why the 'form submit' won't work within a module, but will work as a 'block'. No doubt there are other modules that do a submit, possibly because the form is submitting itself, if you know what I mean, that it has problems within a module ??

Peter

12
Bassman
Re: Web Hosting module
  • 2004/8/10 5:11

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


Yeah, I noticed that the calculate button wouldn't work, i'm sure there's a simple reason for that.

You can download the zip from here . Have fun!

13
peterr
Re: Web Hosting module
  • 2004/8/10 5:14

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Quote:

Bassman wrote:
Yeah, I noticed that the calculate button wouldn't work, i'm sure there's a simple reason for that.


Yes, possibly the GET should be a POST and the form has no ID or name, I'll just compare how it is done to other modules that do a submit, I'm sure it's very minor.

Thanks for the link to the zip file (will d/load now) and for making the module. :)

Peter

14
Bassman
Re: Web Hosting module
  • 2004/8/11 1:20

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


peter,
I tried running the script in an i-frame, and it works fine that way. Let me know if you want info.

15
peterr
Re: Web Hosting module
  • 2004/8/11 3:41

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Hi,

Okay, thanks, if you can pass the info on, that will help.

Peter

16
ChadK
Re: Web Hosting module
  • 2004/8/11 19:02

  • ChadK

  • Quite a regular

  • Posts: 242

  • Since: 2004/7/9 1


I have modified that index.php page from the hosting module so it doesn't have all that color and crap.. I'm not quite done as you can see when you look at the code.

I'm trying to make it easier to deal with. Easier to add items to the boxes and such.

Quote:

<?
include ('../../mainfile.php');
include ('../../header.php');
extract($_POST);

if(!isset($dn))
{
// domain type
$d="n";
// payment frequency
$f="y";
// taxes quebec, taxes canada
$tax="no";
}

$frequency = "year";
if($f==="m") $frequency="month";
if($f==="y") $frequency="year";

$plan[0][1]=0;
$plan[0][0]="No Hosting - $".$plan[0][1];
$plan[1][1]=3;
$plan[1][0]="Basic 50MB 500MB - $".$plan[1][1];
$plan[2][1]=6;
$plan[2][0]="Standard 100MB 1000MB - $".$plan[2][1];
$plan[3][1]=10;
$plan[3][0]="Professional 200MB 5000MB - ".$plan[3][1];
if($planselect<0) $planselect=0;
$plancount=4;

$extraspace[0][1]=0;
$extraspace[0][0]="+0 MB - $".$extraspace[0][1];
$extraspace[1][1]=2;
$extraspace[1][0]="+100 MB - $".$extraspace[1][1];
$extraspace[2][1]=5;
$extraspace[2][0]="+500 MB - $".$extraspace[2][1];
$extraspace[3][1]=10;
$extraspace[3][0]="+1000 MB - $".$extraspace[3][1];
$extraspace[4][1]=20;
$extraspace[4][0]="+4000 MB - $".$extraspace[4][1];
if($spaceselect<0) $spaceselect=0;
$extraspacecount=5;

$extrabandwidth[0][1]=0;
$extrabandwidth[0][0]="+0GB - $".$extrabandwidth[0][1];
$extrabandwidth[1][1]=10;
$extrabandwidth[1][0]="+5GB - $".$extrabandwidth[1][1];
$extrabandwidth[2][1]=15;
$extrabandwidth[2][0]="+10GB - $".$extrabandwidth[2][1];
$extrabandwidth[3][1]=50;
$extrabandwidth[3][0]="+25GB - $".$extrabandwidth[3][1];
$bandwidthcount=4;

if($f==="y") {
$diskspace = ($extraspace[$spaceselect][1]*12);
$bandwidth = ($extrabandwidth[$bandwidthselect][1]*12);
$plancost = ($plan[$planselect][1]*12);
$monthlyfee=0;
if ($d==="m") {
$domain=0;
} else {
$domain =12;
}
} else {
$diskspace = $extraspace[$spaceselect][1];
$bandwidth = $extrabandwidth[$bandwidthselect][1];
$plancost = $plan[$planselect][1];
$monthlyfee=1;
if ($d==="m") {
$domain=0;
} else {
$domain = "1";
}
}

$setup=10;
$subtotal = $domain+$bandwidth+$diskspace+$plancost+$monthlyfee;



/*if($tax==="IA") {
$gst = $subtotal*0.06;
} else {
$gst = "0";
}*/


?>

<form name="hosting" id="hosting" method="post">

<table width="400px" border="0" cellspacing="0" cellpadding="0">
<!-- DOMAIN NAME -->
<tr><td colspan="2"><b>Domain Name</b></td></tr>
<tr>
<td colspan="2"><input type="text" size="40" name="dn" value="<?php echo $dn;?>">
<select name="tld">
<option <? if($tld===".com") { ?>selected<? } ?>>.com</option>
<option <? if($tld===".org") { ?>selected<? } ?>>.org</option>
<option <? if($tld===".net") { ?>selected<? } ?>>.net</option>
<option <? if($tld===".aviary.info") { ?>selected<? } ?>>.aviary.info</option>
<option <? if($tld===".ca") { ?>selected<? } ?>>.ca</option>
</select></td>
</tr>
<tr>
<td colspan="2"><input type="radio" name="d" value="n" <? if($d==="n") {?>checked<? } ?> ><font face="tahoma,arial" size="2">Purchase new domain - $12<br/>
<input type="radio" name="d" value="t" <? if($d==="t") {?>checked<? } ?> ><font face="tahoma,arial" size="2">Transfer my domain - $12<br/>
<input type="radio" name="d" value="m" <? if($d==="m") {?>checked<? } ?> ><font face="tahoma,arial" size="2">I will manage my own domain name - $0<br />
<input type="radio" name="d" value="m" <? if($d==="m") {?>checked<? } ?> ><font face="tahoma,arial" size="2">I want a subdomain (select .aviary.info above) - $0
</td>
</tr>

<tr><td colspan="2" height="10"></td></tr>

<?

//HOSTING PLANS
print "<tr><td><b>Hosting Plans</b></td>";
print "<td><select name=\"planselect\" style=\"width:225px\">\n";
for($i=0; $i < $plancount; $i++) {
print "<option value=".$i;
if($planselect==$i) print " selected ";
print ">".$plan[$i][0]."</option>";
}
print "</select></td></tr>\n";
//End Hosting Plans


//DISKSPACE
print "<tr><td><b>Additional Diskspace</b></td>";
print "<td><select name=\"spaceselect\" style=\"width:225px\">\n";
for($i=0; $i < $extraspacecount; $i++) {
print "<option value=".$i;
if($spaceselect==$i) print " selected ";
print ">".$extraspace[$i][0]."</option>";
}
print "</select></td></tr>\n";
//End DISKSPACE

//Bandwidth
print "<tr><td><b>Additional Bandwidth</b></td>";
print "<td><select name=\"bandwidthselect\" style=\"width:225px\">\n";
for($i=0; $i < $bandwidthcount; $i++) {
print "<option value=".$i;
if($bandwidthselect==$i) print " selected ";
print ">".$extrabandwidth[$i][0]."</option>";
}
print "</select></td></tr>\n";
//End Bandwidth



?>

<tr><td colspan="2" height="10"></td></tr>
<!-- PAYMENT FREQUENCY -->
<tr><td colspan="2"><b>Payment Frequency</b></td></tr>
<tr><td colspan="2"><input type="radio" name="f" value="y" <? if($f==="y") {?>checked<? } ?> ><font face="tahoma,arial" size="2">Annual Payments</td></tr>
<tr><td colspan="2"><input type="radio" name="f" value="m" <? if($f==="m") {?>checked<? } ?> >Pay Monthly +$1/month (administrative costs)</td></tr>

<?
/* <tr><td colspan="2" height="10"></td></tr>
<!-- TAXES -->
<tr><td colspan="2"><b>Taxes</b></td></tr>
<tr><td colspan="2"><input type="radio" name="tax" value="no" <? if($tax==="no") { ?>checked<? } ?> ><font face="tahoma,arial" size="2">I do NOT live in Iowa</td></tr>
<tr><td colspan="2"><input type="radio" name="tax" value="IA" <? if($tax==="IA") { ?>checked<? } ?> ><font face="tahoma,arial" size="2">Iowa Resident 6%</td></tr>
*/
?>

<tr><td colspan="2" height="10"></td></tr>
<!-- CALCULATE -->
<tr><td colspan="2"align="center"><b><? if(isset($dn)) { ?>Invoice Totals<? } else { ?><? } ?></b></td></tr>
<? if(isset($dn)) { ?>

<tr><td colspan="2" align="left"><b><i>One-time charges</i></b></td></tr>
<tr><td><font size="1" face="tahoma,arial">Setup:</td><td align="right"><font size="1" face="tahoma,arial">$10.00</td></tr>
<tr>
<td><b>Due Today</b></td>
<td align="right"><b><?= sprintf("$%01.2f",$setup) ?></b></td>
</tr>
<tr><td colspan="2" align="left"><b><i>Recurring Charges</i></b></td></tr>
<tr><td><font size="1" face="tahoma,arial">Domain Name: <?= $dn . $tld ?></td><td align="right"><font size="1" face="tahoma,arial"><?= sprintf("$%01.2f",$domain) ?></td></tr>
<tr><td><font size="1" face="tahoma,arial">Plan: <?= $plan[$planselect][0] ?></td><td align="right"><font size="1" face="tahoma,arial"><?= sprintf("$%01.2f",$plancost) ?></td></tr>
<tr><td><font size="1" face="tahoma,arial">Extra Diskspace: <?= $extraspace[$spaceselect][0] ?></td><td align="right"><font size="1" face="tahoma,arial"><?= sprintf("$%01.2f",$diskspace) ?></td></tr>
<tr><td><font size="1" face="tahoma,arial">Extra Bandwidth: <?= $extrabandwidth[$bandwidthselect][0] ?></td><td align="right"><font size="1" face="tahoma,arial"><?= sprintf("$%01.2f",$bandwidth) ?></td></tr>
<? if($f==="m") print "<tr><td><font size=\"1\" face=\"tahoma,arial\">Monthly Billing Fee</td><td align=\"right\"><font size=\"1\" face=\"tahoma,arial\">".sprintf("$%01.2f",$monthlyfee)."</td></tr>"; ?>
<? /* <tr><td><font size="1" face="tahoma,arial">Subtotal</td><td align="right"><font size="1" face="tahoma,arial"><?= sprintf("$%01.2f",$subtotal) ?></td></tr>
<tr><td><font size="1" face="tahoma,arial">IA State Sales Tax (6%)</td><td align="right"><font size="1" face="tahoma,arial"><?= sprintf("$%01.2f",$gst) ?></td></tr> */ ?>

<?php $total = sprintf("%01.2f",($subtotal+$gst));?>
<tr>
<td><b>Due each <?= $frequency ?></b></td>
<td align="right"><b>$<?= $total ?></b></td>
</tr>
<? } ?>
<tr><td colspan="2" align="center"><font size="1"></font> <input type="submit" Value="<? if(isset($dn)) { ?>Recalculate<? } else { ?>Calculate<? } ?>"></td></tr>

<tr><td colspan="2" height="10"></td></tr>
<? if(isset($dn)) { ?>
<!-- CHECKOUT -->
<tr>
<td colspan="2" align="center">
<? if($dn != "") {
$days="365";
$yahoof = "Y";
if($f==="m") {$days="30"; $yahoof="M";}
$company_id = "";
$companyname="Chad Kovac DBA IA Parrot";
$business_email = "chad@aviary.info";
/*
$paysystems = "https://secure.paysystems1.com/cgi-v310/payment/onlinesale-tpppro.asp?product1=" .
$plandesc."-".$dn.$tld."-".$d."-".$planselect."-".$dk."-".$b."-".$f . "&companyid=" . $company_id . "&total=" .
$total. "&repeatamount=" . $total .
"&formget=N&redirect=http://www.webhostingcanada.org/success.php" .
"&redirectfail=http://www.webhostingcanada.org/fail.php&reoccur=Y&cycle=" .
$days . "&totalperiod=100";
*/
$paypal = "https://www.paypal.com/subscriptions/business=" . $business_email . "&item_number=" .
$planselect.$d.$planselect.$spaceselect.$bandwidthselect.$f . "&item_name=Hosting%20".$dn.$tld."&no_note=0&cy_code=CAD" .
"&a1=" . $setup . "&p1=1&t1=D" .
"&a3=" . $total . "&p3=1&t3=" . $yahoof .
"&src=1&sra=1";
?>
<font size=+1><a href="<?= $paypal ?>" target=_blank><b>CLICK HERE to Checkout via PayPal</b></a></font><br>(Paypal to <?=$companyname?>)
<? } else { ?>
<font face="tahoma,arial" color="red">Please type in your <b>Domain Name</b> above, and then click on Recalculate.</font>
<? } ?>
</td>
</tr>
<? } ?>
</table>
</form>
<?
include XOOPS_ROOT_PATH.'/footer.php';

?>



I've also started rearranging the code so it makes more sense and I'm removing all of the <? ?> garbage all over the place so the server doesn't have to stop and start. I'm not sure if PHP is like ASP in this matter but in ASP every time you stop and start the script the server slows down... the more you do it, the slower it all goes.

I also modified this to have a "setup" fee.
I commented/removed tax calculations.
I added a business name.
Reformatted the form and layout.
Cleaned up a few misc bugs including the paypal link.


Keep in mind, I'm not a PHP programmer so be careful with this and give feedback if possible.



17
peterr
Re: Web Hosting module
  • 2004/8/12 1:00

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Hi,

Thanks Chad, I'll give that a try soon.

Peter

18
ChadK
Re: Web Hosting module
  • 2004/8/20 21:57

  • ChadK

  • Quite a regular

  • Posts: 242

  • Since: 2004/7/9 1


I'm rewriting it from scratch as a proper module with admin options and everything...

19
rsagerj
Re: Web Hosting module
  • 2004/8/22 19:41

  • rsagerj

  • Just popping in

  • Posts: 1

  • Since: 2004/8/22


Wow you guys read my mind... this is the exact module I was looking for...

I dont know how to make/edit a modules but if you need help testing it, let me know...

20
ChadK
Re: Web Hosting module
  • 2004/8/23 14:04

  • ChadK

  • Quite a regular

  • Posts: 242

  • Since: 2004/7/9 1


Sounds good.. nothing ready to test yet but keep watching:
http://dev.xoops.org/modules/xfmod/project/?xpay


Login

Who's Online

212 user(s) are online (136 user(s) are browsing Support Forums)


Members: 0


Guests: 212


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits