colonymech / docs / www / colonyscout / internal / admin / do_addmember.php @ f59acf11
History | View | Annotate | Download (6.21 KB)
1 |
<?php
|
---|---|
2 |
include($_SERVER['DOCUMENT_ROOT']."/control/do_login.php"); |
3 |
doDB("dshope_robotics");
|
4 |
|
5 |
|
6 |
$userName = addslashes($_POST["user"]); |
7 |
$emailAddress = addslashes($_POST["email"]); |
8 |
|
9 |
if (!isset($_POST["bypass"])){ |
10 |
//perform validation
|
11 |
|
12 |
//check if email is in use
|
13 |
$verify_email_sql = "SELECT id FROM members WHERE email = '".$emailAddress."'"; |
14 |
$verify_email_res = mysqli_query($mysqli, $verify_email_sql) or die(mysqli_error($mysqli)); |
15 |
|
16 |
if (mysqli_num_rows($verify_email_res) > 0) { |
17 |
//this email address is already registered, so take to error page
|
18 |
|
19 |
header("Location: inuse.php?t=email"); |
20 |
exit;
|
21 |
} |
22 |
|
23 |
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
24 |
//check if username is already in use
|
25 |
$verify_account_sql = "SELECT id FROM members WHERE userName = '".$userName."'"; |
26 |
$verify_account_res = mysqli_query($mysqli, $verify_account_sql) or die(mysqli_error($mysqli)); |
27 |
|
28 |
if (mysqli_num_rows($verify_account_res) > 0) { |
29 |
//this username address is already registered, so take to error page
|
30 |
|
31 |
header("Location: inuse.php?t=user"); |
32 |
exit;
|
33 |
} |
34 |
} |
35 |
|
36 |
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
37 |
//this step only occurs AFTER we know that this username is not in use...
|
38 |
//unless the checking step was bypassed by the re-registration form...
|
39 |
|
40 |
$userPass = addslashes($_POST["pass"]); |
41 |
|
42 |
//get the users full name
|
43 |
$realName = addslashes($_POST["name"]); |
44 |
$name = str_replace(' ', ' ', $realName); |
45 |
$realNameList = explode(' ',$name); |
46 |
|
47 |
$lastName = end($realNameList); |
48 |
unset($realNameList[sizeof($realNameList)-1]); |
49 |
|
50 |
$firstName = ""; |
51 |
foreach ($realNameList as $nameItem) { //rebuild the full first name |
52 |
$firstName .= $nameItem." "; |
53 |
} |
54 |
|
55 |
$userString = str_replace(', ', ',', $userName); //take out extraneous spaces, leave good ones intact |
56 |
$userDashed = str_replace(' ', '-', $userString); //any spaces remaining (within phrases) should be replaced with dashes |
57 |
|
58 |
$today = date("Y-m-d"); |
59 |
$regcode = md5($realName.$emailAddress.$userName.$today); |
60 |
|
61 |
//add record into members database
|
62 |
$add_member_sql = "INSERT INTO members(FirstName, LastName, userName, Password, Email, Validated, ValidDate, DateAdded) VALUES ('".$firstName."','".$lastName."','".$userName."',password('".$userPass."'),'".$emailAddress."', '".$regcode."', (SELECT DATE_ADD(now(), INTERVAL 2 DAY)), now())"; |
63 |
$add_member_res = mysqli_query($mysqli, $add_member_sql) or die(mysqli_error($mysqli)); |
64 |
|
65 |
//close connection to MySQL
|
66 |
mysqli_close($mysqli);
|
67 |
|
68 |
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
69 |
//send validation email
|
70 |
$headers = "From: registration@danshope.com\r\nContent-type: text/html"; |
71 |
|
72 |
$body = "<HTML><BODY><CENTER> |
73 |
<TABLE BORDER='0'>
|
74 |
<TR><TD align='left'><IMG SRC='http://danshope.com/rsc/signup.jpg'><br><br></TD></TR>
|
75 |
<TR><TD align='left' STYLE='font-family:arial;'><B>Welcome to DanShope.com!</B><br><br>
|
76 |
Hi ".$userName."! We're glad you decided to become a member of the DanShope.com robotics family!<br> |
77 |
As a member you are entitled to <b>50MB</b> online hosting for your projects. You also get your own message box for project communication, and a sweet project homepage!<br><br>
|
78 |
In order to complete your membership, you must click on the confirmation link below, or copy it into your web browser.<br><br>
|
79 |
<a href='http://www.danshope.com/confirm/".$regcode."'>http://www.danshope.com/confirm/".$regcode."</a><br><br> |
80 |
The link below is your unique url to the site. Send this url to
|
81 |
everyone you know so they can see what you've been working on.<br>
|
82 |
<br>
|
83 |
Your URL: http://www.danshope.com/user/".$userDashed."<br> |
84 |
<br>
|
85 |
To make the most of your DanShope.com experience complete the following:<br>
|
86 |
<br>
|
87 |
- Start a project<br>
|
88 |
- Upload any projects you've already started<br>
|
89 |
- Search and download anything that interests you<br>
|
90 |
<br>
|
91 |
-------------------------------------------------------------------------<br>
|
92 |
Email : ".$emailAddress."<br> |
93 |
User Name : ".$userName."<br> |
94 |
-------------------------------------------------------------------------<br><br>
|
95 |
<b>Thanks for joining!</b><br><br></TD></TR>
|
96 |
<tr><td STYLE='font-family:arial; font-size:12px;'>DanShope.com takes our users' privacy very seriously. This communication, together with any attachments hereto, may contain confidential information. If you have received this communication in error,
|
97 |
please notify the sender immediately by return e-mail message and delete all copies of the original communication, along with any attachments hereto or links herein, from your system.</td></tr>
|
98 |
</CENTER></BODY>
|
99 |
</HTML>";
|
100 |
|
101 |
mail($emailAddress, "DanShope.com Confirmation", $body, $headers); |
102 |
|
103 |
?>
|
104 |
|
105 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
106 |
<html><head> |
107 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
108 |
<link href="/rsc/main-style.css" rel="stylesheet" type="text/css" media="screen"> |
109 |
<link href="/rsc/robo-style.css" rel="stylesheet" type="text/css" media="screen"> |
110 |
<title>Join! | danshope.com</title> |
111 |
|
112 |
</head><body> |
113 |
|
114 |
<div id="general"> |
115 |
|
116 |
<?php
|
117 |
include($_SERVER['DOCUMENT_ROOT']."/nav.php"); |
118 |
?>
|
119 |
|
120 |
<div id="body"> |
121 |
<div class="border-splash"></div> |
122 |
<?php
|
123 |
include($_SERVER['DOCUMENT_ROOT']."/splashtop.php"); |
124 |
?>
|
125 |
<div id="body-boxes"> |
126 |
<div id="box-inside"> |
127 |
<div id="box-padded"> |
128 |
<div id="row"><br> |
129 |
<span id="dkbluelargetext"><center>Congratulations <?php echo $realName; ?>!<br><br> |
130 |
You are just one step away from officially joining the <br>
|
131 |
DanShope.com robotics community. |
132 |
</center><br> |
133 |
|
134 |
<hr class="GraySolid" width="100%"><br> |
135 |
<img style="display: block;" src="/rsc/join-robo-splash-2.jpg"> |
136 |
<hr class="GraySolid" width="100%"><br><br> |
137 |
|
138 |
All you have to do now is check your email (<?php echo $emailAddress; ?>) |
139 |
and click on the confirmation link so we know YOU aren't a robot!<br><br> |
140 |
<center>Thanks for Joining</center></span><br><br> |
141 |
</div>
|
142 |
</div>
|
143 |
<div>
|
144 |
</div>
|
145 |
</div>
|
146 |
|
147 |
|
148 |
|
149 |
<?php
|
150 |
include($_SERVER['DOCUMENT_ROOT']."/footer.php"); |
151 |
?>
|
152 |
|
153 |
<script type="text/javascript"> |
154 |
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
155 |
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
156 |
</script>
|
157 |
<script type="text/javascript"> |
158 |
var pageTracker = _gat._getTracker("UA-6089041-1");
|
159 |
pageTracker._trackPageview();
|
160 |
</script>
|
161 |
|
162 |
</div><!--GENERAL!--> |
163 |
</body></html> |