Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

jueves, 3 de septiembre de 2015

FOP2 admin login script


/var/www/html/fop2/admin/index.php


agregamos la linea  
require_once("login.php");



###################Login Script called login.php############
###
<?php


  $dbhost='localhost';
        $dbuser='root';
        $dbpass=71345;
        $dbname='asterisk';

        $db = mysql_connect($dbhost, $dbuser, $dbpass) or die("Couldn't connect to the database.");

        mysql_select_db($dbname) or die("Couldn't select the database");



    //--------------- AUTHENTICATION MODULE --------------------------

        function displayLogin() {
                header("WWW-Authenticate: Basic realm=\"Ambiorix\"");
                header("HTTP/1.0 401 Unauthorized");
                echo "<h2>Authentication Failure</h2>";
                echo "The username and password provided did not work. Please reload this page and try again.";
                exit;
        }



        if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
                // If username or password hasn't been set, display the login request.
                displayLogin();
        } else {
                // Escape both the password and username string to prevent users from inserting bogus data.
                $PHP_AUTH_USER = addslashes($_SERVER['PHP_AUTH_USER']);
                //$PHP_AUTH_PW = md5($PHP_AUTH_PW);
                $PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];

                // Check username and password against the database.
                $result = mysql_query("SELECT count(id) FROM fop2users WHERE secret='$PHP_AUTH_PW' AND exten='$PHP_AUTH_USER' ") or exit();

                $num = mysql_result($result, 0);

                if (!$num) {
                        // If there were no matching users, show the login
                        displayLogin();
                }
        }

?>

No hay comentarios:

Publicar un comentario