• Trong thời gian này, bạn không thể tạo bài mới, đăng comment, hay tạo tài nguyên mới để diễn đàn dọn dẹp nội dung.
    Diễn đàn sẽ sớm mở trở lại, chi tiết hãy theo dõi tại Discord
GodIsHere

Hỏi đáp login.php bị lỗi

  • Người tạo chủ đề Người tạo chủ đề GodIsHere
  • Ngày gửi Ngày gửi
Trạng thái
Không mở trả lời sau này.
Hồi đấy mình có code 1 website cho server mình lúc đầu thì website vẫn hoạt độn bình thường nhưng sau khi vps mình hết hạn mình phải thuê một vps mới và mình có lưu lại file code website bây giờ mình open xampp mở lại web thì web lại bị lỗi nguyên phần authme trong khi mình đã kiểm tra đầy đủ mọi người ai rành về code web mà biết lỗi này thì giúp mình nhé!
fb mình là: https://www.facebook.com/khailuong.tommy.3
Đây là phần code login:
https://pastebin.com/3P7mTDVj
Còn đây là lỗi trên website báo:
https://pastebin.com/xLbSHbkQ
@Banbeucmas plz help
 
ad biết cách fix r k cần code đâu =))
 
Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'WIN-VCQUKKDO8FH' (using password: YES) in C:\xampp\htdocs\login.php on line 28
Warning: mysqli_set_charset(): Couldn't fetch mysqli in C:\xampp\htdocs\login.php on line 29 Warning: mysqli::query(): Couldn't fetch mysqli in C:\xampp\htdocs\login.php on line 30 Notice: Trying to get property 'num_rows' of non-object in C:\xampp\htdocs\login.php on line 32 Warning: mysqli::close(): Couldn't fetch mysqli in C:\xampp\htdocs\login.php on line 49
Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'WIN-VCQUKKDO8FH' (using password: YES) in C:\xampp\htdocs\login.php on line 28
đây là nguyên nhân
không kết nối tới user được thì phần sau sẽ ko hoạt đông
p/s > đừng xài tài khoản "root", hãy tạo tài khoản khác để kết nối
và thêm session_start(); vào đầu trang
 
<?php
include_once("./includes/main.php");

session_start();
if(isLogged()){
header("Location: .");
}
/*********************************/
$error = null;
$ready = true;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["user"])):
$error .= "Tài khoản không được để trống!<br>";
$ready = false;
else:
$user = $_POST["user"];
endif;

if (empty($_POST["pass"])):
$error .= "Mật khẩu không được để trống!<br>";
$ready = false;
else:
$pass = $_POST["pass"];
endif;

if($ready){
$conn = new mysqli('thegamingminecraft.com', 'root', '!!--PASSWORD--!!', 'authme');
mysqli_set_charset($conn,"utf8");
$hasin = $conn->query("SELECT * FROM `authme` WHERE `username`='". $user ."'");

if ($hasin->num_rows > 0):
while($aif = $hasin->fetch_assoc()) {

$shainfo = explode("$", $aif["password"]);
$pass = hash("sha256", $pass) . $shainfo[2];
$passxxx = strcasecmp($shainfo[3], hash('sha256', $pass)) == 0;

if($passxxx):
$_SESSION["authsession"] = $user;
echo "<script>window.location.href = '.';</script><meta http-equiv='refresh' content='0; url='.'>";
else:
$error .= "Sai mật khẩu!<br>";
endif;
}
else:
$error .= "Không có tài khoản này!<br>";
endif;
$conn->close();
}
}
/*********************************/
if($error != null):
$error = '<div class="alert">'. $error .'</div>';
else:
$error = '';
endif;
?>
<!Doctype html>
<html lang="vi">
<head>
<meta charset="utf-8">
<title> TheGMC | ĐĂNG NHẬP</title>
<meta charset="utf-8">
<meta http-equiv="content-language" content="vi" />
<meta name="robots" content="noodp,index,follow">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link href="//www.google-analytics.com" rel="dns-prefetch" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>
<link rel="icon" type="image/png" href="./includes/icon.png">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" /> <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700&amp;subset=vietnamese" rel="stylesheet">
<link href="./includes/main.css" rel="stylesheet">
<style>
form {
padding: 0 40px;
}
input {
padding: 6px 12px;
border: 1px #e7e7e7 solid;
display: block;
margin-bottom: 20px;
min-width: 400px;
font-family: 'Open Sans', sans-serif;
line-height: 1.6;
font-size: 15px;
border-radius: 5px;
}
input:hover, input:focus {
border-color: #2380ce;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
button {
padding: 8px 16px;
font-family: 'Open Sans', sans-serif;
cursor: pointer;
color: #fff;
line-height: 1.6;
font-size: 15px;
background-color: #51c1fe;
border: none;
border-radius: 5px;
}
button:hover, button:focus {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
background-color: #fff;
color: #51c1fe;
}
</style>
</head>
<body>
<div id="warpper"></div>
<div id="menu">
<ul>
<li>
<a href="index.php"><button class="btn btn-primary btn-xs">Trang chủ</button></a>
</li>
<li>
<a href="donate.php"><button class="btn btn-primary btn-xs">Nạp thẻ</button></a>
</li>
<?php if(!isLogged()) { ?>
<li>
<a href="login.php"><button class="btn btn-primary btn-xs">Đăng nhập</button></a>
</li>
<li>
<a href="register.php"><button class="btn btn-primary btn-xs">Đăng ký</button></a>
</li>
<?php } ?>
<li>
<a href="rank.php"><button class="btn btn-primary btn-xs">Danh sách Rank</button></a>
</li>
<li>
<a href="Minecraft Launcher.exe" download><button class="btn btn-primary btn-xs">Tải Game</button></a>
</li>
</ul>
</div>
<br>
<br>
<br>
<br>
<br>
<p align="center">
<form method="post" action="">
<h4 class="modal-title"><span style="font-size: 12pt; font-family: 'comic sans ms', sans-serif;">XIN HÃY NHẬP ĐÚNG TÊN VÀ MẬT KHẨU! </span></h4>
<?php echo $error; ?><br>
<input type="text" name="user" placeholder="Tài khoản" autocomplete="off" required />
<input type="password" name="pass" placeholder="Mật khẩu" autocomplete="off" required />
<button>Đăng nhập</button> <a href="forgot.php">Quên Mật Khẩu ?</a>
</form>
</body>
</html>
đánh dấu đậm là sửa đi
và làm ơn, khoe mật khẩu của mysql ra rồi kìa, fix đi
 
ko hẳn, đó chỉ là lời khuyên thôi, cũng ko nên xài acc root vì lí do bảo mật ấy mà
Mình cám ơn bạn mình đã fix đc web r nhưng tuy nhiên vẫn còn 1 số lỗi mình ko biết fix ạ
*****Nội dung được bổ sung thêm*****
ok do mình đã fix đc nên mình xin đóng topic nhé
 
Trạng thái
Không mở trả lời sau này.

Thống kê nội dung

Tạo
GodIsHere,
Trả lời lần cuối từ
GodIsHere,
Trả lời
15
Lượt xem
1,563
Quay lại
Trên cùng