This is a basic script to for a user management system. This is just a back end, and you will be required to program the front end. I reccomend experience with PHP and such. Don't be suprised for a few bugs, it is still in it's alpha stage.
By : ipzero
<? function checkUser($user, $pass) { $fp = fopen("filename", "r"); $auth = false; while (!feof($fp)) { $parts = explode("||:|:||", trim(fgets($fp, 1024))); if ($parts[0] == substr(crypt($user, "mn"), 2)) { if ($parts[1] == substr(crypt($pass, "jh"), 2)) { $auth = true; break; } } } fclose($fp); return $auth; } function addUser($user, $pass, $email) { $fp = fopen("filename", "r"); $user = substr(crypt(trim($user), "mn"), 2); while (!feof($fp)) { $parts = explode("||:|:||", trim(fgets($fp, 1024))); if ($parts[0] == $user) { return 0; exit; } } fclose($fp); $fp = fopen("filename", "a"); $pass = substr(crypt(trim($pass), "jh"), 2); $email = trim($email); $string = $user."||:|:||".$pass."||:|:||".$email."\n"; fwrite ($fp, $string); fclose($fp); return 1; } function findUser($user) { $fp = fopen("filename", "r"); $found = false; $i = 0; while (!feof($fp)) { $parts = explode("||:|:||", trim(fgets($fp, 1024))); if ($parts[0] == substr(crypt($user, "mn"), 2)) { print ("User <b><i>$user</i></b> found at line <b>$i</b>:<br>$parts[0]<br>$parts[1]<br>$parts[2]"); break; } $i++; } } function deleteUser($user) { $user = substr(crypt(trim($user), "mn"), 2); $newfile[0] = ""; $content = file(""); $i = 0; for(; $i < count($content); $i++) { $parts = explode("||:|:||", trim($content[$i])); if (!$parts[0] == $user) { $newfile[$i] = $content[$i]; } } $fp = fopen("filename", "w") or die ("Could not open file for writing"); for ($i = 0; $i < count($newfile); $i++) { fwrite($fp, $newfile[$i]."\n"); } fclose ($fp); } ?>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.