Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "10.1.8.198";
- $user = "quintaainfo1516";
- $password = "diploma2016";
- $conn = mysql_connect($host, $user, $password);
- if(isset($_POST['login'])){
- $usr = trim($_POST['username']);
- $pass= md5($_POST['password']);
- if(!$conn){
- die("errore in connessione - " . mysql_error());
- }
- echo "utente errato";
- mysql_select_db(quintaainfo1516,$conn) or die("Accesso al database non riuscito - " . mysql_error());
- $query = "select Username,Password from g17atleti where Username='$usr' and Password='$pass'";
- $ris_query = mysql_query($query,$conn);
- mysql_close($conn);
- $flag=0;
- while ($riga=mysql_fetch_array($ris_query)) {
- if( ($usr == $riga['Username']) && ($pass == $riga['Password']) ){
- $flag=1;
- break;
- }
- }
- if($flag == 0){
- echo "utente errato";
- header("Location: login.html");
- }
- else{
- echo "benvenuto";
- session_start();
- $_SESSION['usr']=$usr;
- header("Location: user.php");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement