User Management Code

  Home arrow User Management Code arrow SysOp
USER MANAGEMENT CODE

SysOp
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2002-01-18

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    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

    blog comments powered by Disqus

    USER MANAGEMENT CODE ARTICLES

    - XCRYPT v1.0b
    - DB_eSession class stores sessions in a MySQL...
    - Ever Changing Dynamic Passcode Code
    - phpAutoMembersArea - create own members area
    - Azura Signup 2.5
    - Azura Signup 2.0
    - Azura Signup
    - Flexcustomer
    - PHP Quicksite 2.0
    - PHP Quicksite 1.0
    - random string generator (key generator)
    - Example Login system
    - Simple and Easy Security
    - Basic Security
    - UMA - User Management and Authentication

    Developer Shed Affiliates

     



    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap