Advertisement
Guest User

Untitled

a guest
Jul 12th, 2017
732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. <title>Schimba-ti adresa de email - <?php echo Config::$_SITE_NAME; ?></title>
  2. <?php
  3. if(!defined('panel'))
  4. die('Nope.');
  5. if(!isset($_SESSION['user'])) { echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL.'\'/>'; } else {
  6. ?>
  7.  
  8. <section class="content">
  9. <div class="row-fluid">
  10. <div class="span12">
  11. <?php
  12.  
  13. if(isset($_SESSION['user']) && Config::getData('users','Email',$_SESSION['user']) == 'email@yahoo.com')
  14. {
  15. if(isset($_POST['submit'])) {
  16.  
  17. $q = Config::$g_con->prepare('SELECT * FROM `users` WHERE `name` = ? AND `password` = ?');
  18. $q->execute(array(Config::getData('users','name',$_SESSION['user']),$_POST['password']));
  19. while($row = $q->fetch(PDO::FETCH_OBJ))
  20. if($q->rowCount()) {
  21. $d = Config::$g_con->prepare('SELECT * FROM `changemail` WHERE `name` = ?');
  22. $d->execute(array(Config::getData('users','name',$_SESSION['user'])));
  23. if($d->rowCount()) {
  24. echo '<div class="alert alert-block alert-danger">Ai mai f&#259;cut deja o cerere de schimbare a emailului.</div>';
  25. }
  26. else {
  27.  
  28. $user = $row->name;
  29.  
  30. $first = md5(uniqid());
  31. $final_key = $first . md5($first);
  32.  
  33.  
  34. $first = md5(uniqid());
  35. $final_key = $first . md5($first);
  36.  
  37. $s = Config::$g_con->prepare("INSERT INTO changemail (ChangeMailKey, name, Email) VALUES (?, ?, ?)");
  38. $s->execute(array($final_key, $user, $_POST['email']));
  39. echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL."checkmail/".$final_key.'\'/>';
  40.  
  41. }
  42.  
  43. }
  44. }
  45. }
  46. else {
  47. if(isset($_POST['submit'])) {
  48. if(!$_POST['email'] || !$_POST['password']) {
  49. echo '<div class="alert alert-block alert-danger">Invalid email / Email invalid.</div>';
  50. } else {
  51. $q = Config::$g_con->prepare('SELECT * FROM `users` WHERE `name` = ? AND `password` = ?');
  52. $q->execute(array(Config::getData('users','name',$_SESSION['user']),$_POST['password']));
  53. while($row = $q->fetch(PDO::FETCH_OBJ))
  54. if($q->rowCount()) {
  55. $d = Config::$g_con->prepare('SELECT * FROM `changemail` WHERE `name` = ?');
  56. $d->execute(array(Config::getData('users','name',$_SESSION['user'])));
  57. if($d->rowCount()) {
  58. echo '<div class="alert alert-block alert-danger">Ai mai f&#259;cut deja o cerere de schimbare a emailului.</div>';
  59. }
  60. else {
  61. if($row->Email == "email@gmail.com") {
  62. $email = htmlspecialchars($_POST['email']);
  63. } else {
  64. $email = $row->Email;
  65. }
  66. $user = $row->name;
  67.  
  68. $first = md5(uniqid());
  69. $final_key = $first . md5($first);
  70.  
  71. $s = Config::$g_con->prepare("INSERT INTO changemail (ChangeMailKey, name, Email) VALUES (?, ?, ?)");
  72. $s->execute(array($final_key, $user, $_POST['email']));
  73.  
  74. require 'inc/PHPMailerAutoload.php';
  75. $mail = new PHPMailer;
  76. $mail->isSMTP();
  77. $mail->Host = '195.181.215.145';
  78. $mail->SMTPAuth = false;
  79. $mail->Username = 'nasa.kriksongaming.ro';
  80. $mail->Password = 'MYax5ABD';
  81. $mail->SMTPSecure = 'tls';
  82. $mail->Port = 25;
  83. $mail->setFrom('email@localhost.ro', 'localhost.ro');
  84. $mail->addAddress($email);
  85. $mail->Subject = 'localhost.ro - confirmare email / validate your email';
  86. $mail->Body = "Salutare $user,
  87. [RO] Ai primit acest email pentru ca ai solicitat confirmarea emailului pe serverul pe serverul rpg.localhost.ro
  88. Pentru a avea emailul ". $_POST['email'] ." asociat cu contul tau, da click pe link-ul de mai jos:
  89. ".Config::$_PAGE_URL."checkmail/".$final_key."
  90.  
  91.  
  92. [EN] You have received this email because you have requested to confirm your email on the server rpg.localhost.ro
  93. To have the email ". $_POST['email'] ." associated with your account, please click the link above.
  94.  
  95.  
  96. Cu stima,
  97. Echipa localhost.ro.ro
  98. Contact: rem@localhost.ro";
  99. if(!$mail->send()) {
  100.  
  101. echo 'Email could send';
  102. $dele = Config::$g_con->prepare("DELETE FROM changemail WHERE ChangeMailKey='".Config::$_url[1]."'");
  103. $dele->execute();
  104.  
  105. } else {
  106. $err = "<br />Un email a fost trimis catre ". $email ." pentru confirmarea emailului.<br />
  107. 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 />
  108. Emailul va ajunge la tine in cateva minute in casuta ta de email.<br />
  109. <html><p><font color='red'><b>ATENTIE:</b> Email-urile vin in decurs de 10 minute!</b></font></p></html>
  110. Daca nu ai primit emailul, verifica si folderul de spam sau foloseste optiunea de search din gmail pentru a cauta localhost.ro.";
  111. }
  112. }
  113.  
  114. }
  115. else echo '<div class="alert alert-block alert-danger"><button type="button" class="close" data-dismiss="alert">Invalid email / Email invalid.</div>';
  116. }
  117. }
  118. } ?>
  119.  
  120. <div class="page-header">
  121. <h1>Schimba-ti adresa de email</h1>
  122. </div>
  123. <p>
  124. <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.
  125. <hr>
  126. </p>
  127. <script>
  128. var domains = ["gmail","msn","hotmail","outlook"];
  129.  
  130. function validateDomain(me){
  131. var idx1 = me.value.indexOf("@");
  132. if(idx1>-1){
  133. var splitStr = me.value.split("@");
  134. var sub = splitStr[1].split(".");
  135. if(domains.indexOf(sub[0])>-1){
  136. me.value="";
  137. alert("Este permis doar yahoo.com!");
  138. }
  139. }
  140. }
  141. </script>
  142. <?php if(isset($err)): ?>
  143. <?php echo $err ?>
  144. <?php else: ?>
  145. <?php
  146. if(isset($_SESSION['user']) && Config::getData('users','Email',$_SESSION['user']) == 'email@yahoo.com')
  147. {
  148. echo '<html><b>ATENTIE:</b> Deoarece ai adresa de email: email@yahoo.com iti setam automat fara confirmari email-ul!';
  149. }
  150. else {
  151. echo 'Ai grija cand scrii adresa de email!O data setata gresit nu se mai poate schimba!'; } ?>
  152. <?php echo 'Retine,este permis doar GMAIL.COM ca si adresa de email.'; ?>
  153. <form method="POST" action="" accept-charset="UTF-8">
  154. New email:<br />
  155. <input placeholder="Scrie noua adresa de email aici..." name="email" type="email" onblur="validateDomain(this)"><br />
  156. SA:MP Password:<br />
  157. <input name="password" type="password"><br/><br />
  158. <input class="btn btn-inverse" type="submit" name="submit" value="Modifica!">
  159. </form>
  160. <?php endif;
  161. } ?>
  162.  
  163. </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement