Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("./includes/Header.php");
- $pagina = 'Autentificare';
- if(isset($_SESSION['username']))
- {
- Header("Location: /panel");
- return 1;
- }
- if(isset($_POST['login']))
- {
- if($Informatii['Criptare'] == 1)
- {
- $salt = '78sdjs86d2h';
- $username = mysqli_real_escape_string($DB_H, addslashes($_POST['username']));
- $password = mysqli_real_escape_string($DB_H, addslashes($_POST['password']));
- $hash1 = hash('sha256', $password . $salt);
- $hash = strtoupper($hash1);
- $password = $hash;
- }
- if($Informatii['Criptare'] == 0)
- {
- $username = mysqli_real_escape_string($DB_H, addslashes($_POST['username']));
- $password = mysqli_real_escape_string($DB_H, addslashes($_POST['password']));
- }
- $dbh = new PDO("mysql:host=".$mysqli['SQL_HOST'].";dbname=".$mysqli['SQL_DB']."", "".$mysqli['SQL_USER']."", "".$mysqli['SQL_PASS']."");
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $stmt = $dbh->prepare("SELECT id, Name, password FROM ".$mysqli['SQL_ACCOUNTS']."
- WHERE Name = :numele AND password = :parola");
- /*** bind the parameters ***/
- $stmt->bindParam(':numele', $username, PDO::PARAM_STR);
- $stmt->bindParam(':parola', $password, PDO::PARAM_STR, 40);
- /*** execute the prepared statement ***/
- $stmt->execute();
- /*** check for a result ***/
- $user_id = $stmt->fetchColumn();
- /*** if we have no result then fail boat ***/
- if($user_id == false)
- {
- $msg = "Parola introdusă de tine este greșită!";
- }
- /*** if we do have a result, all is well ***/
- else
- {
- /*** set the session user_id variable ***/
- $_SESSION['username'] = $username;
- $_SESSION['password'] = $password;
- echo "
- <script type='text/javascript'>
- <!--
- function Redirect()
- {
- window.location='/panel/';
- }
- setTimeout('Redirect()', 50);
- //-->
- </script>";
- }
- }
- ?>
- <div class="breadcrumbs" id="breadcrumbs">
- <script type="text/javascript">
- try{
- ace.settings.check('breadcrumbs' , 'fixed')}
- catch(e){
- }
- </script>
- <ul class="breadcrumb">
- <li>
- <i class="icon-home home-icon">
- </i>
- <a href="index"><?= $Informatii['NumeleComunitatii'] ?>
- </a>
- </li>
- <li class="active">
- <i class="icon-angle-right">
- </i>
- <?php echo htmlspecialchars($pagina);?>
- </li>
- </ul>
- <div class="nav-search" id="nav-search">
- <form class="form-search" action="search.php">
- <span class="input-icon">
- <input type="text" placeholder="Caută un jucător.." name="name" class="nav-search-input" autocomplete="off">
- <i class="icon-search nav-search-icon">
- </i>
- </span>
- </form>
- </div>
- </div>
- <div class="page-content">
- <div class="row-fluid">
- <center>
- <h3>Autentificare</h3>
- <?php if(isset($msg)): ?>
- <h5><font color="red"><?= $msg ?></font></h5>
- <?php endif; ?>
- <hr>
- <form method="post" action="">
- <p>Numele tău din joc:</p>
- <input type="text" name="username">
- <p>Parola folosită la inregistrare:</p>
- <input type="password" name="password" value ="">
- <br>
- <button type="submit" name="login" class="btn btn-primary">Autentificare</button>
- <!-- <a type="submit" href ="recover.php" value="Recuperare" class="btn btn-primary">Recuperare</a> -->
- </form>
- <br><br>
- </center>
- </div>
- </div>
- <?php require_once("./includes/Footer.php"); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement