User Tools

Site Tools


portals:upgrade-page

Upgrade.php

The following needs to be on top of the page (before the html tag). The first one is responsible for the hsmx functions, the second one will execute the upgrade.

<?php
    require_once($_SERVER['DOCUMENT_ROOT']."/hsm/include/initialize.php");      
    require($_SERVER['DOCUMENT_ROOT']."/hsm/upgrade_execute.php");                 
?>
   <form name="loginForm" action="upgrade.php" method="post"> 
      <label class='inputLabel'>Username: <b><?=$_SESSION['PORTAL']['upgrade_user']?></b></label>
      <label class='inputLabel'>Current billing plan: <b><?=$current_plan->name?></b></label>
      <label class='inputLabel'>Time left: <b><?=calculateTimeUser_3(active_time_left($_SESSION['PORTAL']['upgrade_user']))?></b></label>
      <?php 
      if($_SESSION['upgrade']!="successful")  
      {
      ?>                    
      <select name="plan" id="upgradePlans">
         <?php
            $plan=hsm_fetch_object($plans); 
            echo '<option value="'.$plan->id.'">'.$plan->name.': '.$plan->price. ' EUR</option>';  
            while($plan = hsm_fetch_object($plans))
            {		
               echo '<option value="'.$plan->id.'" label="'.$plan->name.'" '.($plan->id==$currentplan->id?'selected="selected"':'').'>'.$plan->name.': '.$plan->price.' EUR</option>';       		
            }
         ?>     
      </select>
      <input id="upgrade_button" name="buy_plan" type="submit" value="Upgrade">
      <?
      }
      else{
         echo"<p>Your account has been updated</p>";
      }
      ?>                   
   </form>

This code is more or less the same as in plan.php. It's possible to show additional user information (name, current billing plan and the time left of the current plan). This is however not required. if($_SESSION['upgrade']!=“successful”) Will check that the user already did an upgrade in his current session. We are going to show him a message when this is the case. Otherwise will he be able to buy an upgrade billing plan.

portals/upgrade-page.txt · Last modified: 2015/03/18 15:46 by maarten