Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $link = mysqli_connect("localhost", "root", "lab223", "world");
- if (!$link) {
- echo "Error: Unable to connect to MySQL." . PHP_EOL;
- }
- else echo 'Succes <br>';
- echo 'sunt in validare';
- //print_r($_POST);
- $user = $_POST['username'];
- $password = $_POST['password'];
- echo '<br>'.$user.' '.$password;
- $cerere = "select count(*) from users where username = '".$user."' and password = sha1('".$password."')";
- $result = mysqli_query($link, $cerere);
- $row = mysqli_fetch_row($result);
- if($row[0] > 0) {
- echo 'Autentificare cu succes';}
- else {header("Location: http://localhost/"); exit;}
- mysqli_free_result($result);
- mysqli_close($link);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement