Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!--
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
- -->
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Register to chat</title>
- <link type="text/css" rel="stylesheet" href="css/MyBB.css">
- </head>
- <body>
- <form method="post" onclick="register.php">
- Username: <input type="text" name="username">
- Password: <input type="password" name="password">
- Confirm Password: <input type="password" name="passconf">
- <input type="submit" value="Submit!">
- </form>
- <?php
- if (!empty($_POST)) {
- $password = $_POST['password'];
- $passconf = $_POST['passconf'];
- if ($pasword == $passconf) {
- $idFile = fopen("lib/id.txt", "r") or die("Error: Unable to open id file. Please try again. If this error persists, consult the Head Admin.");
- $id = fread($idFile, filesize("lib/id.txt"));
- $id = $id + 1;
- fclose($idFile);
- $idf2 = fopen("lib/id.txt", "r") or die("Error: Unable to open id file. Please try again. If this error persists, consult the Head Admin.");
- fwrite($idf2, $id);
- fclose($idf2);
- $userFile = fopen("lib/data/users.php", "a+") or die("Error: Unable to open users file. Please try again. If this error persists, consult the Head Admin");
- fwrite($userFile, '\n$users[' . $id . '] = array();\n' . '$users[' . $id . '][\'userRole\'] = AJAX_CHAT_USER;\n' . '$users[' . $id . '][\'userName\'] = \'' . $_POST['username'] . '\';\n' . '$users[' . $id . '][\'password\'] = \'' . $_POST['password'] . '\';\n' . '$users[\'' . $id . '\'][\'channels\'] = array(0,1);\n');
- echo "<br>Your user has been created. Click <a href=\"index.php\">here</a> to login.<br>";
- } else {
- echo "<br><span style=\"color:red;\">Your password does not match your confirmation of your pasword. Please try again.</span><br>";
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement