-
1
<?php
-
2
error_reporting(0);
-
3
-
4
if (isset($_GET['ajax'])) {
-
5
switch (strtolower($_GET['ajax'])) {
-
6
case 'createaccount':
-
7
if (!strlen(trim($_POST['username']) && ($_POST['password']))) {
-
8
header('Location: ?errormessage=Username%20or%20Password%20were%20not%20entered.');
-
9
} else {
-
10
include('./lib/data/users.php');
-
11
$encryptedpass = md5($_POST['password']);
-
12
if ($_POST['username']) {}
-
13
$user_amount = count($users);
-
14
for ($i=0; $i <=$user_amount;$i++);
-
15
{
-
16
if (strtolower($_POST['username']) == strtolower($users[$i]['userName']))
-
17
$username_used = 1;
-
18
}
-
19
if (!$_POST['password'])
-
20
$password_error = 1;
-
21
if (!$username_used and !$password_error) {
-
22
$next_user = $user_amount++;
-
23
$new_user_information = '
-
24
-
25
// Created via IP '.$_SERVER["REMOTE_ADDR"].'
-
26
$users['.$next_user.'] = array();
-
27
$users['.$next_user.'][\'userRole\'] = AJAX_CHAT_USER;
-
28
$users['.$next_user.'][\'userName\'] = \''.$_POST['username'].'\';
-
29
$users['.$next_user.'][\'password\'] = \''.$encryptedpass.'\';
-
30
$users['.$next_user.'][\'channels\'] = array(0,1);
-
31
// Email Address: '.$_POST['email'].'
-
32
?>';
-
33
$file_edit = fopen('./lib/data/users.php', 'r+');
-
34
fseek($file_edit, -3,SEEK_END);
-
35
fwrite($file_edit, $new_user_information);
-
36
fclose($file_edit);
-
37
}
-
38
header('Location: index.php');
-
39
}
-
40
break;
-
41
}
-
42
}
-
43
?>
-
44
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
45
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="[LANG_CODE/]" lang="[LANG_CODE/]" dir="[BASE_DIRECTION/]">
-
46
<head>
-
47
<title>Flashii Chat :: Registration</title>
-
48
<style type="text/css">
-
49
body {
-
50
padding:0;
-
51
margin:0;
-
52
}
-
53
</style>
-
54
<link rel="stylesheet" type="text/css" href="css/legacy.css">
-
55
<!--[if lt IE 7]>
-
56
<link rel="stylesheet" type="text/css" href="css/ie5-6.css"/>
-
57
<![endif]-->
-
58
</head>
-
59
<body>
-
60
<div id="loginContent">
-
61
<div id="loginHeadlineContainer">
-
62
<h1>Flashii Chat :: Registration</h1>
-
63
<h4>Reregistering <u>might</u> be required in a few days</h4>
-
64
</div>
-
65
<form id="loginForm" action="?ajax=createaccount" method="post" enctype="application/x-www-form-urlencoded">
-
66
<div id="loginFormContainer">
-
67
<div><label for="userNameField">Username:</label><br />
-
68
<input type="text" name="username" id="userNameField" maxlength="20"/></div>
-
69
<div><label for="passwordField">Password:</label><br />
-
70
<input type="password" name="password" id="passwordField"/></div>
-
71
<div><label for="passwordField">E-Mail Address:</label><br />
-
72
<input type="text" name="email" id="userNameField"/></div>
-
73
<div><input type="submit" name="submit" id="loginButton" value="Create account"/></div>
-
74
</div>
-
75
</form>
-
76
<div id="errorContainer">
-
77
<?php
-
78
if (isset($_GET['errormessage'])) {
-
79
echo $_GET['errormessage'];
-
80
} else {
-
81
echo "";
-
82
}
-
83
?>
-
84
</div>
-
85
<div id="copyright"><a href="./">Login</a> - <b><a href="register.php">Register</a></b> - <a href="rules.php">Rules</a></div><div id="copyright"><a href="https://blueimp.net/ajax/">AJAX Chat</a> © <a href="https://blueimp.net">blueimp.net</a></div>
-
86
</div>
-
87
</body>
-
88
-
89
</html>