25.03.2016, 20:26
Hello, So I basically, I took another Cops and Robbers script's UCP (California Cops and Robbers) and thought that I would use it for my Cops and Robbers server (the CCNR script was further developed from the script I'm using). So here is the default "check.php" that checks the login.
And here I modified it because the rows had different names of the script I'm using, Then it looks like this. But then I keep getting "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 `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.'); } }