Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('chat/lib/data/users.php');
- //check existing users
- if ($_POST['username'])
- {
- //if user entered a name
- }
- //collect information from users.php
- $user_amount = count($users);
- for ($i=0; $i <=$user_amount;$i++);
- {
- //check usage of name
- if (strtolower($_POST['username']) == strtolower($users[$i]['userName']))
- $username_used = 1;
- }
- //make sure user chose a password
- if (!$_POST['password'])
- $password_error = 1;
- //ensure username avalible and password chosen
- if (!$username_used and !$password_error)
- {
- //present user id accepted message
- print 'Your selection '.$_POST['username'].' was accepted... your account was created. You may now login!!!';
- $next_user = $user_amount++;
- $new_user_information = '
- //remote created from '.$_SERVER['REMOTE_ADDR'].'
- $users['.$next_user.'] = array();
- $users['.$next_user.'][\'userRole\'] = AJAX_CHAT_USER;
- $users['.$next_user.'][\'userName\'] = \''.$_POST['username'].'\';
- $users['.$next_user.'][\'password\'] = \''.$_POST['password'].'\';
- $users['.$next_user.'][\'channels\'] = array(0,1);
- ?>';
- $file_edit = fopen('chat/lib/data/users.php', 'r+');
- fseek($file_edit, -3,SEEK_END);
- fwrite($file_edit, $new_user_information);
- fclose($file_edit);
- }
- //end of php
- ?>
- <table border="0" align="center">
- <table border="0" align="center">
- <tr>
- <td>Use the form below to create a Chat user account.</td>
- </tr>
- <tr>
- <td>
- <!-- collect username and password information via form -->
- <form action="" method="post">
- Username:<input name="username" type="text" value="" /> 16 Character Maximum<br>
- Password:<input name="password" type="text" value="" /> No requirements.<br>
- <input name="submit" type="submit" value="Create" />
- </form>
- </td>
- </tr>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement