Alternc  3.2
Alternc logiel libre pour l'h├ębergement
 All Data Structures Namespaces Files Functions Variables Pages
3.0.1.php
Go to the documentation of this file.
1 #!/usr/bin/php
2 <?php
3 
4 // We check that mysql php module is loaded
5 if(!function_exists('mysql_connect')) {
6  if(!dl("mysql.so"))
7  exit(1);
8 }
9 
10 // If we upgrade directly to 3.1 the panel directory change
11 $panel='';
12 if(chdir("/usr/share/alternc/panel")) $panel='/usr/share/alternc/panel';
13 elseif (chdir("/var/alternc/bureau")) $panel='/var/alternc/bureau';
14 
15 if (empty($panel)) { echo "Problem to load panel library"; exit(1); }
16 
17 require("$panel/class/config_nochk.php");
18 
19 $db2=new DB_System();
20 // we go super-admin
21 $admin->enabled=1;
22 
23 $db->query("select distinct uid,login,pass from db;");
24 //on insere dans dbusers avec enabled = admin
25 $query=array();
26 while($db->next_record()){
27  $db2->query("select id from dbusers where name ='".$db->f('login')."' and password='".$db->f('pass')."';");
28  if($db2->num_rows() ==0 ){
29  $query[]="insert ignore into dbusers values('',".$db->f('uid').",'".$db->f('login')."','".$db->f('pass')."',\"ADMIN\");";
30  }
31 }
32 
33 foreach ($query as $q){
34  $db->query($q);
35 }
36 
37 ?>
38 //done ? :)