<?php
/*================================================================+\
|| # PHPRetro - An extendable virtual hotel site and management
|+==================================================================
|| # Copyright (C) 2009 Yifan Lu. All rights reserved.
|| # http://www.yifanlu.com
|| # Parts Copyright (C) 2009 Meth0d. All rights reserved.
|| # http://www.meth0d.org
|| # All images, scripts, and layouts
|| # Copyright (C) 2009 Sulake Ltd. All rights reserved.
|+==================================================================
|| # PHPRetro is provided "as is" and comes without
|| # warrenty of any kind. PHPRetro is free software!
|| # License: GNU Public License 3.0
|| # http://opensource.org/licenses/gpl-license.php
|+==================================================================
|| VIP page created by Grandlodge on Ragezone.
|| Automatic Daopay payments by Grandlodge on Ragezone.
|| Credits to ItzJay for the VIP page content (Couldnt be bothered to make my own)
\+================================================================*/

$page['allow_guests'] = true;
require_once('./includes/core.php');
require_once('./includes/session.php');

$page['id'] = "VIP";
$page['name'] = "Subscription Membership";
$page['bodyid'] = "home";
$page['cat'] = "community";
require_once('./templates/community_header.php');
?>
<style type="text/css">
<?php // Message CSS for displaying if the daopay payment was successfull or not. ?>
.success, .error, .info{
    max-width:80%;
    border: 1px solid;
    margin:10px auto auto ;
    padding:5px;
    text-align:center;
    }
    
.success {
    color: #4F8A10;
    background-color: #DFF2BF;
    }

.error {
    color: #D8000C;
    background-color: #FFBABA;
}
.info {
    color: #00529B;
    background-color: #BDE5F8;
    }
</style>


<div id="container">
    <div id="content" style="position: relative" class="clearfix">
        <div id="column1" class="column">
            <div class="habblet-container ">        
                <div class="cbb clearfix green ">
                    <h2 class="title"><span style="float: left;">Subcription Membership</span></h2>
                  
                    <?php
                    
                    if($user->user("rank") > 2) { // Displays a notification if the user is a VIP.
                        echo'<div class="info"><b>Your account is subscribed to VIP.</b></div>';
                    }
                    
                       // Automatic daopay VIP START
                      $appcode = APPCODEHERE; // Enter your app code given to you by Daopay
                      $prodcode = trim($_GET["prodcode"]);
                      $pin = trim($_GET["pin"]);
                      
                      if (strlen($prodcode) && strlen($pin)) {
                          $handle = fopen("http://daopay.com/svc/pincheck?appcode=".$appcode."&prodcode=".$prodcode."&pin=".$pin, "r");
                          if ($handle) {
                              $reply = fgets($handle);
                              if (substr($reply,0,2) == "ok") {
                                  // Pin successfull, add VIP to the user and print out a message!
$db->query("INSERT INTO ".PREFIX."alerts (userid,alert,type,time) VALUES ('".$user->id."','Thank you for purchasing VIP. The money you donated will go towards expensive running costs of the hotel.<br /> Thanks again,<br />".SHORTNAME." Management.','2','".time()."')");
                                   $db->query("UPDATE users set `rank` = '3' WHERE `id` = '$user->id'"); // Change the users rank to 3
                                   
                                   echo "<div class=\"success\"><b>Your payment has been successfull!</b><br />VIP has been added to your account!<br />Any issues or problems? Feel free to contact us!</div>";
                                   
                              }
                              else {
                                 // Pin is invalid or expired, print out an error message!
                                  echo "<div class=\"error\"><b>Pin Invalid/Expired</b><br/>The pin you are trying to use has either expired or is invalid, if you think this is wrong, please contact us!</div>";
                              }
                          }
                          else {
                              // Cannot connect to daopay! 
                              echo "<div class=\"error\">ERROR: Cannot connect to daopay.</div>";
                          }
                      }
                    // Automatic daopay VIP FINISH
                
                    ?>
                        <div class="pixels-infobox-container">
                            <center><ul> 
                <li><p><b>
</b><br>
<center><img src="http://habboemotion.com/resource/images/figures/Figure%20(90).png"/></center> <br>
<br>
<b>VIP Subscription offers:</b><br><br>
<center>&raquo <b>1.</b> Users will have the ability to use the <u>:rocket</u> command to pull out a rocket from their inventory.<br><br>
&raquo <b>2.</b> Users will have the ability to use the <u>:pull x</u> command to pull users to them.<br><br>
&raquo <b>3.</b> Users can train faster and have the ability to access the VIP gym.<br><br>
&raquo <b>4.</b> Taxi fees have been reduced to help users save credits.<br><br>
&raquo <b>5.</b> Users will be able to access through the <u>red one-way-gates</u> where other users can't go to.
<br><br>
&raquo <b>6.</b> Users will be able to get more clothing and access to the VIP clothing store.
</center>
<br><br>
<br>
<b>Purchase Methods</b><br><br>
Their is currently two methods of purchasing subscription membership. One is <b>Daopay</b> which membership is instantly added to your account when you purchase via daopay, and our second method is <b>paypal</b> which you will need to wait 24 hours before recieving your subscription purchase.<br><br /><br />




</p></li> </ul></center>
                        </div>
                </div>
            </div>
                <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
        </div>
        
        <div id="column2" class="column">

            <div class="habblet-container ">        
                <div class="cbb clearfix green ">
                    <h2 class="title"><span style="float: left;">Daopay</span></h2>
                        <div id="pixels-info" class="box-content pixels-info">
                            <div class="pixels-info-text clearfix">
                            <p><center><a href="LINKTOYOURDAOPAYBUTTONHERE"><IMG src="https://daopay.com/daopay/assets/images/ldaopaysms.jpg" /></a></center></p>
                            </div>
                        </div>
                </div>
            </div>
        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>



<script type="text/javascript">
HabboView.run();
</script>
<?php require_once('./templates/community_footer.php'); ?>