/[webwml]/newmaint/gpgplace.wml
ViewVC logotype

Contents of /newmaint/gpgplace.wml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide annotations) (download)
Sun Jul 15 13:40:25 2001 UTC (11 years, 10 months ago) by tbm
Branch: MAIN
Changes since 1.11: +51 -34 lines
put stuff in function, fix year/month/day
1 tbm 1.1 <?
2     session_start();
3     include("gpgconfig.inc");
4     include("common.inc");
5     include("gpgcommon.inc");
6    
7     ?>
8     #use wml::gpgpage title="GPG Signing Coordination - Your profile"
9     <?
10     if (!session_is_registered("s_username")) {
11     ?>
12     <STRONG>
13     You should not be here!</STRONG>
14 tbm 1.11 <?
15     return FALSE;
16     } else {
17 tbm 1.1 session_register("s_username");
18     }
19     ?>
20    
21     <?
22     if (! ($db = open_db())) {
23     echo "<P>Cannot open database.</P>";
24     return FALSE;
25     }
26    
27     $sql = "SELECT id FROM people WHERE email = '$s_username'";
28     if (! ($result = pg_exec($db, $sql))) {
29     echo "Problem with query", pg_ErrorMessage($db), "<BR>";
30     return FALSE;
31     }
32     if (pg_NumRows($result) != 1) {
33     echo "That e-mail address is wicked.";
34     return FALSE;
35     }
36     $row = pg_Fetch_Array($result, 0);
37     $who = $row["id"];
38    
39    
40     # begin, finish
41    
42     # city, country
43    
44    
45     # modify an entry (if $id exists), or add a new one)
46     if ($id) {
47     $sql = "SELECT begin, finish, city, country FROM places WHERE id = '$id'";
48     if (! ($result = pg_exec($db, $sql))) {
49     echo "Problem with query", pg_ErrorMessage($db), "<BR>";
50     return FALSE;
51     }
52    
53     if (pg_NumRows($result) != 1) {
54     echo "Not enough or too many results. That should not happen.";
55     return FALSE;
56     }
57    
58     $row = pg_Fetch_Array($result, 0);
59     $begin = $row["begin"];
60     $finish = $row["finish"];
61     $city = $row["city"];
62     $country = $row["country"];
63     } else {
64 tbm 1.2 $begin = $finish = "";
65     $city = $country = "";
66 tbm 1.1 }
67 tbm 1.2
68 tbm 1.1 ?>
69 tbm 1.2
70     <div align="center">
71     <TABLE summary="">
72     <FORM method="post" action="gpgregister.php">
73 tbm 1.4
74    
75     <?
76    
77 tbm 1.12 function print_date($title, $name, $date) {
78    
79     parsed_date = split("-", $date);
80     $year = parsed_date[0];
81     $month = parsed_date[1];
82     $day = parsed_date[2];
83    
84     echo "<TR><TD>$title</TD><TD><SELECT name = \";
85     echo $name;
86     echo "_year\">";
87    
88     $years = array("2001", "2002", "2003", "always");
89     foreach ($years as $i) {
90     echo "<OPTION";
91     if ($year == $i || (!year && $i == "always")) {
92     echo " SELECTED";
93     }
94     echo ">$i\n";
95 tbm 1.4 }
96    
97 tbm 1.12 echo "</SELECT></TD>";
98     echo "<TD><SELECT name = \"";
99     echo $name;
100     echo "_month\">";
101    
102     $months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
103     $counter = 1;
104     foreach ($months as $i) {
105     echo "<OPTION value=$counter";
106     if ($month == $counter) {
107     echo " SELECTED";
108     }
109     echo ">$i\n";
110     $counter = $counter + 1;
111 tbm 1.4 }
112    
113 tbm 1.12 echo "</SELECT></TD>";
114     echo "<TD><SELECT name = \";
115     echo $name;
116     echo "_day\">";
117    
118     for ($i = 1; $i < 32; $i++) {
119     echo "<OPTION";
120     if ($day == $i) {
121     echo " SELECTED";
122     }
123     echo ">$i\n";
124     }
125     echo "</SELECT></TD>";
126     echo "</TR>";
127     echo "\n";
128 tbm 1.6 ?>
129 tbm 1.7
130 tbm 1.9 <?
131 tbm 1.12
132     print_date("Begin", "begin", $begin);
133     print_date("End", "end", $finish);
134    
135 tbm 1.9 ?>
136    
137 tbm 1.4
138 tbm 1.3 <TR><TD><B>City</B></TD><TD><INPUT name = "city" type = "text" value="<? echo $city ?>"></TD></TR>
139     <TR><TD><B>Country</B></TD><TD><INPUT name = "country" type = "text" value="<? echo $country ?>"></TD></TR>
140 tbm 1.2 </FORM>
141     </TD>
142     </TR>
143     </TABLE>
144 tbm 1.1

  ViewVC Help
Powered by ViewVC 1.1.5