Popular Vulnerable Code

Three DaysThree Days

For three days after death,hair and fingernails continue to grow but phone calls taper off.
- Johnny Carson

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
$user_login = $HTTP_POST_VARS['user_login'];
$pass1 = $HTTP_POST_VARS['pass1'];
$pass2 = $HTTP_POST_VARS['pass2'];
$user_email = $HTTP_POST_VARS['user_email'];


if ($user_login == '') {
die ('<strong>ERROR</strong>:Please enter a login.');
}


if ($pass1 == '' || $pass2 == '') {
die ('<strong>ERROR</strong>:Please enter your password twice.');
}


if ($pass1 != $pass2)    {
die ('<strong>ERROR</strong>:Please type the same password in the two password fields.');
}
$user_nickname = $user_login;


if ($user_email == '') {
die ('<strong>ERROR</strong>:Please type your e-mail address.');
} else if (!is_email($user_email)) {
die ('<strong>ERROR</strong>:The email address isn\'t correct.');
}


$result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
if (count($result) >= 1) {
die ('<strong>ERROR</strong>:This login is already registered,please choose another one.');
}

$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'] ;
$user_domain = gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR'] );
$user_browser = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];

$user_login = addslashes($user_login);
$pass1 = addslashes($pass1);
$user_nickname = addslashes($user_nickname);
$now = current_time('mysql');

$result = $wpdb->query("INSERT INTO $tableusers
(user_login,user_pass,user_nickname,user_email,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode)
VALUES
('$user_login','$pass1','$user_nickname','$user_email','$user_ip','$user_domain','$user_browser','$now','$new_users_can_blog','nickname')"
);

if ($result == false) {
die ('<strong>ERROR</strong>:Couldn\'t register you... please contact the <a href="mailto:'.$admin_email.'">webmaster</a>!');
}

$stars = '';
for ($i = 0; $i < strlen($pass1); $i = $i + 1) {
$stars .= '*';
}

$message  = "New user registration on your blog $blogname:\r\n\r\n";
$message .= "Login:$user_login\r\n\r\nE-mail:$user_email";

@mail($admin_email, "[$blogname] New User Registration", $message);
If you enjoyed this post,make sure you subscribe to my RSS feed!

2 comments to Three Days

Leave a Reply

  

  

  

You can use these HTML tags

<a href=""title=""><abbr title=""><acronym title=""><b><blockquote cite=""><cite><code><del datetime=""><em><i><q cite=""><strike><strong><pre lang=""line=""escaped=""highlight="">