~proppy/hackit/qa

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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?php
require_once 'config/config.php';
require_once ROOT_PATH.'includes/includes.php';
require_once ROOT_PATH . 'includes/game_session_handler.php';
require_once ROOT_PATH.'includes/cookie_login.php';
require_once ROOT_PATH.'includes/address_handler.php';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="<?php echo WEB_PATH; ?>style/style.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo WEB_PATH; ?>js/jquery.modalpanel.js"></script>
<script type="text/javascript" src="<?php echo WEB_PATH; ?>js/jquery.tools.min.js"></script>
<title>HackIt</title>
<script type="text/javascript">
$(document).ready(function() {
		$('#option_trigger').click(function(ev) {
			ev.preventDefault();
			$('#options_menu').slideToggle('slow', function() {
			});
		});
		
		$('#language_trigger').click(function(ev) {
			ev.preventDefault();
			$('#langs_menu').slideToggle('slow', function() {
			});
		});
		$(".hastooltip").tooltip({
			tip:'#tooltip', 
	        effect: 'fade', 
	        fadeOutSpeed: 100, 
	        predelay: 200, 
	        position: "bottom center",
	        offset: [10,0]
		});
		
		$('#save_session').click(function(ev) {
			ev.preventDefault();
			$('#options_menu').toggle();
			$('body').modalPanel();
			$('#modal-window').load("<?php echo WEB_PATH; ?>ajax/register.php", function(response, status, xhr) {
			  if (status == "error") {
			    var msg = "Sorry but there was an error: ";
			    $('#modal-window').html(msg + xhr.status + " " + xhr.statusText);
			  }
			  if (status == 'success')
			  {
			  	$('#register').click(function() {
			  		var nickname = $('#nickname').attr('value');
			  		var email = $('#email').attr('value');
			  		$('#messages').load("<?php echo WEB_PATH; ?>ajax/register.php",{'nickname':nickname, 'email':email, 'register':'1'}, function() {
			  			$('#register_play').click(function(ev) {
							ev.preventDefault();
							document.location.reload();
					  	});
			  		});
			  	});
			  	$('#cancel').click(function() {
					var remove = function() { $(this).remove(); };
					$('#modal-overlay').fadeOut(remove);
					$('#modal-container')
						.fadeOut(remove)
						.empty();
			  	});
			  }
			});
		});
		
		
		$('#show_login').click(function(ev) {
			ev.preventDefault();
			$('#options_menu').toggle();
			$('body').modalPanel();
			$('#modal-window').load("<?php echo WEB_PATH; ?>ajax/login.php", function(response, status, xhr) {
			  if (status == "error") {
			    var msg = "Sorry but there was an error: ";
			    $('#modal-window').html(msg + xhr.status + " " + xhr.statusText);
			  }
			  if (status == 'success')
			  {			  	
			  	$('#forgot_pass').click(function(ev) {
					ev.preventDefault();
					$('#modal-window').load("<?php echo WEB_PATH; ?>ajax/forgot_password.php", function(response, status, xhr) {
					  if (status == "error") {
					    var msg = "Sorry but there was an error: ";
					    $('#modal-window').html(msg + xhr.status + " " + xhr.statusText);
					  }
					  if (status == 'success')
					  {					  	
					  	$('#send').click(function() {
					  		var email = $('#email').attr('value');
					  		$('#messages').load("<?php echo WEB_PATH; ?>ajax/forgot_password.php",{'email':email, 'send':'1'});
					  	});
					  	$('#cancel').click(function() {
							var remove = function() { $(this).remove(); };
							$('#modal-overlay').fadeOut(remove);
							$('#modal-container')
								.fadeOut(remove)
								.empty();
					  	});
					  }
					});
				});
			  	
			  	
			  	$('#login').click(function() {
			  		var password = $('#password').attr('value');
			  		var email = $('#email').attr('value');
			  		$('#messages').load("<?php echo WEB_PATH; ?>ajax/login.php",{'password':password, 'email':email, 'login':'1'}, function(response, status, xhr) {
					  if (status == "error") {
					    var msg = "Sorry but there was an error: ";
					    $('#modal-window').html(msg + xhr.status + " " + xhr.statusText);
					  }
					  if (status == "success") {
					  	if ($('#messages > div').hasClass('success'))
					  	{
					  		document.location.reload();
					  	}
					  }
			  		
			  		});
			  	});
			  	$('#cancel').click(function() {
					var remove = function() { $(this).remove(); };
					$('#modal-overlay').fadeOut(remove);
					$('#modal-container')
						.fadeOut(remove)
						.empty();
			  	});
			  }
			});
		});
		
		$('#do_logout').click(function(ev) {
			ev.preventDefault();
			$('#options_menu').toggle();
			$.get("<?php echo WEB_PATH; ?>ajax/logout.php", function(response, status, xhr) {
			  if (status == "error") {
			    alert("Sorry but there was an error: "+ xhr.status + " " + xhr.statusText);
			  }
			  if (status == 'success')
			  {
			  	document.location.reload();
			  }
			});
		});
		
		
		$('#edit_profile').click(function(ev) {
			ev.preventDefault();
			$('#options_menu').toggle();
			$('body').modalPanel();
			$('#modal-window').load("<?php echo WEB_PATH; ?>ajax/edit_profile.php", function(response, status, xhr) {
			  if (status == "error") {
			    var msg = "Sorry but there was an error: ";
			    $('#modal-window').html(msg + xhr.status + " " + xhr.statusText);
			  }
			  if (status == 'success')
			  {
			  	$('#save').click(function() {
			  		var nickname = $('#nickname').attr('value');
			  		var email = $('#email').attr('value');
			  		var password = $('#password').attr('value');
			  		var password_repeat = $('#password_repeat').attr('value');
			  		$('#messages').load("<?php echo WEB_PATH; ?>ajax/edit_profile.php",{'nickname':nickname, 'email':email, 'password':password, 'password_repeat':password_repeat, 'save':'1'}, function() {
			  			$('#profile_play').click(function(ev) {
							ev.preventDefault();
							document.location.reload();
					  	});
			  		});
			  	});
			  	$('#cancel').click(function() {
					var remove = function() { $(this).remove(); };
					$('#modal-overlay').fadeOut(remove);
					$('#modal-container')
						.fadeOut(remove)
						.empty();
			  	});
			  }
			});
		});

		
	});
