Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once("dbconnection.php");
- var_dump("pre if post");
- if (isset($_POST['username']) && isset($_POST['password']))
- {
- var_dump("into if post");
- $username = mysqli_real_escape_string($conn, $_POST['username']);
- $password = mysqli_real_escape_string($conn, $_POST['password']);
- //$amm = $_POST['amm'];
- $sql = "SELECT Ruolo FROM utente where Username='$username' and Password=md5('$password');"
- $result = mysql_query($sql);
- var_dump("after query");
- //$row = $result->fetch_assoc();
- $ruolo=mysql_fetch_assoc($result);
- var_dump($ruolo);
- //if($login_info!=null){
- if ($ruolo=='Amministrator') {
- $_SESSION['username']=$result['username'];
- echo "<script>alert(\"Login effettuato con successo!\");
- window.setTimeout(function(){
- window.location.href = 'panel.php';
- }, 2000)</script>";
- else if ($ruolo=='User'){
- $_SESSION['username']=$result['username'];
- echo "<script>alert(\"Login effettuato con successo!\");
- window.setTimeout(function(){
- window.location.href = 'home.php';
- }, 2000)</script>";
- }
- }
- //}
- //else{
- echo "<script>alert(\"Non sei ancora registrato! Registrati prima di effettuare il login!\");</script>";
- //header("Location: index.html");
- //}
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement