source code taken from cacert-20100204.tar.bz2
[cacert.git] / cacert / pages / account / 13.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ ?>
18 <?
19 $query = "select * from `users` where `id`='".intval($_SESSION['profile']['id'])."' and `users`.`deleted`=0";
20 $res = mysql_query($query);
21 $user = mysql_fetch_assoc($res);
22
23 $year = intval(substr($user['dob'], 0, 4));
24 $month = intval(substr($user['dob'], 5, 2));
25 $day = intval(substr($user['dob'], 8, 2));
26
27 $body = sprintf(_("Hi %s,"),$user['fname'])."\n\n";
28 $body .= _("You receive this automatic mail since you yourself or")."\n";
29 $body .= _("someone else looked up your secret questions and answers")."\n";
30 $body .= _("for a forgotten password.")."\n\n";
31 $body .= _("If it was you who looked up or changed that data, or clicked")."\n";
32 $body .= _("through the menu in your account, everything is in best order and")."\n";
33 $body .= _("you can ignore this mail.")."\n\n";
34 $body .= _("But if you received this mail without a recognisable reason,")."\n";
35 $body .= _("there is a danger that an unauthorised person accessed your")."\n";
36 $body .= _("account, and you should promptly change your password and your")."\n";
37 $body .= _("secret questions and answers.")."\n\n";
38
39 $body .= _("With kind regards,")."\n\n"._("CAcert Support");
40
41 sendmail($user['email'], "[CAcert.org] "._("Email Notification"), $body, "support@cacert.org", "", "", "CAcert Support");
42 ?>
43 <form method="post" action="account.php">
44 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="400">
45 <tr>
46 <td colspan="2" class="title"><?=_("My Details")?></td>
47 </tr>
48 <? if($_SESSION['profile']['points'] == 0) { ?>
49 <tr>
50 <td class="DataTD" width="125"><?=_("First Name")?>: </td>
51 <td class="DataTD" width="125"><input type="text" name="fname" value="<?=$user['fname']?>"></td>
52 </tr>
53 <tr>
54 <td class="DataTD" valign="top"><?=_("Middle Name(s)")?><br>
55 (<?=_("optional")?>)
56 </td>
57 <td class="DataTD"><input type="text" name="mname" value="<?=$user['mname']?>"></td>
58 </tr>
59 <tr>
60 <td class="DataTD"><?=_("Last Name")?>: </td>
61 <td class="DataTD"><input type="text" name="lname" value="<?=$user['lname']?>"></td>
62 </tr>
63 <tr>
64 <td class="DataTD"><?=_("Suffix")?><br>
65 (<?=_("optional")?>)</td>
66 <td class="DataTD"><input type="text" name="suffix" value="<?=$user['suffix']?>"></td>
67 </tr>
68 <tr>
69 <td class="DataTD"><?=_("Date of Birth")?><br>
70 (<?=_("dd/mm/yyyy")?>)</td>
71 <td class="DataTD"><nobr><select name="day">
72 <?
73 for($i = 1; $i <= 31; $i++)
74 {
75 echo "<option";
76 if($day == $i)
77 echo " selected='selected'";
78 echo ">$i</option>";
79 }
80 ?>
81 </select>
82 <select name="month">
83 <?
84 for($i = 1; $i <= 12; $i++)
85 {
86 echo "<option value='$i'";
87 if($month == $i)
88 echo " selected='selected'";
89 echo ">".ucwords(recode("utf-8..html", strftime("%B", mktime(0,0,0,$i,1,date("Y")))))."</option>";
90 }
91 ?>
92 </select>
93 <input type="text" name="year" value="<?=$year?>" size="4"></nobr>
94 </td>
95 </tr>
96 <? } else { ?>
97 <tr>
98 <td class="DataTD" width="125"><?=_("First Name")?>: </td>
99 <td class="DataTD" width="125"><?=$user['fname']?></td>
100 </tr>
101 <tr>
102 <td class="DataTD" valign="top"><?=_("Middle Name(s)")?><br>
103 (<?=_("optional")?>)
104 </td>
105 <td class="DataTD"><?=$user['mname']?></td>
106 </tr>
107 <tr>
108 <td class="DataTD"><?=_("Last Name")?>: </td>
109 <td class="DataTD"><?=$user['lname']?></td>
110 </tr>
111 <tr>
112 <td class="DataTD"><?=_("Suffix")?><br>
113 (<?=_("optional")?>)</td>
114 <td class="DataTD"><?=$user['suffix']?></td>
115 </tr>
116 <tr>
117 <td class="DataTD"><?=_("Date of Birth")?><br>
118 (<?=_("dd/mm/yyyy")?>)</td>
119 <td class="DataTD"><?=$day?> <?=ucwords(recode("utf-8..html", strftime("%B", mktime(0,0,0,$month,1,1))))?> <?=$year?></td>
120 </tr>
121 <? } ?>
122 <tr>
123 <td class="DataTD"><?=_("OTP Hash")?><br>
124 (<?=_("Not displayed")?>)</td>
125 <td class="DataTD"><input type="text" name="otphash"></td>
126 </tr>
127 <tr>
128 <td class="DataTD"><?=_("OTP PIN")?><br>
129 (<?=_("Not displayed")?>)</td>
130 <td class="DataTD"><input type="text" name="otppin"></td>
131 </tr>
132 <tr>
133 <td class="DataTD" colspan="2"><?=_("Lost Pass Phrase Questions")?></td>
134 </tr>
135 <tr>
136 <td class="DataTD">1)&nbsp;<input type="text" name="Q1" size="15" value="<?=sanitizeHTML($user['Q1'])?>"></td>
137 <td class="DataTD"><input type="text" name="A1" value="<?=sanitizeHTML($user['A1'])?>"></td>
138 </tr>
139 <tr>
140 <td class="DataTD">2)&nbsp;<input type="text" name="Q2" size="15" value="<?=sanitizeHTML($user['Q2'])?>"></td>
141 <td class="DataTD"><input type="text" name="A2" value="<?=sanitizeHTML($user['A2'])?>"></td>
142 </tr>
143 <tr>
144 <td class="DataTD">3)&nbsp;<input type="text" name="Q3" size="15" value="<?=sanitizeHTML($user['Q3'])?>"></td>
145 <td class="DataTD"><input type="text" name="A3" value="<?=sanitizeHTML($user['A3'])?>"></td>
146 </tr>
147 <tr>
148 <td class="DataTD">4)&nbsp;<input type="text" name="Q4" size="15" value="<?=sanitizeHTML($user['Q4'])?>"></td>
149 <td class="DataTD"><input type="text" name="A4" value="<?=sanitizeHTML($user['A4'])?>"></td>
150 </tr>
151 <tr>
152 <td class="DataTD">5)&nbsp;<input type="text" name="Q5" size="15" value="<?=sanitizeHTML($user['Q5'])?>"></td>
153 <td class="DataTD"><input type="text" name="A5" value="<?=sanitizeHTML($user['A5'])?>"></td>
154 </tr>
155 <tr>
156 <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Update")?>"></td>
157 </tr>
158 </table>
159 <input type="hidden" name="csrf" value="<?=make_csrf('perschange')?>" />
160 <input type="hidden" name="oldid" value="<?=$id?>">
161 </form>