Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("configs/main.php");
- if(!isset($_SESSION['username']))
- {
- if(isset($_POST['accountName']))
- {
- $accountName = mysql_real_escape_string(stripslashes($_POST['accountName']));
- $accountPass = mysql_real_escape_string(stripslashes($_POST['password']));
- function sha_password($user, $pass)
- {
- $user = strtoupper($user);
- $pass = strtoupper($pass);
- return SHA1($user.':'.$pass);
- }
- $sha_pass_hash = sha_password($accountName, $accountPass);
- if(!$con)
- {
- echo mysql_error();
- }
- $db_setup = mysql_select_db($db_realm)or die(mysql_error());
- $login_query = mysql_query("SELECT * FROM account WHERE username = '$accountName'");
- $login = mysql_fetch_assoc($login_query);
- if($login)
- {
- if(strtoupper($sha_pass_hash) == $login['sha_pass_hash'])
- {
- $_SESSION['username'] = $accountName;
- echo '<br /><br /><meta http-equiv="refresh" content="2"/>';
- }
- else
- {
- echo '<br /><br /><font color="red">Špatné heslo</font><meta http-equiv="refresh" content="2"/>';
- header('Location: index.php');
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment