Alternc
3.2
Alternc logiel libre pour l'hébergement
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
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
if
(!function_exists(
'mysql_connect'
)) {
33
if
(!dl(
"mysql.so"
))
34
exit
(1);
35
}
36
37
// don't check my authentication !
38
if
(!chdir(
"/usr/share/alternc/panel"
))
39
exit
(1);
40
require(
"/usr/share/alternc/panel/class/config_nochk.php"
);
41
42
// We go root
43
$admin->enabled=1;
44
45
// We Create the default mysql server if needed :
46
$db
->query(
"SELECT MIN(id) AS id FROM db_servers;"
);
47
$db
->next_record();
48
if
(!intval(
$db
->Record[
"id"
])) {
49
echo
"No default db_servers, creating one\n"
;
50
// No db_servers ? We create one from the local MySQL parameters
51
if
($L_MYSQL_HOST==
"localhost"
) $client=
"localhost"
;
else
$client=
"%"
;
52
$db
->query(
"INSERT INTO db_servers SET `name`='Default', `host`='$L_MYSQL_HOST', `login`='$L_MYSQL_LOGIN', `password`='$L_MYSQL_PWD', `client`='$client';"
);
53
$db
->query(
"SELECT MIN(id) AS id FROM db_servers;"
);
54
$db
->next_record();
55
}
56
$dbs
=
$db
->Record[
"id"
];
57
58
// And create the admin account
59
if
(!$admin->add_mem(
"admin"
,
"admin"
,
"Administrateur"
,
"Admin"
,
"postmaster@"
.$L_FQDN,
60
1,
'default'
,0,
''
,0 ,
''
,
61
$dbs
62
)) {
63
echo
$err
->errstr().
"\n"
;
64
exit
(1);
65
}
66
67
if
(!
$db
->query(
"UPDATE membres SET su=1 WHERE login='admin';"
))
68
exit
(1);
69
70
// Give admin account some default quota:
71
if
(!$quota->synchronise_user_profile()) {
72
exit
(1);
73
}
74
75
exit
(0);
76
code
alternc
install
newone.php
Generated on Mon Mar 24 2014 17:14:20 for Alternc by
1.8.1.2