Change password from an auto installer system

Greetings,

I'm a web hoster and i would like offer ZenPhoto to my hosted with my click-install system.

I just need to know how i could generate a new password for the admin user.

I have tried this but it's don't work (i'm a administrator system, not a web developper) :

<?php
include('admin-users.php');
$userobj = $_zp_authority->newAdministrator('admin');
$msg = $userobj->setPass('the-password');
?>

and i run in my shell this : cat change-password.php | php

Could you tell me how i could do it, without lets my hosted create a new user (remove admin user and lets the setup.php create a new one). I search a rapid installation for them.

Thanks so much.

Comments

  • I believe you need to call `$_zp_authority->save()` for changes on the object to persist.
  • Also, you don't really need the entirety of `admin-users.php`. Including `lib-auth.php` should be enough.
  • The appropriate include is functions. PHP. You need a complete environment. Note as well that your install application must run the setup script or your clients will likely have down stream issues that we cannot help with.
  • Elodie Member
    Thanks so much for your response.

    Yes i need to run the setup.exe to update the location folder of the "copy ghost" but i would like it minimal.

    So I have attempt :

    <?php
    include('functions.php');
    $userobj = $_zp_authority->newAdministrator('admin');
    $msg = $userobj->setPass('toto');
    ?>

    It's give me no error but the password isn't changed.

    I have attempt to add on the last line :
    $_zp_authority->save();

    but it's give me this error :
    PHP Fatal error: Call to undefined method Zenphoto_Authority::save() in - on line 6

    I have tried to include classes.php but cannot redeclare (already included).

    I think i'm not so far of the solution :)
  • acrylian Administrator, Developer
    First, there is no "setup.exe"... Second, if you want to use $_zp_authority you need to create/assign the admin object first (this global is only predefined automatically in Zenphoto environment!). You actually did assign that object to $userobj in the code example right before that so you of course have to use that to save...
  • Elodie Member
    With :

    $userobj->save();

    I have no error but the password isn't changed.

    Could you tell me if with less 10 lines in more i could change the password or if i need to abandon ?

    If it's only less 10 lines could you give me them ? I'm not developer and i know nothing about php object.

    Thanks so much.
  • acrylian Administrator, Developer
    Well, you should look at the documentation. You did not set the "user id". See the documentation please. Passing the user name with the newAdministrator method is for existing ones. You need to set a user for new users as well.
    http://www.zenphoto.org/documentation/classes/Zenphoto_Authority.html
    http://www.zenphoto.org/documentation/classes/Zenphoto_Administrator.html

    You are a host that wishes to provide one click hosting of a rather complex php program like Zenphoto without having decent php knowledge? Forgive me but I am not sure if that is a good idea actually.
  • Elodie Member
    Thanks for the links, i will look.

    > You are a host that wishes to provide one click hosting of a rather complex php program like Zenphoto without having decent php knowledge? Forgive me but I am not sure if that is a good idea actually.

    "decent php knowledge" is to know object PHP ? You know that we can program in PHP without object and it's not a problem for me. PHP is a script language too. My problem is the object programation and i don't think it's could be called "decent php knowledge".

    My system work very well with Wordpress, FluxBB, PhpBB and Joomla.
  • Elodie Member
    I abandon, i lets my customer install ZenPhoto and finish the install by an update with create new user (that i think to much/useless) but to much difficult to change 2 items into a mysql database.

    It's solved for me.
  • acrylian Administrator, Developer
    I didn't want to offend you but object orientation is a standard procedure in PHP and other languages nowaday and to my knowledge WP and Joomla do use that as well (I don't know the other two at all).

    There are several one click installer providers available we don't support but you could use (but probably need to pay for) that support also Zenphoto. Maybe that would be easier for you?
Sign In or Register to comment.