Hash function?

Hello,

i have to register admin-users without zenphoto formular.
Therefore i need the hash function. I found it in lib_auth.php, but i've no idea. how can i use this function to crypt my cleartext-password like '123456' in zenphoto password format? if i include the function an the classes.php (requiered), php show me the report: "Fatal error: Call to undefined function: getoption() in C:\Programme\xampp\htdocs\lib-auth.php on line 75"

i used the search function of this forum, but i found nothing, only that Currently it do a hash on the UserID+Password.

PS: Sorry for my bad english ^^

Comments

  • acrylian Administrator, Developer
    You can make your own form by customizing the `lib-auth.php`. Generally we don't recommend to hack core files because of update problems.

    Why don't you want to use the form we provide?
  • because it's for my cms. with the register on the mainpage,user shall registered on the gallery. therefore i will update the database from zenphoto with my reg-formular. (i don't make a update from the gallery, because problems are indifferent^^) But i don't abolutly not how i can cutomizing the lib-auth.php ...
  • acrylian Administrator, Developer
    Ok, so a kind of single login. I suggest to take a look at these extensions, there are some single login scripts, some older and for Wordpress, that might give you some ideas:
    http://www.zenphoto.org/tag/login/

    Also probably of interesst:
    http://www.zenphoto.org/2008/07/an-overview-of-zenphoto-users/

    Out of curiosity what CMS do you use?
  • My own cms ;) I've readed http://www.zenphoto.org/tag/login/ but there is no function for hash Oo

    One question: To understand the hash is created, md5 from password+userID or...?

    Thank you for help :D
  • acrylian Administrator, Developer
    There is `passwordHash($user, $pass)` within `lib-auth.php` and that uses md5 as you already noted. IF you want to use Zenphoto functions outside of Zenphoto you need to try the "zenphoto as a plugin" way on our user guide.
  • sorry but it works not realy :P maybe i'm a fool but i must ask again...
    now i have the following code, but i see only a white page -.-

    <?php
    define('ZENFOLDER', 'zp-core');
    define('WEBPATH', 'zenphoto');
    require_once("template-functions.php");
    //load extensions
    $_zp_plugin_scripts = array();
    $_zp_flash_player = NULL;
    $curdir = getcwd();
    chdir("plugins/");
    $filelist = safe_glob('*'.'php');
    chdir($curdir);
    foreach ($filelist as $extension) {
    $opt = 'zp_plugin_'.substr($extension, 0, strlen($extension)-4);
    if (getOption($opt)) {
    require_once("plugins" . $extension);
    }
    }

    include'classes.php';
    include'lib-auth.php';

    $user='test';
    $pass='test';
    $pw= passwordHash($user, $pass);
    echo $pw;
    ?>

    i defined the plugins and included the lib-auth and classes.php ... the file "test" is in zenphoto/zp-core/
  • Please be a little more specific on what you need to do. If you just want a single login of your CMS users you can just define the users both to the CMS and to Zenphoto using the same password. Then use the single logon suggestions above.

    If you want to integrate your CMS login management with Zenphoto you need to create a custom version of the lib-auth.php that manages the users based on your CMS user database. The instructions for what you must provide are part of the lib-auth.php script.

    There is really no reason for you to be hashing the Zenphoto passwords yourself. That will do you no good.
Sign In or Register to comment.