ea28c0ecfa011a83b91a6437d0a7c261bfa11c0f
[cacert-devel.git] / 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 $showdetails = array_key_exists("showdetails",$_REQUEST) ? intval($_REQUEST['showdetails']) : 0;
27
28 if($showdetails){
29 $body = sprintf(_("Hi %s,"),$user['fname'])."\n\n";
30 $body .= _("You receive this automatic mail since you yourself or someone ".
31 "else looked up your secret questions and answers for a forgotten ".
32 "password.\n\n".
33 "If it was you who looked up or changed that data, or clicked ".
34 "through the menu in your account, everything is in best order ".
35 "and you can ignore this mail.\n\n".
36 "But if you received this mail without a recognisable reason, ".
37 "there is a danger that an unauthorised person accessed your ".
38 "account, and you should promptly change your password and your ".
39 "secret questions and answers.")."\n\n";
40
41 $body .= _("Best regards")."\n"._("CAcert Support");
42
43 sendmail($user['email'], "[CAcert.org] "._("Email Notification"), $body, "support@cacert.org", "", "", "CAcert Support");
44 }
45 ?>
46
47 <form method="post" action="account.php">
48 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="400">
49 <tr>
50 <td colspan="2" class="title"><?=_("My Details")?></td>
51 </tr>
52 <? if($_SESSION['profile']['points'] == 0) { ?>
53 <tr>
54 <td class="DataTD" width="125"><?=_("First Name")?>: </td>
55 <td class="DataTD" width="125"><input type="text" name="fname" value="<?=sanitizeHTML($user['fname'])?>"></td>
56 </tr>
57 <tr>
58 <td class="DataTD" valign="top"><?=_("Middle Name(s)")?><br>
59 (<?=_("optional")?>)
60 </td>
61 <td class="DataTD"><input type="text" name="mname" value="<?=sanitizeHTML($user['mname'])?>"></td>
62 </tr>
63 <tr>
64 <td class="DataTD"><?=_("Last Name")?>: </td>
65 <td class="DataTD"><input type="text" name="lname" value="<?=sanitizeHTML($user['lname'])?>"></td>
66 </tr>
67 <tr>
68 <td class="DataTD"><?=_("Suffix")?><br>
69 (<?=_("optional")?>)</td>
70 <td class="DataTD"><input type="text" name="suffix" value="<?=sanitizeHTML($user['suffix'])?>"></td>
71 </tr>
72 <tr>
73 <td class="DataTD"><?=_("Date of Birth")?><br>
74 (<?=_("dd/mm/yyyy")?>)</td>
75 <td class="DataTD"><nobr><select name="day">
76 <?
77 for($i = 1; $i <= 31; $i++)
78 {
79 echo "<option";
80 if($day == $i)
81 echo " selected='selected'";
82 echo ">$i</option>";
83 }
84 ?>
85 </select>
86 <select name="month">
87 <?
88 for($i = 1; $i <= 12; $i++)
89 {
90 echo "<option value='$i'";
91 if($month == $i)
92 echo " selected='selected'";
93 echo ">".ucwords(recode("utf-8..html", strftime("%B", mktime(0,0,0,$i,1,date("Y")))))."</option>";
94 }
95 ?>
96 </select>
97 <input type="text" name="year" value="<?=$year?>" size="4"></nobr>
98 </td>
99 </tr>
100 <? } else { ?>
101 <tr>
102 <td class="DataTD" width="125"><?=_("First Name")?>: </td>
103 <td class="DataTD" width="125"><?=sanitizeHTML($user['fname'])?></td>
104 </tr>
105 <tr>
106 <td class="DataTD" valign="top"><?=_("Middle Name(s)")?><br>
107 (<?=_("optional")?>)
108 </td>
109 <td class="DataTD"><?=sanitizeHTML($user['mname'])?></td>
110 </tr>
111 <tr>
112 <td class="DataTD"><?=_("Last Name")?>: </td>
113 <td class="DataTD"><?=sanitizeHTML($user['lname'])?></td>
114 </tr>
115 <tr>
116 <td class="DataTD"><?=_("Suffix")?><br>
117 (<?=_("optional")?>)</td>
118 <td class="DataTD"><?=sanitizeHTML($user['suffix'])?></td>
119 </tr>
120 <tr>
121 <td class="DataTD"><?=_("Date of Birth")?><br>
122 (<?=_("dd/mm/yyyy")?>)</td>
123 <td class="DataTD"><?=$day?> <?=ucwords(recode("utf-8..html", strftime("%B", mktime(0,0,0,$month,1,1))))?> <?=$year?></td>
124 </tr>
125 <? } ?>
126 <tr>
127 <td colspan="2" class="title"><a href="account.php?id=59&amp;oldid=13&amp;userid=<?=intval($_SESSION['profile']['id'])?>"><?=_('Show account history')?></a></td>
128 </tr>
129 <tr>
130 <td colspan="2" class="title"><a href="account.php?id=13&amp;showdetails=<?=intval(!$showdetails)?>"><?=_("View secret question & answers")?></a></td>
131 </tr>
132 <? if($showdetails){ ?>
133 <tr>
134 <td class="DataTD" colspan="2"><?=_("Lost Pass Phrase Questions")?></td>
135 </tr>
136 <tr>
137 <td class="DataTD">1)&nbsp;<input type="text" name="Q1" size="15" value="<?=sanitizeHTML($user['Q1'])?>"></td>
138 <td class="DataTD"><input type="text" name="A1" value="<?=sanitizeHTML($user['A1'])?>"></td>
139 </tr>
140 <tr>
141 <td class="DataTD">2)&nbsp;<input type="text" name="Q2" size="15" value="<?=sanitizeHTML($user['Q2'])?>"></td>
142 <td class="DataTD"><input type="text" name="A2" value="<?=sanitizeHTML($user['A2'])?>"></td>
143 </tr>
144 <tr>
145 <td class="DataTD">3)&nbsp;<input type="text" name="Q3" size="15" value="<?=sanitizeHTML($user['Q3'])?>"></td>
146 <td class="DataTD"><input type="text" name="A3" value="<?=sanitizeHTML($user['A3'])?>"></td>
147 </tr>
148 <tr>
149 <td class="DataTD">4)&nbsp;<input type="text" name="Q4" size="15" value="<?=sanitizeHTML($user['Q4'])?>"></td>
150 <td class="DataTD"><input type="text" name="A4" value="<?=sanitizeHTML($user['A4'])?>"></td>
151 </tr>
152 <tr>
153 <td class="DataTD">5)&nbsp;<input type="text" name="Q5" size="15" value="<?=sanitizeHTML($user['Q5'])?>"></td>
154 <td class="DataTD"><input type="text" name="A5" value="<?=sanitizeHTML($user['A5'])?>"></td>
155 </tr>
156 <tr>
157 <input type="hidden" name="showdetails" value="1" />
158 <? } ?>
159 <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Update")?>"></td>
160 </tr>
161 </table>
162 <input type="hidden" name="csrf" value="<?=make_csrf('perschange')?>" />
163 <input type="hidden" name="oldid" value="<?=intval($id)?>">
164 </form>