Posts: 775
Threads: 78
Joined: Dec 2014
We need to see your <form> tags in HTML.
(Don't ask me why I'm helping you.)
Posts: 775
Threads: 78
Joined: Dec 2014
Quote:
Originally Posted by alexanderjb918
Код HTML:
<?php
$variable1 = $_POST['var1'];
$variable2 = $_POST['var2'];
$variable3 = $_POST['var3'];
$variable4 = $_POST['var4'];
$keycodee = $variable3;
$hwid = $variable3;
$uname = $variable1;
$passworda = $variable2;
$server = "";
$username = "";
$password = "";
$dbname = "";
$pwrd = sha1(strtolower($uname) . $passworda);
// Create connection
$conn = new mysqli($server, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
//Declare SQL statement
$sql = "SELECT Username, Password FROM login WHERE Username= '$uname'";
//Catch result
$result = $conn->query($sql);
//Check for result
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$checkuname = $row["Username"];
$checkpwrd = $row["Password"];
$hwiddd = $row["HWIDMAC"];
//echo "id: " . $checkgroup. " - Name: " . $checkuname. " " . $checkpwrd . "<br>";
}
}
if ($uname == $checkuname && $pwrd == $checkpwrd)
{
echo "1";
}
else
{
echo "Pword/Uname is wrong";
}
//if ($uname != $checkuname) echo "Your username could not be found";
//if ($pwrd != $checkpwrd) echo "Your password was incorrect";
$conn->close();
?>
Always says echo "Pword/Uname is wrong";
|
[/QUOTE]
Again, That's the PHP,
We need the HTML, Where doyou have this PHP code? Give us either the whole html page or only the <form> tag.
Posts: 775
Threads: 78
Joined: Dec 2014
Also, Why do you have strltolower?
Basically-> You're turning all letters down to lowercased, then hash it with sha1.
Why?
Posts: 100
Threads: 35
Joined: Jan 2012
Leave him be, He's new to PHP it looks like.
If you want more assistance i've added your skype.
- Alexander
Posts: 324
Threads: 108
Joined: Dec 2013
Reputation:
0
I am new to PHP coding as you see the code is 'aids' this is a post login script via a c++ application that gets posts/requests then logs the client in if the information is correct.
Posts: 775
Threads: 78
Joined: Dec 2014
Quote:
Originally Posted by minijackc
Leave him be, He's new to PHP it looks like.
If you want more assistance i've added your skype.
- Alexander
|
No offence but I did not mean to harm anyone, I just needed to know why he did so.
____________________________________
PHP код:
<?php
$conn = new mysqli($server, $username, $password, $dbname);
if ($conn->connect_error)
die("Connection failed: " . $conn->connect_error);
if(isset($_POST["submit"])) {
if(!is_null($_POST["username"])) {
if(!is_null($_POST["password"])) {
$username = $conn->real_escape_string(stripslashes($_POST['username']));
$password = sha1($conn->real_escape_string(stripslashes($_POST['password'])));
$sql = "SELECT Username, Password FROM login WHERE Username= '$username' AND Password= '$password'";
$result = $conn->query($sql);
if($result->num_rows > 0) {
echo "logged in.";
}
}
else
echo "Don't leave the password empty.";
}
else
echo "Don't leave the username empty.";
}
$conn->close();
?>
Now it wont work, cause you need to get the name="" in the <input> in order to handle a form request.
So that's why we can't help you without the html.