Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- /***
- Domain Name: Misthalin.net
- Author: Ramie iRamie24@live.com
- School: Richmond Green Secondary
- Final Project: ICS3U
- Submission Date: December 20th 2010
- This program retrieves
- **/
- $dbhost = 'localhost'; //Replace with yours
- $dbuser = 'cliente1_admin';
- $dbpass = 'klz0t7bx';
- $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
- $dbname = 'cliente1_server';
- mysql_select_db($dbname);
- require_once('recaptchalib.php');
- $privatekey = "6Le7-sQSAAAAAMndGYj3M5_W4YMUci5iJj6fRhYE";
- $publickey = "6Le7-sQSAAAAANN083bg1azSq580Uu6wxuukBGtY";
- function resendPassword ($email) {
- $sql = "SELECT password FROM users WHERE email = '".mysql_real_escape_string($email)."'"; //Query string
- $result = mysql_query($sql);
- if (!$result || mysql_num_rows($result) < 1) { //Checks to see if it exists, if not return 0
- echo "Sorry, the email address <b>".$email."</b> does not exist in our database!";
- return 0;
- }
- else {
- $row = mysql_fetch_array($result);
- $to = $email;
- $subject = 'Password recovery from Misthalin Gaming.'; //This is the mail template, change it if you want
- $message = 'Here is your password for the Misthalin Server.
- Password: '.$row['password'].'
- Thank you for choosing MySite for all your gaming needs!';
- $headers = 'From: Misthalin <webmaster@misthalin.net>' . "\r\n" .
- 'Reply-To: misthalin2010@gmail.com' . "\r\n" .
- 'X-Mailer: PHP/' . phpversion();
- $emailed = mail($to, $subject, $message, $headers);
- if ($emailed) { //When email has been sent
- echo ("Your password has been successfully emailed to <b>".$email."</b>");
- } else {
- echo ("Email was unsuccessful. Please contact website administrator."); //Failure
- }
- }
- }
- ?>
- <html>
- <head>
- <style type="text/css">
- .Center {
- text-align: center;
- }
- .makingCentred {
- text-align: center;
- font-family: "Comic Sans MS", cursive;
- color: #FF0;
- }
- .Green {
- color: #0F0;
- }
- .Bold {
- font-weight: bold;
- }
- .Comic {
- font-family: "Comic Sans MS", cursive;
- }
- </style>
- </head>
- <body class="makingCentred">
- <p>
- <?
- $printError = false;
- /* Check recaptcha */
- if (isset($_POST['email'])) { //Got this from Jaden
- $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
- if ($resp->is_valid) {
- resendPassword($_POST['email']);
- $skipForm = true;
- } else {
- $skipForm = false;
- $printError = true;
- }
- }
- if (!$skipForm) { //Got this from Jaden
- if ($printError) {
- echo ("There was an error with the form (reCAPTCHA said: " . $resp->error . ")<br><br>");
- }
- ?>
- </p>
- <p>Please enter your E-Mail address you have registered with your <span class="Green">Account in-game!</span></p>
- <p>This will enter our database and fetch your password and e-mail it to you!</p>
- <form name="resendPwd" action="" method="post">
- <label class="Comic">Email: </label><input type="text" name="email" id="email" size="40" />
- <br>
- <br>
- <center>
- <?php
- echo recaptcha_get_html($publickey); //Showing Captcha
- ?>
- </center>
- <div style="width:250px; text-align:left;">
- <center> <input type="submit" value="Submit" />
- </center>
- </div>
- </form>
- <p>
- <?
- }
- ?>
- </p>
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
- </body>
- </center>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement