Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once( "mta_sdk.php" );
- //$input = mta::getInput();
- //mta::doReturn($input[0] + $input[1]);
- $db_host = 'localhost';
- $db_user = 'root';
- $db_pass = 'haslodobazy';
- $db_name = 'lslife';
- function dbInit()
- {
- global $db_host,$db_name,$db_pass,$db_user;
- try
- {
- $db = new PDO("mysql:host=".$db_host.";dbname=".$db_name."", $db_user, $db_pass);
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $db->query('SET NAMES utf8');
- }
- catch(PDOException $e)
- {
- echo $e->getMessage();
- }
- $GLOBALS['db']=$db;
- return $db;
- }
- function authorization($login,$pass)
- {
- dbInit();
- global $db;
- $query = "SELECT members_pass_salt as salt,members_pass_hash as pass FROM fg_core_members WHERE name=:nick";
- $result = $db->prepare($query);
- $result->bindParam(':nick',$login);
- $result->execute();
- $count = $result->rowCount();
- if($count==0)
- {
- echo "false";
- }
- else
- {
- $result = $result->fetchAll(PDO::FETCH_ASSOC);
- $password = crypt( $pass, '$2a$13$' . $result[0]['salt'] );
- if($password==$result[0]['pass'])
- {
- echo "true";
- }
- else
- {
- echo "false";
- }
- }
- }
- if(!empty($_POST['usr'])&& !empty($_POST['pass']))
- {
- $usr = $_POST['usr'];
- $pass = $_POST['pass'];
- authorization($usr,$pass);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement