Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <title>Schimba-ti adresa de email - <?php echo Config::$_SITE_NAME; ?></title>
- <?php
- if(!defined('panel'))
- die('Nope.');
- if(!isset($_SESSION['user'])) { echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL.'\'/>'; } else {
- ?>
- <section class="content">
- <div class="row-fluid">
- <div class="span12">
- <?php
- if(isset($_SESSION['user']) && Config::getData('users','Email',$_SESSION['user']) == 'email@yahoo.com')
- {
- if(isset($_POST['submit'])) {
- $q = Config::$g_con->prepare('SELECT * FROM `users` WHERE `name` = ? AND `password` = ?');
- $q->execute(array(Config::getData('users','name',$_SESSION['user']),$_POST['password']));
- while($row = $q->fetch(PDO::FETCH_OBJ))
- if($q->rowCount()) {
- $d = Config::$g_con->prepare('SELECT * FROM `changemail` WHERE `name` = ?');
- $d->execute(array(Config::getData('users','name',$_SESSION['user'])));
- if($d->rowCount()) {
- echo '<div class="alert alert-block alert-danger">Ai mai făcut deja o cerere de schimbare a emailului.</div>';
- }
- else {
- $user = $row->name;
- $first = md5(uniqid());
- $final_key = $first . md5($first);
- $first = md5(uniqid());
- $final_key = $first . md5($first);
- $s = Config::$g_con->prepare("INSERT INTO changemail (ChangeMailKey, name, Email) VALUES (?, ?, ?)");
- $s->execute(array($final_key, $user, $_POST['email']));
- echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL."checkmail/".$final_key.'\'/>';
- }
- }
- }
- }
- else {
- if(isset($_POST['submit'])) {
- if(!$_POST['email'] || !$_POST['password']) {
- echo '<div class="alert alert-block alert-danger">Invalid email / Email invalid.</div>';
- } else {
- $q = Config::$g_con->prepare('SELECT * FROM `users` WHERE `name` = ? AND `password` = ?');
- $q->execute(array(Config::getData('users','name',$_SESSION['user']),$_POST['password']));
- while($row = $q->fetch(PDO::FETCH_OBJ))
- if($q->rowCount()) {
- $d = Config::$g_con->prepare('SELECT * FROM `changemail` WHERE `name` = ?');
- $d->execute(array(Config::getData('users','name',$_SESSION['user'])));
- if($d->rowCount()) {
- echo '<div class="alert alert-block alert-danger">Ai mai făcut deja o cerere de schimbare a emailului.</div>';
- }
- else {
- if($row->Email == "email@gmail.com") {
- $email = htmlspecialchars($_POST['email']);
- } else {
- $email = $row->Email;
- }
- $user = $row->name;
- $first = md5(uniqid());
- $final_key = $first . md5($first);
- $s = Config::$g_con->prepare("INSERT INTO changemail (ChangeMailKey, name, Email) VALUES (?, ?, ?)");
- $s->execute(array($final_key, $user, $_POST['email']));
- require 'inc/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->Host = '195.181.215.145';
- $mail->SMTPAuth = false;
- $mail->Username = 'nasa.kriksongaming.ro';
- $mail->Password = 'MYax5ABD';
- $mail->SMTPSecure = 'tls';
- $mail->Port = 25;
- $mail->setFrom('email@localhost.ro', 'localhost.ro');
- $mail->addAddress($email);
- $mail->Subject = 'localhost.ro - confirmare email / validate your email';
- $mail->Body = "Salutare $user,
- [RO] Ai primit acest email pentru ca ai solicitat confirmarea emailului pe serverul pe serverul rpg.localhost.ro
- Pentru a avea emailul ". $_POST['email'] ." asociat cu contul tau, da click pe link-ul de mai jos:
- ".Config::$_PAGE_URL."checkmail/".$final_key."
- [EN] You have received this email because you have requested to confirm your email on the server rpg.localhost.ro
- To have the email ". $_POST['email'] ." associated with your account, please click the link above.
- Cu stima,
- Echipa localhost.ro.ro
- Contact: rem@localhost.ro";
- if(!$mail->send()) {
- echo 'Email could send';
- $dele = Config::$g_con->prepare("DELETE FROM changemail WHERE ChangeMailKey='".Config::$_url[1]."'");
- $dele->execute();
- } else {
- $err = "<br />Un email a fost trimis catre ". $email ." pentru confirmarea emailului.<br />
- In acel email vei gasi un link pe care va trebui sa dai click pentru a confirma schimbarea adresei de email asociata cu contul tau.<br /><br />
- Emailul va ajunge la tine in cateva minute in casuta ta de email.<br />
- <html><p><font color='red'><b>ATENTIE:</b> Email-urile vin in decurs de 10 minute!</b></font></p></html>
- Daca nu ai primit emailul, verifica si folderul de spam sau foloseste optiunea de search din gmail pentru a cauta localhost.ro.";
- }
- }
- }
- else echo '<div class="alert alert-block alert-danger"><button type="button" class="close" data-dismiss="alert">Invalid email / Email invalid.</div>';
- }
- }
- } ?>
- <div class="page-header">
- <h1>Schimba-ti adresa de email</h1>
- </div>
- <p>
- <b>Atentie!</b><br>E interzis sa vinzi contul sau sa-l dai la schimb.<br>O data ce ai schimbat emailul, nu vei mai putea recupera contul daca nu ai acces la noul email.<br>Nu seta emailul altcuiva daca nu vrei sa ramai fara cont.
- <hr>
- </p>
- <script>
- var domains = ["gmail","msn","hotmail","outlook"];
- function validateDomain(me){
- var idx1 = me.value.indexOf("@");
- if(idx1>-1){
- var splitStr = me.value.split("@");
- var sub = splitStr[1].split(".");
- if(domains.indexOf(sub[0])>-1){
- me.value="";
- alert("Este permis doar yahoo.com!");
- }
- }
- }
- </script>
- <?php if(isset($err)): ?>
- <?php echo $err ?>
- <?php else: ?>
- <?php
- if(isset($_SESSION['user']) && Config::getData('users','Email',$_SESSION['user']) == 'email@yahoo.com')
- {
- echo '<html><b>ATENTIE:</b> Deoarece ai adresa de email: email@yahoo.com iti setam automat fara confirmari email-ul!';
- }
- else {
- echo 'Ai grija cand scrii adresa de email!O data setata gresit nu se mai poate schimba!'; } ?>
- <?php echo 'Retine,este permis doar GMAIL.COM ca si adresa de email.'; ?>
- <form method="POST" action="" accept-charset="UTF-8">
- New email:<br />
- <input placeholder="Scrie noua adresa de email aici..." name="email" type="email" onblur="validateDomain(this)"><br />
- SA:MP Password:<br />
- <input name="password" type="password"><br/><br />
- <input class="btn btn-inverse" type="submit" name="submit" value="Modifica!">
- </form>
- <?php endif;
- } ?>
- </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement