0) { AutoCheck(); exit; } if(isset($_GET['retrieve'])){ Retrieve(); exit; } if(isset($_POST['action'])){ Check(); exit; } if(isset($_POST['rp'])){ RetrieveProcess(); exit; } $idg = ($_GET['idg']); { LogIn(); } ?>

ВХОД

'; echo '

'.$message.'

'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Электронная почта*: 
Пароль*: 
Запомнить: 
'; echo '
 
 
Нажмите здесь, если вы потеряли свой пароль

'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; } /////////////////////////////////////////////////////// // --- CHECK /////////////////////////////////////////////////////// function Check() { global $message; $email=stripslashes($_POST['e']); $pwd=stripslashes($_POST['p']); $auto=stripslashes($_POST['a']); $idg=stripslashes($_POST['idg']); $ip = $_SERVER['REMOTE_ADDR']; $pwd=trim($pwd); $email=trim($email); $link = mysql_connect (MYSQLADDRESS,MYSQLUSER,MYSQLPW); mysql_select_db(DATABASENAME); $sql="SELECT * FROM signups WHERE email='$email' AND password='$pwd'"; $result = mysql_query($sql,$link) or die(mysql_error()); if(!($rad=mysql_fetch_array($result))) { $query = "INSERT INTO login_errors(email,password,ip) VALUES('$email','$pwd','$ip')"; $result = mysql_query($query, $link) or die(mysql_error()); $message = "Не хватает пользователя или не правильный пароль"; LogIn(); exit; } else { $user_type=$rad["user_type"]; $confirmation_date=$rad["confirmation_date"]; $id_secure=$rad["id_secure"]; $sql_popup="SELECT * FROM rupopups WHERE popup_name=\"user_type\" AND popup_value=\"".$user_type."\""; $result_popup = mysql_query($sql_popup, $link) or die(mysql_error()); while($popup=mysql_fetch_array($result_popup)) { $user_type_text = $popup["popup_text"]; } if($confirmation_date<>"0000-00-00 00:00:00") { $_SESSION['user_logged_in']="Y"; } else { // $message = "You need to confirm your signup. Check your email."; LogIn(); exit; } $_SESSION['user_id']=$rad["id"]; $_SESSION['user_id_secure']=$rad["id_secure"]; $_SESSION['expert_id']=$rad["expert_id"]; $_SESSION['user_twid']=$rad["twid"]; $_SESSION['user_firstname']=$rad["first"]; $_SESSION['user_lastname']=$rad["last"]; $_SESSION['user_type']=$user_type; $_SESSION['user_type_text']=$user_type_text; $_SESSION['user_ip']=$_SERVER['REMOTE_ADDR']; $sessLimit="7200"; if($auto>0) { $sessLimit="1641600"; } ini_set('session.gc_maxlifetime', $sessLimit); $logins = $rad["logins"]; $newlogins = $logins +1 ; $query = "UPDATE signups SET logins='$newlogins' WHERE id_secure ='$id_secure'"; $result = mysql_query($query, $link) or die(mysql_error()); WriteLog('login'); session_write_close(); if($auto>0) { $date_of_expiry = time() + (2592000 * 1); setcookie( "al", $_SESSION['user_id_secure'], $date_of_expiry, "/" ); WriteLog('al cookie set'); } else { setcookie("al", "", time()-3600); WriteLog('al cookie removed'); } $akr = $_COOKIE['akr']; if($akr=="") { $date_of_expiry = time() + (31536000 * 1); setcookie( "akr", $_SESSION['user_id_secure'], $date_of_expiry, "/" ); WriteLog('akr cookie set'); } $user_id_secure = $_SESSION['user_id_secure']; if(strlen($idg)>0) { header("Location: http://belska.eu/ak/ak_buy_goods.php?idg=".$idg."&r=".$user_id_secure); exit; } if($user_type=="") {$user_type="U"; } if($logins==0 AND $user_type=="U") { $user_type="U1"; } $today_m = date('Y-m-d H:i:s', strtotime($today . ' + 9 hours')); $today_mh = date('H', strtotime($today . ' + 9 hours')); // if($today_mh <10) {$m_today = date('Y-m-d H:i:s', strtotime($today_m . ' - 1 day')); } // else { $m_today = $today_m; } $m_today = $today_m; if(($m_today>=TS_START) AND ($m_today<=TS_END)) { $user_type="UP"; } // Write log details switch($user_type) { case "UP": // User player header("Location: http://telesummit.ru/messages.php"); break; case "U1": // User first time header("Location: http://telesummit.ru/bonus.php"); break; case "U": // User header("Location: http://telesummit.ru/messages.php"); break; case "B": // System header("Location: http://telesummit.ru/backoffice.php"); break; } } mysql_close ($link); } /////////////////////////////////////////////////////// // --- AUTOCHECK /////////////////////////////////////////////////////// function AutoCheck() { global $message; $autologin = $_COOKIE['al']; $link = mysql_connect (MYSQLADDRESS,MYSQLUSER,MYSQLPW); mysql_select_db(DATABASENAME); $sql="SELECT * FROM signups WHERE id_secure='$autologin'"; $result = mysql_query($sql,$link) or die(mysql_error()); if(!($rad=mysql_fetch_array($result))) { $message = "Autologin error"; LogIn(); exit; } else { $user_type=$rad["user_type"]; $confirmation_date=$rad["confirmation_date"]; $id_secure=$rad["id_secure"]; $sql_popup="SELECT * FROM rupopups WHERE popup_name=\"user_type\" AND popup_value=\"".$user_type."\""; $result_popup = mysql_query($sql_popup, $link) or die(mysql_error()); while($popup=mysql_fetch_array($result_popup)) { $user_type_text = $popup["popup_text"]; } if($confirmation_date<>"0000-00-00 00:00:00") { $_SESSION['user_logged_in']="Y"; } else { // $message = "You need to confirm your signup. Check your email."; LogIn(); exit; } $_SESSION['user_id']=$rad["id"]; $_SESSION['user_id_secure']=$rad["id_secure"]; $_SESSION['expert_id']=$rad["expert_id"]; $_SESSION['user_twid']=$rad["twid"]; $_SESSION['user_firstname']=$rad["first"]; $_SESSION['user_lastname']=$rad["last"]; $_SESSION['user_type']=$user_type; $_SESSION['user_type_text']=$user_type_text; $_SESSION['user_ip']=$_SERVER['REMOTE_ADDR']; $sessLimit="7200"; if($auto>0) { $sessLimit="1641600"; } ini_set('session.gc_maxlifetime', $sessLimit); $logins = $rad["logins"]; $newlogins = $logins +1 ; $query = "UPDATE signups SET logins='$newlogins' WHERE id_secure ='$id_secure'"; $result = mysql_query($query, $link) or die(mysql_error()); WriteLog('autologin'); session_write_close(); $akr = $_COOKIE['akr']; if($akr=="") { $date_of_expiry = time() + (31536000 * 1); setcookie( "akr", $_SESSION['user_id_secure'], $date_of_expiry, "/" ); WriteLog('akr cookie set'); } $user_id_secure = $_SESSION['user_id_secure']; if(strlen($idg)>0) { header("Location: http://belska.eu/ak/ak_buy_goods.php?idg=".$idg."&r=".$user_id_secure); exit; } if($user_type=="") {$user_type="U"; } if($logins==0 AND $user_type=="U") { $user_type="U1"; } $today_m = date('Y-m-d H:i:s', strtotime($today . ' + 9 hours')); $today_mh = date('H', strtotime($today . ' + 9 hours')); // if($today_mh <10) {$m_today = date('Y-m-d H:i:s', strtotime($today_m . ' - 1 day')); } // else { $m_today = $today_m; } $m_today = $today_m; if(($m_today>=TS_START) AND ($m_today<=TS_END)) { $user_type="UP"; } // Write log details switch($user_type) { case "UP": // User player header("Location: http://telesummit.ru/messages.php"); break; case "U1": // User first time header("Location: http://telesummit.ru/bonus.php"); break; case "U": // User header("Location: http://telesummit.ru/index2.php"); break; case "B": // System header("Location: http://telesummit.ru/backoffice.php"); break; } } mysql_close ($link); } /////////////////////////////////////////////////////// //---RETRIEVE /////////////////////////////////////////////////////// function Retrieve() { echo '
'; echo '

