File: clean_auth.php

package info (click to toggle)
jffnms 0.8.3dfsg.1-2.1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,928 kB
  • ctags: 5,050
  • sloc: php: 19,981; sh: 266; makefile: 91; perl: 52
file content (42 lines) | stat: -rw-r--r-- 1,424 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?
/* This file is part of JFFNMS
 * Copyright (C) <2002-2005> Javier Szyszlican <javier@szysz.com>
 * This program is licensed under the GNU GPL, full terms in the LICENSE file
 */
    $no_db=1;
    
    include("../../conf/config.php");

    $db_type="mysql";    
    $dbhost="localhost";
    $db="jffnms";
    $dbuser="root";
    $dbpass="sun";

    if (!$do) $do = $argv[1];

    $conexion = mysql_connect($dbhost, $dbuser, $dbpass) or die ("Could not connect - CON1");
    mysql_select_db($db) or die ("Could not select DB - CON2");
    echo "* Refixing Users Table\n";

    $result= mysql_query ("ALTER TABLE auth AUTO_INCREMENT = 1") or die ("Query failed - T3 - ".mysql_error());
    $result= mysql_query ("ALTER TABLE profiles AUTO_INCREMENT = 1") or die ("Query failed - T3 - ".mysql_error());
    $result= mysql_query ("ALTER TABLE profiles_values AUTO_INCREMENT = 300") or die ("Query failed - T3 - ".mysql_error());
    
    $user = "admin";

    if ($user) {
    
	echo "* Creating User $user";
	$id = user_add($user);

	echo ", assigned id: $id, now applying profile.\n";
	user_modify($id,"","",$user,"Administrator",0);
    
	profile_add_option($id,"ADMIN_ACCESS"); 
        profile_add_option($id,"ADMIN_USERS"); 
	profile_add_option($id,"ADMIN_SYSTEM"); 
	profile_add_option($id,"ADMIN_HOSTS"); 
	profile_add_option($id,"MESSAGES_VIEW_ALL"); 
	profile_add_option($id,"REPORTS_VIEW_ALL_INTERFACES"); 
    }