Move from http -> https
[clearscm.git] / maps / php / emailpassword.php
1 <?php
2 ////////////////////////////////////////////////////////////////////////////////
3 //
4 // File:        $RCSFile$
5 // Revision:    $Revision: 1.1 $
6 // Description: Email's password to user who forgot
7 // Author:      Andrew@DeFaria.com
8 // Created:     Fri Nov 29 14:17:21  2002
9 // Modified:    $Date: 2013/06/12 14:05:48 $
10 // Language:    PHP
11 //
12 // (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
13 //
14 ////////////////////////////////////////////////////////////////////////////////
15 include "site-functions.php";
16 include "MAPS.php";
17
18 $next = (isset ($_GET [next])) ? $_GET[next] : 0;
19 $userid = $_REQUEST [userid];
20
21 // Connect to DB
22 OpenDB ();
23 SetContext ($userid);
24
25 // Get user information
26 $statement = "select * from user where userid=\"$userid\"";
27
28 $result = mysql_query ($statement)
29   or die ("emailpassword: SQL Query failed: " . $statement);
30
31 $row = mysql_fetch_array ($result);
32
33 $name           = $row [name];
34 $email          = $row [email];
35 $password       = $row [password];
36 $subject        = "Your MAPS Password";
37
38 // Decode password 
39 $statement = "select decode(\"$password\",\"$userid\")";
40
41 $result = mysql_query ($statement);
42
43 $row = mysql_fetch_array ($result, MYSQL_NUM);
44
45 $decoded_password = $row [0];
46
47 // Compose email
48 $message = "
49 <html>
50 <head>
51  <title>Your MAPS Password</title>
52 </head>
53 <body>
54 <p>Your MAPS Password is $decoded_password</p>
55
56 <p>Click <a href=https://defaria.com/maps>here</a> to login to MAPS.
57 </body>
58 </html>
59 ";
60
61 /* To send HTML mail, you can set the Content-type header. */
62 $headers  = "MIME-Version: 1.0\r\n";
63 $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
64
65 /* additional headers */
66 $headers .= "To: $email\r\n";
67 $headers .= "From: MAPS <MAPS@defaria.com>\r\n";
68
69 /* and now mail it */
70 $mailed = mail($to, $subject, $message, $headers);
71 ?>
72 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
73 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
74 <head>
75   <title>MAPS: Password Retrieval</title>
76   <?php MAPSHeader ()?>
77 </head>
78 <body>
79
80 <div class="heading">
81   <h2 class="header" align="center">
82   <font class="standout">MAPS</font> Password Retrieval</h2>
83 </div>
84
85 <div class="content">
86   <?php NavigationBar ("")?>
87
88   <p>Your password has been emailed to <?php echo $email?></p>
89
90   <?php copyright (2001)?>
91
92 </body>
93 </html>