| 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 | if (getParam("enable_aff") != 'on')
|
|---|
| 28 | {
|
|---|
| 29 | $sCode = MsgBox( _t( '_affiliate_system_was_disabled' ) );
|
|---|
| 30 | $_page['name_index'] = 0;
|
|---|
| 31 | $_page_cont[0]['page_main_code'] = $sCode;
|
|---|
| 32 | PageCode();
|
|---|
| 33 | exit();
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | $_page['name_index'] = 30;
|
|---|
| 37 | $_page['css_name'] = 'join_aff.css';
|
|---|
| 38 |
|
|---|
| 39 | $logged['member'] = member_auth(0, false);
|
|---|
| 40 |
|
|---|
| 41 | $_page['header'] = _t( "_JOIN_AFF_H" );
|
|---|
| 42 | $_page['header_text'] = _t( "_JOIN_AFF_H" );
|
|---|
| 43 |
|
|---|
| 44 | // --------------- page components
|
|---|
| 45 |
|
|---|
| 46 | $_ni = $_page['name_index'];
|
|---|
| 47 | $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
|
|---|
| 48 |
|
|---|
| 49 | // --------------- [END] page components
|
|---|
| 50 |
|
|---|
| 51 | PageCode();
|
|---|
| 52 |
|
|---|
| 53 | // --------------- page components functions
|
|---|
| 54 |
|
|---|
| 55 | /**
|
|---|
| 56 | * page code function
|
|---|
| 57 | */
|
|---|
| 58 | function PageCompPageMainCode()
|
|---|
| 59 | {
|
|---|
| 60 |
|
|---|
| 61 | global $site;
|
|---|
| 62 |
|
|---|
| 63 | ob_start();
|
|---|
| 64 |
|
|---|
| 65 | $min_nick = 2;
|
|---|
| 66 | $max_nick = 10;
|
|---|
| 67 | $min_passwd = 4;
|
|---|
| 68 | $max_passwd = 8;
|
|---|
| 69 |
|
|---|
| 70 | $page = $_POST[page];
|
|---|
| 71 |
|
|---|
| 72 | $Name = $_POST[Name];
|
|---|
| 73 | $Email = $_POST[Email];
|
|---|
| 74 | $Email2 = $_POST[Email2];
|
|---|
| 75 | $Pwd1 = $_POST[Password1];
|
|---|
| 76 | $Pwd2 = $_POST[Password2];
|
|---|
| 77 |
|
|---|
| 78 | switch ( $page )
|
|---|
| 79 | {
|
|---|
| 80 | case 2:
|
|---|
| 81 | if (!isset($_POST['securityImageValue']) || !isset($_COOKIE['strSec']) || md5($_POST['securityImageValue']) != $_COOKIE['strSec'])
|
|---|
| 82 | {
|
|---|
| 83 | $add_on .= report_err ( _t("_SIMG_ERR") );
|
|---|
| 84 | $page = 1;
|
|---|
| 85 |
|
|---|
| 86 | }
|
|---|
| 87 | if ( strlen($Name) > 10 || strlen($Name) < 2 )
|
|---|
| 88 | {
|
|---|
| 89 | $add_on .= report_err( _t("_NICK_LEAST2", $min_nick, $max_nick) );
|
|---|
| 90 | $page = 1;
|
|---|
| 91 | }
|
|---|
| 92 | if ( !strcmp($Email,$Email2) && (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$", $Email) || db_arr("SELECT ID FROM aff WHERE UPPER(email) = UPPER('$Email')")) )
|
|---|
| 93 | {
|
|---|
| 94 | $add_on .= report_err( _t("_EMAIL_INVALID_AFF") );
|
|---|
| 95 | $page = 1;
|
|---|
| 96 | }
|
|---|
| 97 | if ( !(strlen($Pwd1) >= 4 && strlen($Pwd1) <= 10 && !strcmp($Pwd1,$Pwd2)) )
|
|---|
| 98 | {
|
|---|
| 99 | $add_on .= report_err( _t("_PWD_INVALID2", $min_passwd, $max_passwd) );
|
|---|
| 100 | $page = 1;
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 | break;
|
|---|
| 105 |
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | switch( $page )
|
|---|
| 109 | {
|
|---|
| 110 | case 2:
|
|---|
| 111 | $page_text = _t( "_JOIN_AFF2", $site['url_aff'], $site['title'] );
|
|---|
| 112 | break;
|
|---|
| 113 |
|
|---|
| 114 | default:
|
|---|
| 115 | $page_text = _t( "_JOIN1_AFF" ).$add_on;
|
|---|
| 116 | break;
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | switch ( $page )
|
|---|
| 120 | {
|
|---|
| 121 | case 2:
|
|---|
| 122 | // new profile creation
|
|---|
| 123 |
|
|---|
| 124 | $cl_values = "INSERT INTO aff SET ";
|
|---|
| 125 |
|
|---|
| 126 | $seed = rand();
|
|---|
| 127 | $cl_values .= " `seed` = ".$seed;
|
|---|
| 128 | $cl_values .= ", `RegDate` = NOW()";
|
|---|
| 129 | $cl_values .= ", `Percent` = 10 ";
|
|---|
| 130 | $cl_values .= ", `Status` = 'active' ";
|
|---|
| 131 |
|
|---|
| 132 | $cl_values .= ", `Name` = '$Name' ";
|
|---|
| 133 | $cl_values .= ", `email` = '$Email' ";
|
|---|
| 134 | $cl_values .= ", `Password` = '" . md5( $Pwd1 ) . "' ";
|
|---|
| 135 |
|
|---|
| 136 | $create_result = db_res( $cl_values );
|
|---|
| 137 |
|
|---|
| 138 | if ($create_result)
|
|---|
| 139 | {
|
|---|
| 140 | $arr = db_arr("SELECT ID FROM aff WHERE `seed` = $seed");
|
|---|
| 141 | if ( $arr )
|
|---|
| 142 | db_res("UPDATE aff SET `seed` = 0 WHERE ID = $arr[ID]");
|
|---|
| 143 | $ID_New_Aff = $arr[ID];
|
|---|
| 144 | }
|
|---|
| 145 |
|
|---|
| 146 | echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
|
|---|
| 147 | echo "<div align=justify>$page_text</div>";
|
|---|
| 148 | echo "<div align=justify>"._t("_JOIN_AFF_ID",$ID_New_Aff)."</div>";
|
|---|
| 149 | break;
|
|---|
| 150 |
|
|---|
| 151 | default:
|
|---|
| 152 |
|
|---|
| 153 | echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
|
|---|
| 154 | ?>
|
|---|
| 155 | <form method=post action="<? echo $_SERVER[PHP_SELF]; ?>">
|
|---|
| 156 | <input type=hidden name=page value=2>
|
|---|
| 157 | <div align=justify><? echo $page_text; ?></div>
|
|---|
| 158 | <br /><br />
|
|---|
| 159 | <table width=100% cellspacing=1 cellpadding=3 class=text>
|
|---|
| 160 |
|
|---|
| 161 | <tr class=table>
|
|---|
| 162 | <td width=30%><b><?php echo _t("_Name"); ?></b></td>
|
|---|
| 163 | <td width=40%><input class=no type=text size=40 name="Name" value="<?php echo $Name; ?>"></td>
|
|---|
| 164 | <td width=30%><?php echo _t("_chars_to_chars",$min_nick,$max_nick); ?></td>
|
|---|
| 165 | </tr>
|
|---|
| 166 |
|
|---|
| 167 | <tr><td><br /></td></tr>
|
|---|
| 168 |
|
|---|
| 169 | <tr class=table>
|
|---|
| 170 | <td width=30%><b><?php echo _t("_E-mail"); ?></b></td>
|
|---|
| 171 | <td width=40%><input class=no type=text size=40 name="Email" value="<?php echo $Email; ?>"></td>
|
|---|
| 172 | <td width=30%><?php echo _t("_Must be valid"); ?></td>
|
|---|
| 173 | </tr>
|
|---|
| 174 |
|
|---|
| 175 | <tr class=table>
|
|---|
| 176 | <td width=30%><b><?php echo _t("_Confirm E-mail"); ?></b></td>
|
|---|
| 177 | <td width=40%><input class=no type=text size=40 name="Email2"></td>
|
|---|
| 178 | <td width=30%><?php echo _t("_Confirm your e-mail"); ?></td>
|
|---|
| 179 | </tr>
|
|---|
| 180 |
|
|---|
| 181 | <tr><td><br /></td></tr>
|
|---|
| 182 |
|
|---|
| 183 | <tr class=table>
|
|---|
| 184 | <td width=30%><b><?php echo _t("_Password"); ?></b></td>
|
|---|
| 185 | <td width=40%><input class=no type=password size=40 name="Password1" value=""></td>
|
|---|
| 186 | <td width=30%></td>
|
|---|
| 187 | </tr>
|
|---|
| 188 |
|
|---|
| 189 | <tr class=table>
|
|---|
| 190 | <td width=30%><b><?php echo _t("_Confirm password"); ?></b></td>
|
|---|
| 191 | <td width=40%><input class=no type=password size=40 name="Password2" value=""></td>
|
|---|
| 192 | <td width=30%><?php echo _t("_Confirm your password"); ?></td>
|
|---|
| 193 | </tr>
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 | </table>
|
|---|
| 197 | <br /><center>
|
|---|
| 198 | <img alt="Security Image" src="simg/simg.php" /><br /><br />
|
|---|
| 199 | <? echo _t( "_Enter what you see:" ); ?><input name="securityImageValue" type="text" size="15" ><br /><br />
|
|---|
| 200 | <input class=no type="submit" value="<? echo _t( "_Submit" ); ?>" class="text"></center></form>
|
|---|
| 201 | <?
|
|---|
| 202 | break;
|
|---|
| 203 | }
|
|---|
| 204 | echo "</td></table>";
|
|---|
| 205 |
|
|---|
| 206 | return ob_get_clean();
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 | /**
|
|---|
| 211 | * Print error message
|
|---|
| 212 | */
|
|---|
| 213 | function report_err( $str )
|
|---|
| 214 | {
|
|---|
| 215 | return "<font color=\"#880000\"><b>" . _t( "_Error" ) . ":</b> $str</font><br />";
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 | ?>
|
|---|