Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //############## GENERATE NEW RECOVERY KEY ###########
- if($action == "newreckey")
- {
- $reg_password = password_ency(trim($_POST['reg_password']));
- $reckey = $account_logged->getRecoveryKey();
- if((!$config['site']['generate_new_reckey'] || !$config['site']['send_emails']) || empty($reckey))
- $main_content .= 'You cant get new rec key';
- else
- {
- $points = $account_logged->getPremiumPoints();
- if($_POST['registeraccountsave'] == "1")
- {
- if($reg_password == $account_logged->getPassword())
- {
- if($points >= $config['site']['generate_new_reckey_price'])
- {
- $dontshowtableagain = 1;
- $acceptedChars = 'ABCDEFGHIJKLMNPQRSTUVWXYZ123456789';
- $max = strlen($acceptedChars)-1;
- $new_rec_key = NULL;
- // 10 = number of chars in generated key
- for($i=0; $i < 10; $i++) {
- $cnum[$i] = $acceptedChars{mt_rand(0, $max)};
- $new_rec_key .= $cnum[$i];
- }
- $main_content .= '<div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Account Registered</div> <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><ul>';
- $mailBody = '<html>
- <body>
- <h3>New recovery key!</h3>
- <p>You or someone else generated recovery key to your account on server <a href="'.$config['server']['url'].'"><b>'.$config['server']['serverName'].'</b></a>.</p>
- <p>Recovery key: <b>'.$new_rec_key.'</b></p>
- </body>
- </html>';
- require("phpmailer/class.phpmailer.php");
- $mail = new PHPMailer();
- if ($config['site']['smtp_enabled'] == "yes")
- {
- $mail->IsSMTP();
- $mail->Host = $config['site']['smtp_host'];
- $mail->Port = (int)$config['site']['smtp_port'];
- $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
- $mail->Username = $config['site']['smtp_user'];
- $mail->Password = $config['site']['smtp_pass'];
- }
- else
- $mail->IsMail();
- $mail->IsHTML(true);
- $mail->From = $config['site']['mail_address'];
- $mail->AddAddress($account_logged->getEMail());
- $mail->Subject = $config['server']['serverName']." - new recovery key";
- $mail->Body = $mailBody;
- if($mail->Send())
- {
- $account_logged->setRecoveryKey(new_rec_key);
- $account_logged->setPremiumPoints($account_logged->getPremiumPoints()-$config['site']['generate_new_reckey_price']);
- $account_logged->save();
- $main_content .= '<br />Your recovery key were send on email address <b>'.$account_logged->getEMail().'</b> for '.$config['site']['generate_new_reckey_price'].' premium points.';
- }
- else
- $main_content .= '<br />An error occorred while sending email ( <b>'.$account_logged->getEMail().'</b> ) with recovery key! Recovery key not changed. Try again.';
- $main_content .= '</ul> </table> </div> </table></div></td></tr><br/><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></center>';
- }
- else
- $reg_errors[] = 'You need '.$config['site']['generate_new_reckey_price'].' premium points to generate new recovery key. You have <b>'.$points.'<b> premium points.';
- }
- else
- $reg_errors[] = 'Wrong password to account.';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement