daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Jul 21st, 2017 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include('chat/lib/data/users.php');
  3. //check existing users 
  4.    
  5.     if ($_POST['username'])
  6.     {
  7.     //if user entered a name
  8.     }
  9.     //collect information from users.php
  10.     $user_amount = count($users);
  11.     for ($i=0; $i <=$user_amount;$i++);
  12.     {
  13.     //check usage of name
  14.     if (strtolower($_POST['username']) == strtolower($users[$i]['userName']))
  15.     $username_used = 1;
  16.     }
  17.  
  18. //make sure user chose a password
  19. if (!$_POST['password'])
  20. $password_error = 1;
  21.  
  22. //ensure username avalible and password chosen
  23.  if (!$username_used and !$password_error)
  24. {
  25. //present user id accepted message
  26. print 'Your selection '.$_POST['username'].' was accepted... your account was created. You may now login!!!';
  27. $next_user = $user_amount++;
  28. $new_user_information = '
  29.  
  30. //remote created from '.$_SERVER['REMOTE_ADDR'].'
  31. $users['.$next_user.'] = array();
  32. $users['.$next_user.'][\'userRole\'] = AJAX_CHAT_USER;
  33. $users['.$next_user.'][\'userName\'] = \''.$_POST['username'].'\';
  34. $users['.$next_user.'][\'password\'] = \''.$_POST['password'].'\';
  35. $users['.$next_user.'][\'channels\'] = array(0,1);
  36.  
  37. ?>';
  38. $file_edit = fopen('chat/lib/data/users.php', 'r+');
  39. fseek($file_edit, -3,SEEK_END);
  40. fwrite($file_edit, $new_user_information);
  41. fclose($file_edit);
  42. }
  43. //end of php
  44.  
  45. ?>
  46. <table border="0" align="center">
  47.     <table border="0" align="center">
  48.     <tr>
  49.         <td>Use the form below to create a Chat user account.</td>
  50.     </tr>
  51.     <tr>
  52.     <td>
  53.     <!-- collect username and password information via form -->
  54.     <form action="" method="post">
  55.     Username:<input name="username" type="text" value="" /> 16 Character Maximum<br>
  56.     Password:<input name="password" type="text" value="" /> No requirements.<br>
  57.     <input name="submit" type="submit" value="Create" />
  58.     </form>
  59.     </td>
  60.     </tr>
  61.     </table>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top