02.04.2013, 18:20
I am using a vortex 2 script and I am wondering how I would recive hashed passwords from my data, this is what I have so far with checking login details.
PHP код:
<?php
ob_start();
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="samp"; // Database name
$tbl_name="playeraccounts"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// To protect MySQL injection (more detail about MySQL injection)
$Username = stripslashes($username);
$Password = stripslashes($password);
$Username = mysql_real_escape_string($Username);
$Password = mysql_real_escape_string($Password);
$sql="SELECT * FROM $tbl_name WHERE playerName='$Username' and playerPassword='". hash('whirlpool', $Password) ."'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
session_register("Username");
session_register("Password");
header("location:Dashboard.php");
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
?>