<?php session_start(); include "koneksi.php"; if(isset($_SESSION['playername'])) { go('index.php', 'You already logged in.'); } if(!isset($_POST['username'], $_POST['password'])) { go('index.php', 'Please fillout all required forms.'); } else { $query = $koneksi->prepare("SELECT `level`,`name` from `player` where `name` = ? and `password` = ?"); $query->execute(array($_POST['username'], strtoupper(hash("whirlpool", $_POST['password'])))); if($query->rowCount() > 0) { $data = $query->fetch(); go('index.php', 'Succesfully logged in.'); $_SESSION['playername'] = $data['name']; $_SESSION['playerlevel'] = $data['level']; } else { go('index.php', 'Wrong username or password.'); } }
<?php session_start(); include "koneksi.php"; if(isset($_SESSION['playername'])) { go('index.php', 'You already logged in.'); } if(!isset($_POST['username'], $_POST['password'])) { go('index.php', 'Please fillout all required forms.'); } else { $query = $koneksi->prepare("SELECT `playerLevel`,`playerName` from `playerdata` where `name` = ? and `password` = ?"); $query->execute(array($_POST['username'], strtoupper(hash("whirlpool", $_POST['password'])))); if($query->rowCount() > 0) { $data = $query->fetch(); go('index.php', 'Succesfully logged in.'); $_SESSION['playername'] = $data['name']; $_SESSION['playerlevel'] = $data['level']; } else { go('index.php', 'Wrong username or password.'); } }
<?php
session_start();
include "koneksi.php";
if(isset($_SESSION['playername']))
{
go('index.php', 'You already logged in.');
}
if(!isset($_POST['username'], $_POST['password']))
{
go('index.php', 'Please fillout all required forms.');
}
else
{
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$hashedpw = strtoupper(hash("whirlpool", $_POST['password']));
$check = get_row("SELECT `playerLevel`,`playerName` from `playerdata` where `name` = '$username' and password = '$hashedpw'");
if(isset($check['playerLevel']))
{
go('index.php', 'Succesfully logged in.');
$_SESSION['playername'] = $check['name'];
$_SESSION['playerlevel'] = $check['level'];
}
else
{
go('index.php', 'Wrong username or password.');
}
}
?>
( ! ) Deprecated: mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in G:\wamp\www\check.php on line 15 Call Stack # Time Memory Function Location 1 0.0557 251296 {main}( ) ..\check.php:0 2 0.2266 262832 mysql_real_escape_string ( ) ..\check.php:15 ( ! ) Fatal error: Call to undefined function get_row() in G:\wamp\www\check.php on line 20 Call Stack # Time Memory Function Location 1 0.0557 251296 {main}( ) ..\check.php:0
I get this error when logging in, doesn't show "Wrong username or password."
Код:
( ! ) Deprecated: mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in G:\wamp\www\check.php on line 15 Call Stack # Time Memory Function Location 1 0.0557 251296 {main}( ) ..\check.php:0 2 0.2266 262832 mysql_real_escape_string ( ) ..\check.php:15 ( ! ) Fatal error: Call to undefined function get_row() in G:\wamp\www\check.php on line 20 Call Stack # Time Memory Function Location 1 0.0557 251296 {main}( ) ..\check.php:0 |
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$username = $_POST['username'];
$password = $_POST['password'];
function get_row($q)
{
$pq = mysql_query($q);
if($pq === FALSE) {
die(mysql_error()); // better error handling
}
$p = mysql_fetch_array($pq); // fetching the array
return $p;
}
( ! ) Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in G:\wamp\www\check.php on line 5 Call Stack # Time Memory Function Location 1 0.0020 254024 {main}( ) ..\check.php:0 2 0.0205 265264 get_row( ) ..\check.php:32 3 0.0205 265312 mysql_query ( ) ..\check.php:5 No database selected
Код:
( ! ) Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in G:\wamp\www\check.php on line 5 Call Stack # Time Memory Function Location 1 0.0020 254024 {main}( ) ..\check.php:0 2 0.0205 265264 get_row( ) ..\check.php:32 3 0.0205 265312 mysql_query ( ) ..\check.php:5 No database selected |
mysql_ function is deprecated and afaik, already removed on PHP 7.
You can hide that error by adding error_reporting(0); or error_reporting(E_ALL &~ E_DEPRECATED); at top of your script. |
He could do this but is not really recommended for using. Best way for him is fixing that error.
|