Advertisement
Guest User

Untitled

a guest
Sep 15th, 2017
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. <?
  2. /***
  3. Domain Name: Misthalin.net
  4. Author: Ramie iRamie24@live.com
  5. School: Richmond Green Secondary
  6. Final Project: ICS3U
  7. Submission Date: December 20th 2010
  8. This program retrieves
  9. **/
  10.  
  11. $dbhost = 'localhost'; //Replace with yours
  12. $dbuser = 'cliente1_admin';
  13. $dbpass = 'klz0t7bx';
  14.  
  15. $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
  16.  
  17. $dbname = 'cliente1_server';
  18. mysql_select_db($dbname);
  19.  
  20. require_once('recaptchalib.php');
  21. $privatekey = "6Le7-sQSAAAAAMndGYj3M5_W4YMUci5iJj6fRhYE";
  22. $publickey = "6Le7-sQSAAAAANN083bg1azSq580Uu6wxuukBGtY";
  23.  
  24. function resendPassword ($email) {
  25. $sql = "SELECT password FROM users WHERE email = '".mysql_real_escape_string($email)."'"; //Query string
  26. $result = mysql_query($sql);
  27.  
  28. if (!$result || mysql_num_rows($result) < 1) { //Checks to see if it exists, if not return 0
  29. echo "Sorry, the email address <b>".$email."</b> does not exist in our database!";
  30. return 0;
  31. }
  32. else {
  33. $row = mysql_fetch_array($result);
  34. $to = $email;
  35. $subject = 'Password recovery from Misthalin Gaming.'; //This is the mail template, change it if you want
  36. $message = 'Here is your password for the Misthalin Server.
  37.  
  38. Password: '.$row['password'].'
  39. Thank you for choosing MySite for all your gaming needs!';
  40. $headers = 'From: Misthalin <webmaster@misthalin.net>' . "\r\n" .
  41. 'Reply-To: misthalin2010@gmail.com' . "\r\n" .
  42. 'X-Mailer: PHP/' . phpversion();
  43.  
  44. $emailed = mail($to, $subject, $message, $headers);
  45.  
  46. if ($emailed) { //When email has been sent
  47. echo ("Your password has been successfully emailed to <b>".$email."</b>");
  48. } else {
  49. echo ("Email was unsuccessful. Please contact website administrator."); //Failure
  50. }
  51.  
  52. }
  53. }
  54.  
  55. ?>
  56.  
  57. <html>
  58.  
  59. <head>
  60. <style type="text/css">
  61. .Center {
  62. text-align: center;
  63. }
  64. .makingCentred {
  65. text-align: center;
  66. font-family: "Comic Sans MS", cursive;
  67. color: #FF0;
  68. }
  69. .Green {
  70. color: #0F0;
  71. }
  72. .Bold {
  73. font-weight: bold;
  74. }
  75. .Comic {
  76. font-family: "Comic Sans MS", cursive;
  77. }
  78. </style>
  79. </head>
  80.  
  81. <body class="makingCentred">
  82.  
  83. <p>
  84. <?
  85. $printError = false;
  86. /* Check recaptcha */
  87.  
  88. if (isset($_POST['email'])) { //Got this from Jaden
  89. $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
  90. if ($resp->is_valid) {
  91. resendPassword($_POST['email']);
  92. $skipForm = true;
  93. } else {
  94. $skipForm = false;
  95. $printError = true;
  96. }
  97.  
  98. }
  99. if (!$skipForm) { //Got this from Jaden
  100.  
  101. if ($printError) {
  102. echo ("There was an error with the form (reCAPTCHA said: " . $resp->error . ")<br><br>");
  103. }
  104. ?>
  105. </p>
  106. <p>Please enter your E-Mail address you have registered with your <span class="Green">Account in-game!</span></p>
  107. <p>This will enter our database and fetch your password and e-mail it to you!</p>
  108. <form name="resendPwd" action="" method="post">
  109. <label class="Comic">Email: </label><input type="text" name="email" id="email" size="40" />
  110. <br>
  111. <br>
  112. <center>
  113. <?php
  114. echo recaptcha_get_html($publickey); //Showing Captcha
  115. ?>
  116. </center>
  117. <div style="width:250px; text-align:left;">
  118. <center> <input type="submit" value="Submit" />
  119. </center>
  120. </div>
  121. </form>
  122.  
  123. <p>
  124. <?
  125. }
  126. ?>
  127. </p>
  128. <br>
  129. <br>
  130. <br>
  131. <br>
  132. <br>
  133. <br>
  134. <br>
  135. <br>
  136. </body>
  137. </center>
  138. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement