Commit 254ca3d7 by alsunj

Upload New File

parent 0baa5e54
Showing with 50 additions and 0 deletions
<?php
$con = mysqli_connect('localhost', 'root','root', 'unity', '3306');
if(mysqli_connect_errno())
{
echo "1";
exit();
}
//unitysse sisestatud kasutajanimi ja parool
$username = $_POST['name'];
$password = $_POST['password'];
//päring, mis võtab andmebaasist hashi ja pangaseisu sisestatud kasutajanimele
$namecheckquery = "SELECT username, hash, bank FROM users WHERE username= '" . $username . "';";
//teostab päringut
$namecheck = mysqli_query($con, $namecheckquery) or die("4");
//valesti kirjutatud kasutajanimi, ei eksisteeri
if (mysqli_num_rows($namecheck) != 1)
{
echo "Nime ei eksisteeri";
exit();
}
//salvestab teostatud päringu tulemused
$existinginfo = mysqli_fetch_assoc($namecheck);
//salvestab 'hashi'
$hash = $existinginfo['hash'];
//kontrollib kas krupteerides parool ja hash on samad.
$pwcheck = password_verify($password, $hash);
// kui parool on sama, siis väljastab nulli, pärast mida on suur tühik ja väljastatakse pangaseis
if ($pwcheck == true)
{
echo "0\t" . $existinginfo["bank"];
}
else{
echo "vale parool";
exit();
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment