-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathreg.php
109 lines (69 loc) · 2.75 KB
/
reg.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
define( 'DVWA_WEB_PAGE_TO_ROOT', '' );
require_once DVWA_WEB_PAGE_TO_ROOT.'dvwa/includes/dvwaPage.inc.php';
dvwaPageStartup( array( 'phpids' ) );
dvwaDatabaseConnect();
dvwaGetconfig();
#dvwadebug();
if( isset( $_POST[ 'reg' ] ) ) {
$user = trim($_POST[ 'username' ]);
$user = stripslashes( $user );
$user = mysql_real_escape_string( $user );
$pass = trim($_POST[ 'password' ]);
$pass = stripslashes( $pass );
$pass = mysql_real_escape_string( $pass );
$pass_md5 = md5( $pass );
$insert_md5 = "insert into users values ('','{$user}','{$user}','{$user}','{$pass_md5}','dvwa/hackable/users/gordonb.jpg')";
if($user!='' and $pass!='' and $_POST['password']==$_POST['password2'] /*|| ($result && mysql_num_rows($result) >= 1)*/ ) { // Login Successful...
$result_md5 = @mysql_query($insert_md5) or die('<pre>' . mysql_error() . '</br>insert fail,again!!</pre>' );
dvwaRedirect('index.php');
dvwaMessagePush( "You have reg succfully for '".$user."'" );
dvwaLogin($user);
dvwaRedirect( 'login.php' );
}
// Login failed
dvwaMessagePush( "reg failed" );
dvwaRedirect( 'reg.php' );
}
$messagesHtml = messagesPopAllToHtml();
Header( 'Cache-Control: no-cache, must-revalidate'); // HTTP/1.1
Header( 'Content-Type: text/html;charset=utf-8' ); // TODO- proper XHTML headers...
Header( "Expires: Tue, 23 Jun 2009 12:00:00 GMT"); // Date in the past
echo "
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />
<title>XLABAS - REG</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"".DVWA_WEB_PAGE_TO_ROOT."dvwa/css/login.css\" />
</head>
<body>
<div align=\"center\">
<br />
<p><img src=\"".DVWA_WEB_PAGE_TO_ROOT."dvwa/images/login_logo.png\" /></p>
<br />
<form action=\"reg.php\" method=\"post\">
<fieldset>
<label for=\"user\">Username</label> <input type=\"text\" class=\"loginInput\" size=\"20\" name=\"username\"><br />
<label for=\"pass\">Password</label> <input type=\"password\" class=\"loginInput\" AUTOCOMPLETE=\"off\" size=\"20\" name=\"password\"><br />
<label for=\"pass\">Password2</label> <input type=\"password\" class=\"loginInput\" AUTOCOMPLETE=\"off\" size=\"20\" name=\"password2\"><br />
<p class=\"submit\"><input type=\"submit\" value=\"Reg\" name=\"reg\"></p>
</fieldset>
</form>
<br />
{$messagesHtml}
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<!-- <img src=\"".DVWA_WEB_PAGE_TO_ROOT."dvwa/images/RandomStorm.png\" /> -->
<p>Damn HTJC SeclabX ASystem (XlabAS) is a RandomStorm OpenSource project</p>
</div> <!-- end align div -->
</body>
</html>
";
?>