1 |
<HTML> |
2 |
<HEAD> |
3 |
<TITLE>Stock Monitor: Registration</TITLE> |
4 |
<STYLE type="text/css"> |
5 |
<?php include("stylesheet.css")?> |
6 |
</STYLE> |
7 |
</HEAD> |
8 |
<BODY> |
9 |
<H1><A href="/">stock.andrew.net.au</A> | Registration</H1> |
10 |
<?php if (!isset($submit)) { ?> |
11 |
<FORM method=post> |
12 |
<TABLE> |
13 |
<TR> |
14 |
<TD>First name</TD><TD><INPUT type=text name="firstname" size=15 maxlength=15></TD> |
15 |
</TR> |
16 |
<TR> |
17 |
<TD>Last name</TD><TD><INPUT type=text name="lastname" size=15 maxlength=15></TD> |
18 |
</TR> |
19 |
<TR> |
20 |
<TD>Email address</TD><TD><INPUT type=text name="email" size=25 maxlength=50></TD> |
21 |
</TR> |
22 |
</TABLE> |
23 |
<INPUT type=submit name=submit value="Submit registration"> <INPUT type=reset value="Clear form"> |
24 |
</FORM> |
25 |
<?php } else { |
26 |
include_once("inc/GetUserId.inc"); |
27 |
include_once("inc/ppassgen.inc"); |
28 |
include_once("inc/AddUser.inc"); |
29 |
|
30 |
if (empty($firstname)) { |
31 |
echo "No first name entered"; |
32 |
} else if (empty($lastname)) { |
33 |
echo "No last name entered"; |
34 |
} else if (empty($email)) { |
35 |
echo "No email address entered"; |
36 |
} else { |
37 |
$username = strtolower(substr($firstname, 0, 1) . $lastname); |
38 |
$password = ppassgen("/var/www/stock/mywords",1,1,1); |
39 |
if (getUserId($username)) { |
40 |
$username .= "2"; |
41 |
} |
42 |
if (AddUser($username, $password)) { |
43 |
?>Thank you for registering for a login. Your username will be <B><?php echo $username?></B> and your password will be emailed to <B><?php echo $email?></B> shortly |
44 |
<?php |
45 |
$body = "Dear $firstname,\n\n"; |
46 |
$body .= "Thankyou for registering to use the stock.andrew.net.au website\n\n"; |
47 |
$body .= "Username: $username\n"; |
48 |
$body .= "Password: $password\n\n"; |
49 |
$body .= "You can start using the site straight away by going to http://stock.andrew.net.au\n\n"; |
50 |
$body .= "Regards,\n\n"; |
51 |
$body .= "Andrew"; |
52 |
|
53 |
mail("$email ($firstname $lastname)", "stock.andrew.net.au registration", $body, "From: andrew@andrew.net.au (Andrew Pollock)\nBcc: andrew@andrew.net.au", "-f andrew@andrew.net.au"); |
54 |
} else { |
55 |
echo "There was some hideous problem creating your user account"; |
56 |
} |
57 |
} |
58 |
|
59 |
} ?> |
60 |
</BODY> |
61 |
</HTML> |