185 |
|
|
186 |
$loc_db->query($sql); |
$loc_db->query($sql); |
187 |
|
|
188 |
|
email_user_confirm($username); |
189 |
|
|
190 |
return true; |
return true; |
191 |
|
|
192 |
} |
} |
193 |
|
|
194 |
|
function email_user_confirm($username) { |
195 |
|
|
196 |
|
GLOBAL $opt_maintainer_email; |
197 |
|
GLOBAL $opt_server; |
198 |
|
GLOBAL $opt_loc_path; |
199 |
|
|
200 |
|
// create a new DB class |
201 |
|
$loc_db = new locDatabase; |
202 |
|
|
203 |
|
$sql = "SELECT * from users where username='$username'"; |
204 |
|
|
205 |
|
$loc_db->query("sql"); |
206 |
|
|
207 |
|
$loc_db->next_record(); |
208 |
|
|
209 |
|
$to = $loc_db->f("email"); |
210 |
|
$subject = "[locfinder] User Confirmation"; |
211 |
|
$headers = "From: " . $opt_maintainer_email . "\r\nX-Mailer: PHP/" . phpversion(); |
212 |
|
$message = "Hi" . $loc_db->f("name") . "\r\n\r\nThankyou for registering as a user with locfinder - to complete your registration, all you need to do is click on the link below.\r\n\r\nBest of luck getting your node active!\r\n\r\nhttp:\\" . $opt_server . $opt_loc_path . "index.php?action=confirm&username=" . $username . "&hash=" . $loc_db->f("password"); |
213 |
|
|
214 |
|
mail($to, $subject, $message, $headers); |
215 |
|
|
216 |
|
} |
217 |
|
|
218 |
|
function user_confirm($username, $hash) { |
219 |
|
|
220 |
|
//create a new DB class |
221 |
|
$loc_db = new locDatabase; |
222 |
|
|
223 |
|
$sql = "SELECT password from users where username='$username'"; |
224 |
|
|
225 |
|
$loc_db->query($sql); |
226 |
|
|
227 |
|
$loc_db->next_record(); |
228 |
|
|
229 |
|
if ($loc_db->f("password") == $hash) { |
230 |
|
|
231 |
|
$sql = "UPDATE users set confirm=1 WHERE username='$username'"; |
232 |
|
|
233 |
|
$loc_db->query($sql); |
234 |
|
|
235 |
|
} else { |
236 |
|
|
237 |
|
header("location:http://" . $opt_server . $opt_loc_path . "index.php?page=front"); |
238 |
|
|
239 |
|
} |
240 |
|
|
241 |
|
} |
242 |
?> |
?> |