*** empty log message ***
This commit is contained in:
parent
c81f1f7b32
commit
f9912fae84
12
INSTALL
12
INSTALL
@ -40,7 +40,17 @@ fichier Makefile.
|
|||||||
'make load' charge les donnees necessaire dans les tables de
|
'make load' charge les donnees necessaire dans les tables de
|
||||||
constantes.
|
constantes.
|
||||||
|
|
||||||
'make dev' charge un ensemble de donnees de test
|
'make dev' charge un ensemble de donnees de test, cette étapes
|
||||||
|
est facultative
|
||||||
|
|
||||||
|
|
||||||
Une fois ces 3 commandes passees votre base de donnees est
|
Une fois ces 3 commandes passees votre base de donnees est
|
||||||
pretes a etre utilisee.
|
pretes a etre utilisee.
|
||||||
|
|
||||||
|
Initialisation
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Pour créer votre premier compte qui sera admin/admin allez à
|
||||||
|
l'url /public/password.php, cette page créé un compte avec le login
|
||||||
|
'admin' et le passe 'admin' dans la base, si et seulement si la table
|
||||||
|
des login est vide.
|
||||||
65
htdocs/public/password.php
Normal file
65
htdocs/public/password.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?PHP
|
||||||
|
/* Copyright (c) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
|
||||||
|
require("../main.inc.php3");
|
||||||
|
|
||||||
|
|
||||||
|
$db = new Db();
|
||||||
|
|
||||||
|
$sql = "SELECT count(*) FROM llx_user";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($db->num_rows())
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row(0);
|
||||||
|
|
||||||
|
$db->free();
|
||||||
|
|
||||||
|
if ($row[0] > 0)
|
||||||
|
{
|
||||||
|
print "La base contient déjà des mots de passes";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$user = new User($db);
|
||||||
|
|
||||||
|
$user->login = "admin";
|
||||||
|
|
||||||
|
$user->create();
|
||||||
|
|
||||||
|
$user->id = 1;
|
||||||
|
|
||||||
|
$user->password("admin");
|
||||||
|
|
||||||
|
print "Compte admin/admin créé";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
@ -103,6 +103,38 @@ class User {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
Function create()
|
||||||
|
{
|
||||||
|
$sql = "SELECT login FROM llx_user WHERE login ='$this->login'";
|
||||||
|
|
||||||
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows();
|
||||||
|
$this->db->free();
|
||||||
|
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$this->errorstr = "Ce login existe déjà";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO llx_user (login) values ('$this->login');";
|
||||||
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
if ($this->db->affected_rows())
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
Function update()
|
Function update()
|
||||||
{
|
{
|
||||||
$sql = "SELECT login FROM llx_user WHERE login ='$this->login'";
|
$sql = "SELECT login FROM llx_user WHERE login ='$this->login'";
|
||||||
@ -149,10 +181,12 @@ class User {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function password()
|
Function password($password='')
|
||||||
{
|
{
|
||||||
|
if (! $password)
|
||||||
$password = substr(crypt(uniqid("")),0,8);
|
{
|
||||||
|
$password = substr(crypt(uniqid("")),0,8);
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "UPDATE llx_user SET pass = '".crypt($password, "CRYPT_STD_DES")."'";
|
$sql = "UPDATE llx_user SET pass = '".crypt($password, "CRYPT_STD_DES")."'";
|
||||||
$sql .= " WHERE rowid = $this->id";
|
$sql .= " WHERE rowid = $this->id";
|
||||||
|
|||||||
@ -50,7 +50,7 @@ if ($result) {
|
|||||||
print '<TD><a href="fiche.php3?id='.$obj->rowid.'">'.$obj->firstname.'</a></td>';
|
print '<TD><a href="fiche.php3?id='.$obj->rowid.'">'.$obj->firstname.'</a></td>';
|
||||||
print '<TD>'.$obj->name.'</TD>';
|
print '<TD>'.$obj->name.'</TD>';
|
||||||
print '<TD>'.$obj->code.'</TD>';
|
print '<TD>'.$obj->code.'</TD>';
|
||||||
print '<TD>'.$obj->login.'</TD>';
|
print '<TD><a href="fiche.php3?id='.$obj->rowid.'">'.$obj->login.'</a></TD>';
|
||||||
print '<TD align="center">'.$obj->module_comm.'</TD>';
|
print '<TD align="center">'.$obj->module_comm.'</TD>';
|
||||||
print '<TD align="center">'.$obj->module_compta.'</TD>';
|
print '<TD align="center">'.$obj->module_compta.'</TD>';
|
||||||
print "</TR>\n";
|
print "</TR>\n";
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
Auth_MySQL_Password_Table llx_user
|
Auth_MySQL_Password_Table llx_user
|
||||||
Auth_MySQL_Username_Field login
|
Auth_MySQL_Username_Field login
|
||||||
Auth_MySQL_Password_Field pass
|
Auth_MySQL_Password_Field pass
|
||||||
Auth_MySQL_Encryption_Types Plaintext
|
Auth_MySQL_Encryption_Types Crypt_DES
|
||||||
Auth_MySQL_Encrypted_Passwords off
|
Auth_MySQL_Encrypted_Passwords off
|
||||||
AuthName "Dolibarr"
|
AuthName "Dolibarr"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user