Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once "maincore.php";
- require_once THEMES."templates/header.php";
- $db2_host = "localhost";
- $db2_user = "***";
- $db2_pass = "***";
- $db2_name = "account";
- $db312_link = mysql_connect($db2_host, $db2_user, $db2_pass) OR die("Nu sa putut conecta la baza de date.");
- @mysql_select_db($db2_name) or die( "Baza de date nu poate fi selectata.");
- $get_code = isset($_GET['confirm']) ? cleanurl(stripinput($_GET['confirm'])) : "";
- if(isset($_GET['email'])) {
- $get_mail = preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $_GET['email']) ? $_GET['email'] : "";
- }
- if(!empty($get_code) && !empty($get_mail)){
- $dbselect = dbquery("SELECT cod_unic, actiontime FROM account WHERE Email = '".$get_mail."'");
- if(dbrows($dbselect)) {
- $getdata = dbarray($dbselect);
- $calculate_time = time() - $getdata['actiontime'];
- if($calculate_time < 86400) {
- $chars = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789-_!@";
- $char_count = strlen($chars) - 1;
- $new_pass = "";
- for ($i = 0; $i < 8; $i++) {
- $new_pass .= substr($chars, mt_rand(0, $char_count), 1);
- }
- $update_pass = dbquery("UPDATE `account` SET `Password` = password('$new_pass') WHERE `Email` = '".$get_mail."' LIMIT 1");
- if($update_pass) {
- opentable("Verifica e-mail");
- $to = $get_mail;
- $subject = "Recuperare parola Metin2Tim!";
- $header = "From: Metin2TIM@Metin2TiM.ro";
- $body = "Noua ta parola este: ".$new_pass." ";
- if (mail($to, $subject, $body,$header)) {
- echo "<center>Noua parola a fost trimisa pe e-mail!</center>";
- } else {
- echo "<center>A intervenit o eroare incercati inca odata.</center>";
- }
- closetable();
- } else {
- echo "ERROR!!!";
- }
- } else {
- opentable("Eroare");
- echo "<center>Acest link a expirat.</center>";
- closetable();
- }
- } else {
- opentable("Eroare");
- echo "<center>A intervenit o eroare incercati inca odata.</center>";
- closetable();
- }
- } else {
- if(!isset($_POST['Email'])) {
- opentable("Recupereaza parola");
- if (iSUPERADMIN) {
- echo "<form action='' method='post'>";
- echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border' align='center'>\n";
- echo "<tr>";
- echo "<td class='tbl2' width='121' valign='top' align='right'>E-mail:</td>";
- echo "<td class='tbl2' width='370' align='left' ><input type='text' name='Email' id='Email' size='43' maxlength='43' class='textbox'></td>";
- echo "</tr>";
- echo "</table>";
- echo "<center><input type='submit' border='0' name='recover' class='button' value='Trimite-mi parola'></center>";
- echo "</form>";
- } else {
- echo "<div style='text-align:center'><br />Ne pare rău dar accesul pe această pagină este restrictionat!<br /><br />\n</div>\n";
- }
- closetable();
- } else {
- if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $_POST['Email'])) {
- $error = "Adresa de E-Mail introdusa nu este valida.<br />\n";
- }
- if(empty($error)) {
- $res = dbquery("SELECT * FROM account WHERE Email = '".$_POST['Email']."' ");
- if(dbrows($res)) {
- $chars = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789-_!@";
- $char_count = strlen($chars) - 1;
- $cod_unic = "";
- for ($i = 0; $i < 8; $i++) {
- $cod_unic .= substr($chars, mt_rand(0, $char_count), 1);
- }
- $db_update = dbquery("UPDATE `account` SET `cod_unic` = password('$cod_unic'),
- `actiontime` = '".time()."' WHERE `Email` ='".$_POST['Email']."' LIMIT 1 ;");
- if($db_update) {
- $to = $_POST['Email'];
- $subject = "Recuperare parola Metin2TIM!";
- $header = "From: NoReply@Metin2TIM.ro";
- $body = "Pentru confirmare acceseaza urmatorul link: ".$settings['siteurl']."recover-1.php?confirm=".$cod_unic."&email=".$_POST['Email']." ";
- if (mail($to, $subject, $body,$header)) {
- opentable("Verifica E-Mail");
- echo "<center>In scurt timp vei primi un E-Mail pentru confirmare.</center>";
- closetable();
- } else {
- opentable("Eroare");
- echo "<center>A aparut o eroare. Mai incearca odata.</center>";
- closetable();
- }
- } else {
- opentable("Eroare");
- echo "<center>A aparut o eroare. Mai incearca odata.</center>";
- closetable();
- }
- } else {
- opentable("Eroare");
- echo "<center>Adresa de E-Mail introdusa nu se afla in baza noastra de date.</center>";
- closetable();
- }
- } else {
- opentable("Eroare");
- echo $error;
- closetable();
- }
- }
- }
- mysql_close($db312_link);
- $link = dbconnect($db_host, $db_user, $db_pass, $db_name);
- require_once THEMES."templates/footer.php";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement