| 1 | <?
|
|---|
| 2 |
|
|---|
| 3 | /***************************************************************************
|
|---|
| 4 | * Dolphin Smart Community Builder
|
|---|
| 5 | * -----------------
|
|---|
| 6 | * begin : Mon Mar 23 2006
|
|---|
| 7 | * copyright : (C) 2006 BoonEx Group
|
|---|
| 8 | * website : http://www.boonex.com/
|
|---|
| 9 | * This file is part of Dolphin - Smart Community Builder
|
|---|
| 10 | *
|
|---|
| 11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
|---|
| 12 | * http://creativecommons.org/licenses/by/3.0/
|
|---|
| 13 | *
|
|---|
| 14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|---|
| 15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 16 | * See the Creative Commons Attribution 3.0 License for more details.
|
|---|
| 17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
|---|
| 18 | * see license.txt file; if not, write to marketing@boonex.com
|
|---|
| 19 | ***************************************************************************/
|
|---|
| 20 |
|
|---|
| 21 | require_once( 'inc/header.inc.php' );
|
|---|
| 22 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
|---|
| 23 | require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
|
|---|
| 24 |
|
|---|
| 25 | // --------------- page variables and login
|
|---|
| 26 |
|
|---|
| 27 | $_page['name_index'] = 50;
|
|---|
| 28 | $_page['css_name'] = 'getmem.css';
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | if ( !( $logged['admin'] = member_auth( 1, false ) ) )
|
|---|
| 32 | if ( !( $logged['member'] = member_auth( 0, false ) ) )
|
|---|
| 33 | if ( !( $logged['aff'] = member_auth( 2, false )) )
|
|---|
| 34 | $logged['moderator'] = member_auth( 3, false );
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | if ( !$logged['member'] )
|
|---|
| 38 | {
|
|---|
| 39 | $_page['header'] = _t("_GETMEM_H");
|
|---|
| 40 | $_page['header_text'] = _t("_GETMEM_H1");
|
|---|
| 41 | $_page['name_index'] = 0;
|
|---|
| 42 | $_page_cont[0]['page_main_code'] = _t( '_LOGIN_REQUIRED_AE1' );
|
|---|
| 43 | PageCode();
|
|---|
| 44 | exit();
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | $member['ID'] = (int)$_COOKIE['memberID'];
|
|---|
| 48 |
|
|---|
| 49 | $_page['header'] = _t("_GETMEM_H");
|
|---|
| 50 | $_page['header_text'] = _t("_GETMEM_H1");
|
|---|
| 51 |
|
|---|
| 52 | $affnum_arr = db_arr ( "SELECT `aff_num` FROM `Profiles` WHERE `ID` = '{$member['ID']}' LIMIT 1" );
|
|---|
| 53 | $levels_res = db_res ( "SELECT * FROM `members_as_aff` WHERE `num_of_mem` <= '{$affnum_arr['aff_num']}'" );
|
|---|
| 54 |
|
|---|
| 55 | // --------------- GET/POST actions
|
|---|
| 56 |
|
|---|
| 57 | if ( $_POST['upgrade'] == 'YES' )
|
|---|
| 58 | {
|
|---|
| 59 | $memtype_arr = split('-', $_POST['MemType']);
|
|---|
| 60 | $membershipID = (int)$memtype_arr[0];
|
|---|
| 61 | $membershipNumOfDays = (int)$memtype_arr[1];
|
|---|
| 62 | $arr = db_arr( "SELECT * FROM `members_as_aff` WHERE `MID` = '{$membershipID}' AND `num_of_days` = '{$membershipNumOfDays}' AND `num_of_mem` <= '{$affnum_arr['aff_num']}' LIMIT 1" );
|
|---|
| 63 |
|
|---|
| 64 | if ( $arr )
|
|---|
| 65 | {
|
|---|
| 66 | setMembership($member['ID'], $arr['MID'], $arr['num_of_days']);
|
|---|
| 67 | $membership_info = getMembershipInfo($arr['MID']);
|
|---|
| 68 |
|
|---|
| 69 | db_res( "UPDATE `Profiles` SET `aff_num` = `aff_num` - {$arr['num_of_mem']} WHERE `ID` = '{$member['ID']}'" );
|
|---|
| 70 | createUserDataFile( $member['ID'] ); |
|---|
| 71 |
|
|---|
| 72 | $upgrade_out = "
|
|---|
| 73 | <table align=center width=\"400\" class=\"text\">
|
|---|
| 74 | <tr>
|
|---|
| 75 | <td>
|
|---|
| 76 | ". _t ( "_Got_new_membership_part_1" ). $membership_info['Name']. _t ( "_Got_new_membership_part_2" ). $arr['num_of_days']. _t ( "_Got_new_membership_part_3" ) ."
|
|---|
| 77 | </td>
|
|---|
| 78 | </tr>
|
|---|
| 79 | </table>";
|
|---|
| 80 | }
|
|---|
| 81 | else
|
|---|
| 82 | {
|
|---|
| 83 | $upgrade_out = "";
|
|---|
| 84 | }
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | // --------------- page components
|
|---|
| 88 |
|
|---|
| 89 | $_ni = $_page['name_index'];
|
|---|
| 90 | $_page_cont[$_ni]['page_main_code'] = ($_POST['upgrade'] == 'YES' && strlen($upgrade_out)) ? $upgrade_out : PageCompPageMainCode();
|
|---|
| 91 |
|
|---|
| 92 | // --------------- [END] page components
|
|---|
| 93 |
|
|---|
| 94 | PageCode();
|
|---|
| 95 |
|
|---|
| 96 | // --------------- page components functions
|
|---|
| 97 |
|
|---|
| 98 | function PageCompPageMainCode()
|
|---|
| 99 | {
|
|---|
| 100 | global $affnum_arr;
|
|---|
| 101 | global $levels_res;
|
|---|
| 102 |
|
|---|
| 103 | ob_start();
|
|---|
| 104 |
|
|---|
| 105 | ?>
|
|---|
| 106 |
|
|---|
| 107 | <form action=<?= $_SERVER['PHP_SELF'] ?> method="post">
|
|---|
| 108 | <input type=hidden name=upgrade value=YES>
|
|---|
| 109 | <table class="text" width="400" align=center border="0" cellpadding="2" cellspacing="0">
|
|---|
| 110 | <?
|
|---|
| 111 | if ( mysql_num_rows( $levels_res ) > 0 )
|
|---|
| 112 | {
|
|---|
| 113 | echo "
|
|---|
| 114 | <tr>
|
|---|
| 115 | <td align=center colspan=2>
|
|---|
| 116 | ". _t ( "_Congratulation" ). "<br />" ._t ( "_Got_members_part_1" ). $affnum_arr[0] . _t ( "_Got_members_part_2" ) . _t ( "_Choose_membership" ) ."<br /><br />
|
|---|
| 117 | </td>
|
|---|
| 118 | </tr>";
|
|---|
| 119 | $i = 0;
|
|---|
| 120 | while ( $levels_arr = mysql_fetch_array( $levels_res ) )
|
|---|
| 121 | {
|
|---|
| 122 | $membership_info = getMembershipInfo($levels_arr['MID']);
|
|---|
| 123 | ?>
|
|---|
| 124 | <tr>
|
|---|
| 125 | <td align="right"><input type=radio name=MemType id="MemType<?= $levels_arr['MID'].'-'.$levels_arr['num_of_days'] ?>" value="<?= $levels_arr['MID'].'-'.$levels_arr['num_of_days'] ?>"></td>
|
|---|
| 126 | <td align="left" nowrap>
|
|---|
| 127 | <label for="MemType<?= $levels_arr['MID'].'-'.$levels_arr['num_of_days'] ?>">
|
|---|
| 128 | <font color=red><?= $membership_info['Name'] ?></font> ( <?= $levels_arr['num_of_days'] .' '. _t('_days') ?>, <?= _t('_requires_N_members', $levels_arr['num_of_mem']) ?> )
|
|---|
| 129 | </label>
|
|---|
| 130 | <br />
|
|---|
| 131 | </td>
|
|---|
| 132 | </tr>
|
|---|
| 133 | <?
|
|---|
| 134 | $i++;
|
|---|
| 135 | }
|
|---|
| 136 | ?>
|
|---|
| 137 | <tr>
|
|---|
| 138 | <td align=center colspan=2>
|
|---|
| 139 | <br />
|
|---|
| 140 | <input type="submit" name="submit" class="no" value=Apply>
|
|---|
| 141 | </td>
|
|---|
| 142 | </tr>
|
|---|
| 143 | <?
|
|---|
| 144 | }
|
|---|
| 145 | ?>
|
|---|
| 146 | </table>
|
|---|
| 147 | </form>
|
|---|
| 148 | <?
|
|---|
| 149 | $ret = ob_get_contents();
|
|---|
| 150 | ob_end_clean();
|
|---|
| 151 |
|
|---|
| 152 | return $ret;
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | ?> |
|---|