root/alternc/trunk/install/newone.php

Revision 1798, 2.4 kB (checked in by nahuel, 2 years ago)

Comme php5 peut etre installé, nous utilisons le lien php qui pointe soit vers php5 soit vers php4 ( soit php6 ? ).
close: #1042

Line 
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 // On vérifie que mysql.so est bien chargé, sinon on essaye de le charger
33 if(!function_exists(mysql_connect))  {
34   if(!dl("mysql.so"))
35     exit(1);
36 }
37
38 // Ne vérifie pas ma session :)
39 if(!chdir("/var/alternc/bureau"))
40   exit(1);
41 require("/var/alternc/bureau/class/config_nochk.php");
42
43 // On passe super-admin
44 $admin->enabled=1;
45
46 // On crée le compte admin :
47 if (!$admin->add_mem("admin","admin","Administrateur", "Admin", "postmaster@".$L_FQDN)) {
48     echo $err->errstr()."\n";
49     exit(1);
50 }
51
52 if(!$db->query("update membres set su=1 where login='admin';"))
53   exit(1);
54
55 // On lui attribue des quotas par defaut
56 // 10 domains, 10 stats, 10 bases mysql, 20 ftp et 100 emails
57 if(!($db->query("update quotas,membres set quotas.total=10 where (quotas.name='stats' or quotas.name='sta2' or quotas.name='mysql' or quotas.name='dom') and quotas.uid=membres.uid and membres.login='admin' ;")
58   && $db->query("update quotas,membres set quotas.total=20 where quotas.name='ftp' and quotas.uid=membres.uid and membres.login='admin' ;")
59   && $db->query("update quotas,membres set quotas.total=100 where quotas.name='mail' and quotas.uid=membres.uid and membres.login='admin' ;")))
60   exit(1);
61
62 exit(0);
63 ?>
64
Note: See TracBrowser for help on using the browser.