function clearUser()
{
    if (isset($_POST['user']) && $_POST['user'] !== null && $_POST['user'] !== '') {
        $username = $_POST['user'];
        // lookup userid from db
        //echo "received Username: "******"") {
            // if user/password exists, check it, otherwise add new user
            if (usernameExists($username)) {
                $userId = getUserId($username);
                $pass = getPass($userId);
                // get pass from db
                if ($_POST['pass'] === $pass) {
                    return "user cleared.";
                } else {
                    return "invalid combination.";
                }
            } else {
                if (addUser($username, $_POST['pass'])) {
                    return "user cleared.";
                } else {
                    return "error creating new user.";
                }
            }
        } else {
            return "password cannot be empty.";
        }
    } else {
        return "username cannot be empty.";
    }
}
Beispiel #2
0
function validateApiLogin($data)
{
    // Get username -> password from DB (md5)
    $password = getPass($data['username']);
    // Compare password from DB to password from request
    // Note: getPass() returns empty string if username unknown in DB, so check for that!!
    if ($password != "" && $password == $data['password']) {
        return true;
    } else {
        return false;
    }
}
/**
 * Created by PhpStorm.
 * User: cjs2599
 * Date: 12/3/15
 * Time: 7:57 PM
 */
function conn()
{
    $host = "fall-2015.cs.utexas.edu";
    $user = "******";
    $pwd = getPass();
    $db = "cs329e_cjs2599";
    $port = "3306";
    $connect = mysqli_connect($host, $user, $pwd, $db, $port);
    if (empty($connect)) {
        die("mysqli_connect failed: " . mysqli_connect_errno());
    }
    return $connect;
}
?>
<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
  <link rel="stylesheet" type="text/css" href="./mystyle.css" />
<title> <?php 
echoString($lang, "title");
?>
 </title>
 </head>
 <body>

<?php 
$thesh = getThesh();
$pass = getPass();
$id = getId();
echo "<ul class=\"list_lang\" >";
echo "<li> <a href=\"music_vote.php?lang=GR&thesh={$thesh}&pass={$pass}\"> GR </a> </li>";
echo "<li> <a href=\"music_vote.php?lang=EN&thesh={$thesh}&pass={$pass}\"> EN </a> </li>";
echo "</ul>";
if ($thesh == -1 || $pass == -1 || correctPass($thesh, $pass) == 0) {
    echo "<ul class=\"list_main\" >";
    echo "<li>";
    echo getString($lang, "please_connect");
    echo "</li>";
    echo "</ul>";
    echo "<a class=\"button\" href=\"index.php?lang={$lang}\"> " . getString($lang, "connect") . " </a>";
} else {
    echo "<ul class=\"list_main\" >";
    echo "<li>";
            <br><br>
            <center>
            <form id="cambiarPassForm" method="POST" action="negocio/LogicaUsuario.php?accion=3">

                <!-- form para cambiar la contraseña!-->
                
                <input type="hidden" name="id" value="<?php 
echo $row['IdUsuario'];
?>
">

                <input id="pass1" name="pass1" type="password" placeholder="Contraseña Actual" required><br><br>
                <input id="pass2" name="pass2" type="password" placeholder="Nueva Contraseña" required>
                <br><br>
                
                <?php 
$passOriginal = getPass($row['Usuario']);
?>
                
                <button id="cambiarPass" type="button" onClick="comprobarPass(<?php 
echo $passOriginal;
?>
)">
                    Cambiar Contraseña
                </button>
            </form> 
            </center>
        </section>

    </body>
</html>
Beispiel #6
0
}
// $notauthorized - 1 = not logged in, 2 = incorrect pass, 0 = authorization ok
$notauthorized = 1;
$tempusername = @$_COOKIE[$AUTH['COOKIE_USERNAME']];
$temppassword = @$_COOKIE[$AUTH['COOKIE_PASSWORD']];
if (isset($doxlogin) && $X2CHATU != "" && $X2CHATP != "") {
    // Do first time login
    $tempusername = $X2CHATU;
    // DO NOT CHANGE THESE
    $temppassword = doXEncrypt($X2CHATP);
    // THEY ARE CORRECT!!!
    @setcookie($AUTH['COOKIE_USERNAME'], "{$tempusername}", time() + 14000000, "{$SERVER['PATH']}");
    @setcookie($AUTH['COOKIE_PASSWORD'], "{$temppassword}", time() + 14000000, "{$SERVER['PATH']}");
}
if (isset($tempusername) || isset($temppassword) && ($temppassword != "" && $tempusername != "")) {
    $pass = getPass($tempusername);
    if ($temppassword == $pass) {
        $notauthorized = 0;
        @setcookie($AUTH['COOKIE_USERNAME'], "{$tempusername}", time() + 14000000, "{$SERVER['PATH']}");
        @setcookie($AUTH['COOKIE_PASSWORD'], "{$temppassword}", time() + 14000000, "{$SERVER['PATH']}");
    } else {
        $notauthorized = 2;
        forceexit($X2CHATR, $X2CHATU);
        @setcookie($AUTH['COOKIE_USERNAME'], "", time() - 14000000, "{$SERVER['PATH']}");
        @setcookie($AUTH['COOKIE_PASSWORD'], "", time() - 14000000, "{$SERVER['PATH']}");
        @setcookie("X2CHATR", "", time() - 14000000, "{$SERVER['PATH']}");
        @setcookie("XLU", "", time() - 14000000, "{$SERVER['PATH']}");
    }
}
if (isset($dologout)) {
    $tempusername = "";
Beispiel #7
0
<?php

$username = $_REQUEST['user'];
$password = $_REQUEST['pass'];
if (empty($username)) {
    die("Username Empty");
}
if (empty($password)) {
    die("Password Empty");
}
require "admin_get.php";
$act_user = getUser();
$act_pass = getPass();
if ($username == $act_user) {
    if ($password == $act_pass) {
        setcookie("super", "61646d696e", time() + 3600, "/~comp19900/admin");
        header("Location: http://deepblue.cs.camosun.bc.ca/~comp19900/admin/home");
        die;
    } else {
        die("Password Wrong");
    }
} else {
    die("Username Wrong");
}
Beispiel #8
0
<?php

include '../data/dataUsuario.php';
$usuario = $_POST["nombreUsuario"];
$pass = $_POST["pass"];
$validarUsuario = getNombreUsuario($usuario);
if ($usuario != $validarUsuario) {
    //metodo para validar si el usuario esta registrado y armar la variable de sesion
    echo "<script> alert('Este usuario no se encuentra registrado, por favor intente de nuevo.');" . "window.location='../index.php'</script>";
} else {
    $validarPass = getPass($usuario);
    if ($pass != $validarPass) {
        //valida si la contraseña es correcta
        echo "<script> alert('Contraseña erronea, por favor intente de nuevo');" . "window.location='../index.php'</script>";
    } else {
        $tipoUsuario = getTipoUsuario($usuario);
        if ($tipoUsuario === "estudiante") {
            //si es tipo estudiante arma una variable de sesion estudiante
            session_start();
            $_SESSION['usuario'] = $usuario;
            $_SESSION['tipo'] = $tipoUsuario;
            $_SESSION['id'] = getIdUsuario($usuario);
            $_SESSION['nivel'] = getNivelUsuario($usuario);
            header('Location: ../menu.php');
        } else {
            //si no es tipo estudiante arma una variable de sesion admin
            session_start();
            $_SESSION['usuario'] = $usuario;
            $_SESSION['tipo'] = $tipoUsuario;
            $_SESSION['id'] = getIdUsuario($usuario);
            header('Location: ../menuAdmin.php');
    <h1>bBlog</h1>
    <h2>Password Recovery</h2>
</div>

<div style="width: 500px; margin-left: auto; margin-right: auto; margin-top: 80px;">
    <form action="index.php">
    <table border="0" class="list" cellpadding="4" cellspacing="0">
        <tr bgcolor="#ffffff">
            <td><?php 
echo "Connecting to DB to compare answers... ";
?>
</td>
        </tr>
        <tr bgcolor="#ffffff">
            <td><?php 
getPass();
?>
</td>
        </tr>
    </table>
    <p><input type="submit" name="submit" value="Return" /></p>
    </form>
</div>

<div id="footer">
    <a href="http://www.bBlog.com" target="_blank">bBlog 0.8</a> &copy; 2005 <a href="mailto:eaden@eadz.co.nz">Eaden McKee</a> &amp; <a href="index.php?b=about" target="_blank">Many Others</a>
</div>

</body>
</html>