<?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(); ?>
<?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(); ?>
Код 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(); ?> |
Leave him be, He's new to PHP it looks like.
If you want more assistance i've added your skype. - Alexander |
<?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();
?>