</script>
</head>
<body>
<div id="toolbar">
	<div class="welcome">&nbsp;&nbsp;Welcome <?php echo ($user_id = userLoggedIn())?nicknameUser($user_id):'Guest'; ?></div>
	<div class="hackit">
		<input type="button" id="hackit" name="hackit" value="<?php echo _('Hack It!') ?>" class="hastooltip" title="<?php echo _('this is the tooltip for the hackit button')  ?>" />
	</div>
	<div class="scanit">
		<input type="button" id="scanit" name="scanit" value="<?php echo _('Scan It') ?>" />
	</div>
	<div class="chances">
		<?php printf(_('Hack: %d%% chances'),5) ?><br />
		<?php printf(_('Scan: %d%% chances'),5) ?>
	</div>
	<div class="tag hastooltip" title="<?php echo _('this is the tooltip for the type of website section');?>">
	(<?php echo _('Type of website:'); ?> <a href="#">Search</a>)
	</div>
	<div class="search">
		<input id="search" type="text" name="search" style="width:200px" />
		<input type="submit" id="go" name="go" value="Go" />
	</div>
	<div class="usage">
		<?php echo _('Hacks:'); ?> 6/6, <?php echo _('Scans:'); ?> 4/4
	</div>
	<div class="options">
		<a href="#" id="option_trigger"><?php echo _('Options'); ?></a>
	</div>
</div>
<div id="options_menu">
	<ul>
		<?php if (userLoggedIn()) { ?>
			<li><a href="#" id="edit_profile"><?php echo _('Edit Profile'); ?></a></li>
			<li><a href="#" id="do_logout"><?php echo _('Logout'); ?></a></li>
		<?php } else { ?>
			<li><a href="#" id="save_session"><?php echo _('Save session'); ?></a></li>
			<li><a href="#" id="show_login"><?php echo _('Login'); ?></a></li>
		<?php } ?>
		
		<li><a href="#"><?php echo _('Hack from Here'); ?></a></li>
		<li><a href="#"><?php echo _('Go to home'); ?></a></li>
		<li><a href="#"><?php echo _('Go to parent website'); ?></a></li>
		<li><a href="#"><?php echo _('Go to child website'); ?></a></li>
		<li style="position:relative">
			<a href="#" id="language_trigger"><?php echo _('Language'); ?></a>
			<div id="langs_menu">
				<?php 
				foreach ($supported_languages as $key=>$value) {
				?>	
				<a href="<?php echo WEB_PATH; ?>index.php?lang=<?php echo $value; ?>&page=gt/<?php echo $the_clean_page; ?>"><?php echo $key; ?></a><br />
				<?php
				}
				?>
			</div>
		</li>
		<li><a href="#"><?php echo _('Provide Feedback'); ?></a></li>
	</ul>
	
</div>

<div id="tooltip"></div>
<iframe src="<?php echo PROXY_PATH.'?u='.$encoded_address;?>" id="theframe"><?php _('Your browser does not speak iframe language'); ?></iframe>
</body>
</html>