LAYOUT: address game by session.gamenr
[e-DoKo.git] / register.php
1 <?php
2 error_reporting(E_ALL);
3
4 include_once("config.php");      
5 include_once("output.php");      /* html output only */
6 include_once("db.php");          /* database only */
7 include_once("functions.php");   /* the rest */
8
9 config_check();
10
11 if(DB_open()<0)
12   {
13     output_header();
14     echo "Database error, can't connect... Please wait a while and try again. ".
15       "If the problem doesn't go away feel free to contact $ADMIN_NAME at $ADMIN_EMAIL.";
16     output_footer(); 
17     exit(); 
18   }
19
20
21 /* done major error checking, output header of HTML page */
22 output_header();
23
24 /* new user wants to register */
25 if(myisset("Rfullname","Remail","Rpassword","Rtimezone") )
26   {
27     $ok=1;
28     if(DB_get_userid_by_name($_REQUEST["Rfullname"]))
29       {
30         echo "please chose another name<br />";
31         $ok=0;
32       }
33     if(DB_get_userid_by_email($_REQUEST["Remail"]))
34       {
35         echo "this email address is already used ?!<br />";
36         $ok=0;
37       }
38     if($ok)
39       {
40         $r=mysql_query("INSERT INTO User VALUES(NULL,".DB_quote_smart($_REQUEST["Rfullname"]).
41                        ",".DB_quote_smart($_REQUEST["Remail"]).
42                        ",".DB_quote_smart(md5($_REQUEST["Rpassword"])).
43                        ",".DB_quote_smart($_REQUEST["Rtimezone"]).",NULL)"); 
44         
45         if($r)
46           echo " Welcome to e-DoKo, you are now registered, please visit the".
47             " <a href=\"$host\">homepage</a> to continue.";
48         else
49           echo " something went wrong, couldn't add you to the database, please contact $ADMIN_NAME at $ADMIN_EMAIL.";
50       }
51    }
52 /* page for registration */
53  else
54    {
55      echo "IMPORTANT: passwords are going over the net as clear text, so pick an easy password. No need to pick anything complicated here ;)<br /><br />";
56      ?>
57         <form action="register.php" method="post">
58           <fieldset>
59             <legend>Register</legend>
60              <table>
61               <tr>
62                <td><label for="Rfullname">Full name:</label></td>
63                <td><input type="text" id="Rfullname" name="Rfullname" size="20" maxsize="30" /> </td>
64               </tr><tr>
65                <td><label for="Remail">Email:</label></td>
66                <td><input type="text" id="Remail" name="Remail" size="20" maxsize="30" /></td>
67               </tr><tr>
68                <td><label for="Rpassword">Password(will be displayed in cleartext on the next page):</label></td>
69                <td><input type="password" id="Rpassword" name="Rpassword" size="20" maxsize="30" /></td>
70               </tr><tr>
71                <td><label for="Rtimezone">Timezone:</label></td>
72                <td>
73                   <select id="Rtimezone" name="Rtimezone" size="1">
74                      <option value="1">Berlin</option>
75                      <option value="-8">Berkeley</option>
76                      <option value="13">Wellington</option>
77                   </select>
78                  (If your timezone is not listed, just select whatever you want and email the admin your correct time zone.)
79                </td>
80               </tr><tr>
81                <td colspan="2"> <input type="submit" value="register" /></td>
82              </table>
83           </fieldset>
84         </form>
85 <?php
86    }
87
88 output_footer();
89
90 DB_close();
91
92 /*
93  *Local Variables: 
94  *mode: php
95  *mode: hs-minor
96  *End:
97  */
98 ?>