Восстановить пароль

'; echo '
'; echo '

Введите адрес электронной почты для получения пароля
'; echo '

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Email *: 
'; echo '
 
 

'; echo '
'; echo '
'; echo '
'; echo '
'; } /////////////////////////////////////////////////////// //---RETRIEVE PROCESS /////////////////////////////////////////////////////// function RetrieveProcess() { global $databasename; global $mysqladdress; global $mysqluser; global $mysqlpw; global $from_email; global $owner; // Get user $email=stripslashes($_POST['e']); // Make connect link $link = mysql_connect (MYSQLADDRESS,MYSQLUSER,MYSQLPW); mysql_select_db(DATABASENAME); // Check if post already exists $sql="SELECT COUNT(email) AS C FROM signups WHERE email='$email'"; $result = mysql_query($sql, $link) or die(mysql_error()); $line=mysql_fetch_array($result); $number = $line["C"]; if ($number>0) { $sql="SELECT * FROM signups WHERE email ='$email'"; $result_sql = mysql_query($sql, $link) or die(mysql_error()); while($rad=mysql_fetch_array($result_sql)) { $first = $rad["first"]; $last = $rad["last"]; $email = $rad["email"]; $active = $rad["active"]; $ip_country = $rad["ip_country"]; $password = $rad["password"]; $signup_referer = $rad["signup_referer"]; } $from_email = FROM_EMAIL; $owner = OWNER; $sql="SELECT * FROM letters WHERE id='8'"; $result = mysql_query($sql, $link) or die(mysql_error()); while ($line=mysql_fetch_array($result)) { $headline = $line["headline"]; $messageblock = $line["message"]; $link1 = $line["link1"]; $link2 = $line["link2"]; $link3 = $line["link3"]; } $fil="textdata/email_template.txt"; $filhanterare=fopen($fil, "r"); $message=fread($filhanterare,filesize($fil)); fclose($filhanterare); // Replace info $message = str_replace("[headline]",$headline,$message); $message = str_replace("[message]",$messageblock,$message); $message = str_replace("[link1]",$link1,$message); $message = str_replace("[link2]",$link2,$message); $message = str_replace("[link3]",$link3,$message); $message = str_replace("[id_secure]",$id_secure,$message); $message = str_replace("[name]",$first,$message); $message = str_replace("[password]",$password,$message); $message = str_replace("[email]",$email,$message); $sendmessage = $message; $mailsubject = $headline; $mailcontent = $sendmessage; $mail = new PHPMailer(); $mail->From = $from_email; $mail->FromName = $owner; $mail->AddAddress($email); $mail->IsHTML(true); // set email format to HTML $mail->Subject = $mailsubject; $mail->Body = $mailcontent; if(!$mail->Send()) { echo "Сообщение не может быть отправлено.

"; echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "
Мы отправили вам письмо ".$email." о вашей регистрации."; echo "
Пожалуйста, проверьте свою электронную почту.

"; WriteLog('pw resent'); } } else // Wrong email given { echo "Этот емайл не зарегестрирован с этим личным кабинетом.
"; echo '

Нажмите сюда, чтобы попробовать еще.

'; } } /////////////////////////////////////////////////////// //---- WRITE LOG /////////////////////////////////////////////////////// function WriteLog($action) { // $action = "login"; $ip = $_SERVER['REMOTE_ADDR']; $user_id = $_SESSION['user_id']; $link = mysql_connect (MYSQLADDRESS,MYSQLUSER,MYSQLPW); mysql_select_db(DATABASENAME); $query = "INSERT INTO user_log(ID,user_id,action,ip) VALUES(NULL,'$user_id','$action','$ip')"; $result = mysql_query($query, $link) or die(mysql_error()); }