-
Notifications
You must be signed in to change notification settings - Fork 2
/
r.php
94 lines (86 loc) · 2.68 KB
/
r.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
include('config.php');
include('db.php');
include('common.php');
include('mollom.php');
sm_init_db();
if ($_POST['name']) {
// It's an account request.
// captcha check.
session_start();
if ($_COOKIE['sm_not_old'] == 'yes') {
sm_raise_err("You are not old enough. You must be 13+.");
sm_die();
}
if ($_SESSION['vercode']) {// == $_POST['human']) {
// Clean $_POST's dirty hands
// But save $_POST['mail'] for mail()
$uma = $_POST['mail'];
sm_germ-x($_POST);
// Get the current date.
// Users have to be 13+.
$regday = date("d");
$regmon = date("m");
$regyea = date("Y");
$uday = intval($_POST['bdayd']);
$umon = intval($_POST['bdaym']);
$uyea = intval($_POST['bdayy']);
// Estimate age
$uage = $regyea - $uyea;
if ($umon == $regmon) {
// We still need to verify the age fully, because we don't want 12-years
// on social networks before they're 13!
if ($uday >= $regday) {
$uage++;
}
} else {
if ($umon > $regmon) {
$uage++;
}
}
// Check age
if ($uage < 13) {
// In days, when can the user come back?
if ($uage == 12) {
$can_be_back = $umon - $regmon;
$can_be_back *= 60;
} else {
$can_be_back = 13 - $uage;
$can_be_back *= 365;
}
sm_raise_err("You are not 13 years of age or older. Come back soon!");
setcookie('sm_not_old', 'yes', time()+60*60*24*$can_be_back);
sm_die();
}
// Gender? WEE NEED NO STINKIN' GENDER!
// No... wait! SocialMe is gender netural!
// It's multisex enabled!
// Hash password
$hashed_pass = sha256($_POST['pass'] . $sm_secret);
$sql_values = "('" . $_POST['name'] . "', '" . $_POST['mail'] . "', " . $uage . ", '" . $hashed_pass . ")";
$sql_query = "INSERT INTO accounts VALUES " . $sql_values;
sm_db_exec($sql_query);
// The user MUST verify their mail
$veracccode = md5(sha1(crc32(mt_rand() + time())));
$_SESSION['veracccode'] = $veracccode;
mail($uma, "Verify your " . $sm_name . "account", "Your " . $sm_name . " account needs verification. Your code is " . $veracccode . ". Return to the verification page and enter the code in.", "From: " . $sm_mail);
header("Location: /v.php?ac_stamp=" . time());
} else {
sm_raise_err("The CAPTCHA was wrong! Sign up again and enter it correctly!");
sm_die();
}
}
?>
<?php print_header(); ?>
<form action="/r.php" method="POST">
Your name: <input name="name" /><br />
Your birthday: mm:<input name="umon"/>dd:<input name="uday"/>yy:<input name="uyea"/><br/>
Your password: <input type="password" name="pass"/><br/>
(Wondering about gender? We're gender-netural.)<br/>
<!--
Disabled for Mollom integration
<input name="human"/>
-->
<input type="submit" value="Hitch me up, baby!"/>
</form>
<?php print_header(); ?>