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.
Where can we get this script?
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.
Email me...heh, made that last post anonymous on accident...so yeah.
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
$fd=fopen($n,"r") or die('...');
$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 \*/$", ", \"$name\" => \"$password\" $search ", $file);
if ($email != '')
$search = "/* Add Emails Here */";
$file = preg_replace("$/\* Add Emails Here \*/$", ", \"$name\" => \"$email\" $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=\"Refresh\" content=\"2;url=index.php\" /></head><body><div style=\"color:black;background-color: white\">Adding User...</div></body></html>");
die("<title>Adding User</title><meta http-equiv=\"Refresh\" content=\"30;url=index.php\" /></head><body><div style=\"color:black;background-color: white\">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>
The register.php works but the accounts.php don´t save the new user. (accounts.php=777)
What can I do?