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. |
More User Management Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process. FREE! Go There Now!
|
|
|
|
Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services. FREE! Go There Now!
|
|
|
|
WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies. FREE! Go There Now!
|
|
|
|
Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications. FREE! Go There Now!
|
|
|
|
This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product. FREE! Go There Now!
|
|
|
|
Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services. FREE! Go There Now!
|
|
|
|
This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today! FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
|
|
|
|
In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |