Alternc
latest
Alternc logiel libre pour l'hébergement
newone.php
Go to the documentation of this file.
1
#!/usr/bin/php -q
2
<?php
3
/*
4
$Id: newone.php,v 1.6 2006/02/17 15:15:54 olivier Exp $
5
----------------------------------------------------------------------
6
AlternC - Web Hosting System
7
Copyright (C) 2002 by the AlternC Development Team.
8
http://alternc.org/
9
----------------------------------------------------------------------
10
Based on:
11
Valentin Lacambre's web hosting softwares: http://altern.org/
12
----------------------------------------------------------------------
13
LICENSE
14
15
This program is free software; you can redistribute it and/or
16
modify it under the terms of the GNU General Public License (GPL)
17
as published by the Free Software Foundation; either version 2
18
of the License, or (at your option) any later version.
19
20
This program is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
GNU General Public License for more details.
24
25
To read the license please visit http://www.gnu.org/copyleft/gpl.html
26
----------------------------------------------------------------------
27
Original Author of file: Benjamin Sonntag
28
Purpose of file: Create the first admin account on a new AlternC server
29
----------------------------------------------------------------------
30
*/
31
32
// don't check my authentication !
33
if
(!chdir(
"/usr/share/alternc/panel"
))
34
exit
(1);
35
require(
"/usr/share/alternc/panel/class/config_nochk.php"
);
36
37
// We go root
38
$admin->enabled=1;
39
40
// We Create the default mysql server if needed :
41
$db
->query(
"SELECT MIN(id) AS id FROM db_servers;"
);
42
$db
->next_record();
43
if
(!intval(
$db
->Record[
"id"
])) {
44
echo
"No default db_servers, creating one\n"
;
45
// No db_servers ? We create one from the local MySQL parameters
46
if
(
$L_MYSQL_HOST
==
"localhost"
)
$client
=
"localhost"
;
else
$client
=
"%"
;
47
$db
->query(
"INSERT INTO db_servers SET `name`='Default', `host`='$L_MYSQL_HOST', `login`='$L_MYSQL_LOGIN', `password`='$L_MYSQL_PWD', `client`='$client';"
);
48
$db
->query(
"SELECT MIN(id) AS id FROM db_servers;"
);
49
$db
->next_record();
50
}
51
$dbs
=
$db
->Record[
"id"
];
52
53
// And create the admin account
54
if
(!$admin->add_mem(
"admin"
,
"admin"
,
"Administrateur"
,
"Admin"
,
"postmaster@"
.$L_FQDN,
55
1,
'default'
,0,
''
,0 ,
''
,
56
$dbs
57
)) {
58
echo
$err
->errstr().
"\n"
;
59
exit
(1);
60
}
61
62
if
(!
$db
->query(
"UPDATE membres SET su=1 WHERE login='admin';"
))
63
exit
(1);
64
65
// Give admin account some default quota:
66
if
(!$quota->synchronise_user_profile()) {
67
exit
(1);
68
}
69
70
exit
(0);
71
exit
exit
Definition:
adm_doadd.php:70
$client
$client
Definition:
alternc_fix_myadm_users.php:59
$db
global $db
Definition:
bootstrap.php:26
$L_MYSQL_HOST
global $L_MYSQL_HOST
Definition:
bootstrap.php:22
$err
$err
Definition:
bootstrap.php:72
$dbs
if(!intval($db->Record["id"])) $dbs
Definition:
newone.php:51
install
newone.php
Generated on Sat Sep 16 2023 12:00:04 for Alternc by
1.9.1