salve sto mettendo mano ad una pagina internet che dovrei modificare dove per accedere all'area si deve inserire user e pass. Ora la persona che mi ha dato questo incarico mi ha detto che non riesce piu ad accedere all'area inserendo user e pass. Io non mi sono fatto molto problemi perchè avendo i codici sorgenti ho pensato che un'occhiata nel codice e riuscivo a recuperare facilmente i codici, invece cosi non è stato perchè non ne vedo l'ombra. Qualcuno mi sa aiutare ?

Codice PHP:
<?php

session_start 
();

// --------------------------------THE VARIABLES---------------------------------- //

@include ("config.php");

// ----------------------------------THE CODE ------------------------------------ //

function clearance ($user_value$pass_value$level_value$userlevel_value$table_value$column1$column2$path) { // Function to see if user can login
    
    
$check mysql_query ("SELECT $userlevel_value FROM $table_value WHERE username='$user_value' AND password='$pass_value'"); // Query to see if user exists
    
    
$verify mysql_num_rows ($check);
    
    if (
$verify == 0) { // Check if passwords are hashed with MD5
    
        
$md5 md5 ($pass_value);
    
        
$check mysql_query ("SELECT $userlevel_value FROM $table_value WHERE username='$user_value' AND password='$md5'"); // Query to see if user exists
    
        
$verify mysql_num_rows ($check);
        
    }
    
    if (
$verify == 0) { // Check if passwords are hashed with SHA1
    
        
$sha1 sha1 ($pass_value);
    
        
$check mysql_query ("SELECT $userlevel_value FROM $table_value WHERE username='$user_value' AND password='$sha1'"); // Query to see if user exists
    
        
$verify mysql_num_rows ($check);
        
    }
    
    
$get mysql_fetch_array ($check);
    
    if (
count ($level_value) != 0) { // If the allow array contains userlevels
        
        
if (in_array ($get[$userlevel_value], $level_value) && $verify 0) { // Search allow to see if userlevels match
            
            
$_SESSION['username'] = $user_value// Register sessions
            
$_SESSION['password'] = sha1 ($pass_value); // sha1 password for extra security
            
$_SESSION['userlevel'] = $get[$userlevel_value];
                
        }
        
    } else {
    
        if (
$verify == 0) { // If attempt fails then redirect to login page
    
            
$_SESSION = array();
            
            
$error "Sorry but your login details were incorrect";
            
            @include (
"login.php");
            
            exit;
        
        }
        
        if (
$verify 0) { // If attempt is good then register the user
    
            
$_SESSION['username'] = $user_value;
            
$_SESSION['password'] = sha1 ($pass_value);
        
        }
        
    }
    
}

function 
protect ($level_value$password_value$userlevel_value$table_value$column1$path) { // Function to keep pages secure

    
if (!isset ($_SESSION['username'])) { // If session doesn't exist then get user to login
    
        
if (isset ($_POST['username']) && isset ($_POST['password'])) {
        
            
$error "Sorry but your login details were incorrect";
        
        }
        
        
$_SESSION = array();
        
        @include (
"login.php");
        
        exit;
        
    } else { 
// If user is logged in check to see if session is valid and that they have the required userlevel
    
        
$check mysql_query ("SELECT $password_value$userlevel_value FROM $table_value WHERE $column1='$_SESSION[username]'"); // Query to see if user exists
        
        
$verify mysql_num_rows ($check);
        
        
$get mysql_fetch_array ($check);
        
        if (
$verify == 0) {
        
            
$_SESSION = array();
                
            
$error "Sorry but your login details were incorrect";
                
            @include (
"login.php");
                
            exit;
            
        }
        
        if (
$verify && count ($level_value) != 0) {
                
            if (!
in_array ($get[$userlevel_value], $level_value)) { // Check to see if the users userlevel allows them to view the page
                
                
$error "Sorry but your login details were incorrect";
                    
                @include (
"login.php");
                    
                exit; 
// Ensure no other data is sent
                
            
}
                
        }    
    
    }
    
}

if (isset (
$_POST['username']) && isset ($_POST['password'])) { // If user submits login information then validate it

    
clearance ($_POST['username'], $_POST['password'], $allow$userlevel$table$username$password$path);
    
}

protect ($allow$password$userlevel$table$username$path);

mysql_close ($link); // Close the database connection for security reasons

// -----------------------------------THE END ------------------------------------ //

?>
Codice PHP:
<?php

// Database and Server Values
$host 'XXXXXXX'// Name of server you are on (e.g. localhost)
$user 'XXXXXXX'// Your Server Username    
$pass 'XXXXXXX'// Your Server Password
$database 'XXXXXXX'// Database Name where the user details are

// Table Values
$table 'users'// The name of the database table where the username & password are
$username 'username'// The name of the username field in the table
$password 'password'// The name of the password field in the table
$userlevel 'userlevel'// The name of the userlevel field (leave blank (i.e. $userlevel = '') if it is not important
//

// Paths
$path "http://www.XXXXXX.info/XXXXXXX/"// Path to X-Protection folder on the server (e.g [url]http://www.myhost.com/x-protection[/url]). Don't include the final slash
$logout "http://www.XXXXXX.info/XXXXXXXX/"// Path to the webpage users go to when logged out
//

// Connect Information - No need to edit
$link mysql_connect ($host$user$pass);
mysql_select_db ($database);
//

?>
quando provo ad inserire user e pass mi da vari codici :
Codice PHP:
Warningmysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /web/htdocs/www.XXXXXXXX.info/home/XXXXXXXX/protect.php on line 15

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /web/htdocs/www. XXXXXXXX.info/home/XXXXXXXX/protect.php on line 15

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /web/htdocs/www. XXXXXXXX.info/home/XXXXXXXX/protect.php on line 17

Warning: mysql_query() [function.mysql-query]: Can'
t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2in /web/htdocs/wwwXXXXXXXX.info/home/XXXXXXXX/protect.php on line 23

Warning
mysql_query() [function.mysql-query]: A link to the server could not be established in /web/htdocs/wwwXXXXXXXX.info/home/XXXXXXXX/protect.php on line 23

Warning
mysql_num_rows(): supplied argument is not a valid MySQL result resource in /web/htdocs/wwwXXXXXXXX.info/home/XXXXXXXX/protect.php on line 25

Warning
mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /web/htdocs/www. XXXXXXXX.info/home/XXXXXXXX/protect.php on line 33

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /web/htdocs/www. XXXXXXXX.info/home/XXXXXXXX/protect.php on line 33

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /web/htdocs/www. XXXXXXXX.info/home/XXXXXXXX/protect.php on line 35

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /web/htdocs/www. XXXXXXXX.info/home/XXXXXXXX/protect.php on line 39
Sorry but your login details were incorrect