Kaynağa Gözat

replaced old files from master branch

pull/16/head
Rick Payton 7 yıl önce
ebeveyn
işleme
bac2711b0a
3 değiştirilmiş dosya ile 22 ekleme ve 25 silme
  1. +19
    -23
      login.php
  2. +0
    -1
      logout.php
  3. +3
    -1
      style.css

+ 19
- 23
login.php Dosyayı Görüntüle

@@ -7,33 +7,29 @@
<BODY>
<CENTER>
<?php
include_once ('connection.php');
require "lib/password.php";
$con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
include_once ('connect.php');
$con = mysqli_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
session_start();
$username = mysqli_real_escape_string($con, $_POST['username']);
$password = mysqli_real_escape_string($con, $_POST['password']);
# $password = sha1($password); //this is the original line of code, just found sha1isn't any better than md5
$passhash = password_hash($password, PASSWORD_BCRYPT, array("cost" => 15));
$password = $_POST['password'];

if ($con->connect_errno > 0){
die ('Unable to connect to database [' . $db->connect_errno . ']');
}
$sqllogin = "SELECT * FROM users WHERE users.username = '$username' and passwd = '$passhash'";
if ($result = $con->query($sqllogin)){
$row_cnt = mysqli_num_rows($result);
if ($row_cnt > 0){
while ($row = $result->fetch_array()){
$uname = $row['username'];
$uid = $row['userid'];
$_SESSION['username'] = $uname;
$_SESSION['userid'] = $uid;
}
header("refresh:1;url=index.php");
echo 'You have successfully logged in ...<BR />Returning to index in a few seconds</CENTER>';
} else {
echo 'That was not a valid username or password!<BR /><BR />';
echo 'Please try again <A HREF="index.php" CLASS="navlink">here</A></CENTER>';
}
$sqluname = "select * from userinfo where username = '$username'";
$result = mysqli_query($con, $sqluname);
$row = mysqli_fetch_row ($result);
$verifypass = password_verify ($password,$row[2]);
if ($verifypass) {
$_SESSION['userid'] = $row[0];
$_SESSION['username'] = $row[1];
$_SESSION['usermail'] = $row[3];
$_SESSION['admin'] = $row[4];
include_once ('header.php');
header("refresh:1;url=index.php");
echo '<center>You have successfully logged in!<br />';
} else {
echo 'The username or password provided don\'t match!<br />Please <a href="index.php" class="navlink">try again</a><br />';
exit();
}
include_once ('footer.php');
?>

+ 0
- 1
logout.php Dosyayı Görüntüle

@@ -15,5 +15,4 @@ if ($logout == "logout"){
} else {
echo '<CENTER>Something went wrong, you haven\'t been logged out!<BR /><BR />Please click <A HREF="logout.php" CLASS="navlink">HERE</A> to try again</CENTER>';
}
include_once ('footer.php');
?>

+ 3
- 1
style.css Dosyayı Görüntüle

@@ -10,9 +10,11 @@ a.navlink:link { color: #003366; font-weight: bold; text-decoration: none; }
a.navlink:visited { color: #003366; font-weight: bold; text-decoration: none; }
a.navlink:hover { color: #CCCCCC; font-weight: bold; text-decoration: none; }

td {
table td {
font-family: Tahoma; font-size: 13px;
display: table-cell;
vertical-align: center;
text-align: center;
}

.title {


Yükleniyor…
İptal
Kaydet