new Senha[64]; SHA256_PassHash(inputtext,HASH_SENHA,Senha,64); mysql_format(ConnectMYSQL, query, sizeof(query), "SELECT * FROM accounts WHERE Senha = '%e' AND Username ='%s'", Senha, GetName(playerid)); mysql_pquery(ConnectMYSQL, query, "OnLogin", "d", playerid);
forward OnLogin(playerid); public OnLogin(playerid) { new rows, fields; cache_get_row_count(rows); cache_get_field_count(fields); if(rows) { OnPlayerLogin(playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Incorrect Password!", "Please enter a correct password in order to log-in\nPress log-in to continue", "Log-in", "Quit"); } return 1; }
<center> <h2>Login</h2> <form role="form" method="POST" action="actions/verificar.php"> <div class="container_login"> <label><b>Username</b></label> <input type="text" placeholder="Enter Username" name="usr" required> <br> <label><b>Password</b></label> <input type="password" placeholder="Enter Password" name="psw" required> <br> <button type="submit">Login</button> </div> </center>
<html>
<head>
<title> SAMP </title>
</head>
<body>
<?php
$conexao = mysqli_connect("host", "user", "password", "database");
session_start();
if(isset($_SESSION['Nome']))
{
echo "Vocк jб estб logado como <strong>$_SESSION[Nome]</strong>!";
exit();
}
if(isset($_POST['usr']) && isset($_POST['psw']) && isset($_POST['botao']))
{
$usuario = mysqli_real_escape_string($conexao, $_POST['usr']);
$senha = strtoupper(hash("sha256", $_POST['psw'] . $HASH_SENHA));
$query = mysqli_query($conexao, "SELECT UserID, Username, Senha FROM accounts WHERE Username='$usuario' AND Senha='$senha' LIMIT 1");
if(mysqli_num_rows($query) < 1)
{
//usuбrio ou senha invбlidos
$loginFail = 1;
}
else
{
//login efetuado
$dados = mysqli_fetch_assoc($query);
$_SESSION['ID'] = $dados['UserID'];
$_SESSION['Nome'] = $dados['Username'];
$_SESSION['Senha'] = $dados['Senha'];
header("location: login.php");
}
}
?>
<center>
<h2>Login</h2>
<?php if(isset($loginFail)) echo "ERRO: Usuбrio ou senha invбlidos!"; ?>
<form role="form" method="post" action="">
<div class="container_login">
<label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="usr">
<br>
<label><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw">
<br>
<button type="submit" name="botao">Login</button>
</div>
</form>
</center>
</body>
</html>
<?php
$conexao = mysqli_connect($hostname, $username, $password, $database);
session_start();
if(isset($_SESSION['Nome']))
{
echo "Vocк jб estб logado como <strong>$_SESSION[Nome]</strong>!";
exit();
}
if(isset($_POST['usr']) && isset($_POST['psw']) && isset($_POST['botao']))
{
$usuario = mysqli_real_escape_string($conexao, $_POST['usr']);
$senha = hash("sha256", $HASH_SENHA, $_POST['psw']);
$query = mysqli_query($conexao, "SELECT UserID, Username, Senha FROM accounts WHERE Username='$usuario' AND Senha='$senha' LIMIT 1");
if(mysqli_num_rows($query) < 1)
{
//usuбrio ou senha invбlidos
$loginFail = 1;
}
else
{
//login efetuado
$dados = mysqli_fetch_assoc($query);
$_SESSION['ID'] = $dados['UserID'];
$_SESSION['Nome'] = $dados['Username'];
$_SESSION['Senha'] = $dados['Senha'];
header("location: login.php");
}
}
?>
<center>
<h2>Login</h2>
<?php if(isset($loginFail)) echo "ERRO: Usuбrio ou senha invбlidos!"; ?>
<form role="form" method="post" action="">
<div class="container_login">
<label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="usr">
<br>
<label><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw">
<br>
<button type="submit" name="botao">Login</button>
</div>
</form>
</center>
<?php
require_once('config.php');
?>
<?php
$hostname = 'localhost';
$username = 'root';
$database = 'samp';
$password = 'msdm15';
$HASH_SENHA = 'KOSDXEABXLPQWAEOIEOXP';
?>
$senha = hash("sha256", $HASH_SENHA . $_POST['psw']);
$senha = strtoupper(hash("sha256", $HASH_SENHA . $_POST['psw']));
$senha = strtoupper(hash("sha256", $_POST['psw'] . $HASH_SENHA));
Tente:
PHP код:
|