OCC registration script

  • Devon Holcombe

    Devon Holcombe - 2003-12-08

    I have created a registration.php for occ so that users can register themselves, it also stores the passwords encrypted instead of plaintext as the current client does. At this time it requires a few minor changes to the index.php and splitting the accounts.php into accounts.php and accountrestrictions.php. It currently does not restrict users in any way allowing them to challenge any existing users once they have registered. It is quite simple in its setup. It just asks for their desired username and 2 password fields to verify the password is typed correctly and they are done. No email or other information required, no verification email.

    In order to use this you will need to set up all your users again because it uses encrypted passwords instead of plaintext. Maybe if there are enough users of OCC I could make a migration script to automatically go through the old accounts.php and encrypt all the passwords. Dunno how many people are using this already since its only about a month old.

    • Nobody/Anonymous

      Where can we get this script?

      • Nobody/Anonymous

        I need to update it for 1.0.7 since I modified some of the actual game files. Email me and I'll make sure you get it.

      • Devon Holcombe

        Devon Holcombe - 2003-12-28

        Email me...heh, made that last post anonymous on accident...so yeah.

    • Nobody/Anonymous

      Where can we get this script?


    • Nobody/Anonymous

      This is the script I wrote for version 1.2.6 and I use on my site: http://sandj.users.sonic.net/Games/occ/index.php


      include "accounts.php";

      function open_file($n)
      $fd=fopen($n,"r") or die('...');
      return $fs;

      function save_file($m,$n,$o)

              $n=' ';
              $fd=fopen($m,"w+") or die($o);


      function AddUser($name, $password, $email)
          $file = open_file("accounts.php");
          $search = "/* Add Users Here */";
          $file = preg_replace("$/\* Add Users Here \*/$", ", \&quot;$name\&quot; => \&quot;$password\&quot; $search ", $file);
          if ($email != '')
              $search = "/* Add Emails Here */";
              $file = preg_replace("$/\* Add Emails Here \*/$", ", \&quot;$name\&quot; => \&quot;$email\&quot; $search ", $file);
          save_file("accounts.php", $file, 0);

      if(isset( $_POST ))
      $new_name = $_POST["new_name"];
      $new_pass = $_POST["new_pass"];
      $new_email = $_POST["new_email"];
      if($new_name!='' && $new_pass!='')
          $new_name = trim($new_name);
          $new_pass = trim($new_pass);
          $new_email = trim($new_email);
          /* First make sure the username is not already taken */
          /* If everything is ok, then add the user and redirect to index.php */
              Adduser($new_name, $new_pass, $new_email);
              die("<title>Adding User</title><meta http-equiv=\&quot;Refresh\&quot; content=\&quot;2;url=index.php\&quot; /></head><body><div style=\&quot;color:black;background-color: white\&quot;>Adding User...</div></body></html>");
              die("<title>Adding User</title><meta http-equiv=\&quot;Refresh\&quot; content=\&quot;30;url=index.php\&quot; /></head><body><div style=\&quot;color:black;background-color: white\&quot;>Adding User...<br /><bigger><bigger><b>Username is already taken!</b></bigger></bigger></div></body></html>");

        <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
      <h1>Online Chess Club Registration</h1>
      <form name="y" action="register.php" method="post">
      <tr><td>Username</td><td><input type="text" size="30" name="new_name" /></td></tr>
      <tr><td>Password</td><td><input type="password" size="30" name="new_pass" /></td></tr>
      <tr><td>Email<small><em>(optional)</em></small></td><td><input type="text" size="50" name="new_email" /></td></tr>
      <tr><td> </td><td><input type="submit" name="submit" value="Register" /></td></tr>
      <p><em>Please note that this regisration is only for access to the OCC games.  The forums require a seperate registration.  It is strongly suggested to fill out both forms, preferably with the same username.</em></p>

    • Nobody/Anonymous

      The register.php works but the accounts.php don´t save the new user. (accounts.php=777)

      What can I do?


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks