User Management Code

  Home arrow User Management Code arrow Ever Changing Dynamic Passcode Code
USER MANAGEMENT CODE

Ever Changing Dynamic Passcode Code
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2004-03-24

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    This code allows you to use a changing passowrd based on the day of the week and a present code. Good security in a pinch.

    By : drastik

    <?
    // This page creates a changing password scheme that uses a simple 7 number code that
    // changes based on the day of the week. For instance, on monday you would increase the
    // first of the seven integers by one, on tuesday you would increase by two, on wendsday:
    // increase three, and so on through sunday.
    // The php code checks this against you schema of passcodes for each day and determines if
    // you have entered the code correctly.

    // Given that PHP has a great deal of flexibility in the movement oand find replace
    // functions for objects in an array, you can use this code as a starting point to develop
    // your own codes. The code above is not unbreakable, a good history buff might even know
    // the code itself, but a brute force attack could crack it. Of course, if you are using
    // integers, increasing the number of ints will make it ore difficult to crack.

    // This code is designged to work like a keypad where no user id is required. You could
    // build in userid functionality in your prefeered method (database, textfile, etc) or
    // create a code for usernames as well! I've left this part out for the sake of brevity.

    if (isset($_POST['passcode'])) { // run the functions if a post is enterd

    // This is the passCode function set
    $passCode = $_POST['passcode'];
    $passCode = explode(".",$passCode); // break the post nto an array
    $passCode = array_sum($passCode); // sum the array

    // This is the checkCode function set
    $baseCode = "8.3.0.4.4.2.1"; // Usualy this is a phone number, easy to remember
    $codeArr = explode(".",$baseCode); // array the baseCode

    // These functions determine the changes to the code based on the day of the week
    if (date("D") == "Mon") {
    $codeArr[0] = $codeArr[0] + 1;
    }
    elseif (date("D") == 'Tue') {
    $codeArr[1] = $codeArr[1] + 2;
    }
    elseif (date("D") == 'Wed') {
    $codeArr[2] = $codeArr[2] + 3;
    }
    elseif (date("D") == 'Thu') {
    $codeArr[3] = $codeArr[3] + 4;
    }
    elseif (date("D") == 'Fri') {
    $codeArr[4] = $codeArr[4] + 5;
    }
    elseif (date("D") == 'Sat') {
    $codeArr[5] = $codeArr[5] + 6;
    }
    elseif (date("D") == 'Sun') {
    $codeArr[6] = $codeArr[6] + 7;
    }

    // bring the changed baseCode numbers back into an array
    implode($codeArr);
    $sumCode = array_sum($codeArr); // sum that array
    if ($sumCode == $passCode) { //check sums for equality
    print "Access Granted";} // do whatever once you authorize
    else { print "Access Denied!"; }
    }

    else { //if no post is entered, print the code box
    print "Enter code as integers seperated by periods.";
    print "<form action=\"$PHP_SELF\" method=\"post\">";
    print "<input type=\"password\" name=\"passcode\" />";
    print "</form>";
    }

    ?>

    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