Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <?php
- if($_SERVER['QUERY_STRING']!=""){
- $utente = $_GET ['utente'];
- $pass = $_GET['password'];
- $Link = mysqli_connect("ip", "xxx", "yyyy", "anzzzdrea");//mi connetto al database
- if(!$Link){
- echo "<head></head><body>";
- echo "Error: Unable to connect to MySql".PHP_BOL."<br>";
- echo "Debugging Errno: ".mysqli_connect_errno().PHP_BOL."<br>";
- echo "Debugging Error: ".mysqli_connect_error().PHP_BOL."<br>";
- echo"</body>";
- die();
- //die("error");
- }
- //echo "Connessione stabilita(Connection succesfully)";
- $queryString = "SELECT * FROM Utenti WHERE User='$utente' AND Password='$pass'";
- $loggato = mysqli_query($Link, $queryString);
- $numeroDiRighe = mysqli_num_rows($loggato);
- echo "<head>";
- if($numeroDiRighe == 1){
- echo "<meta http-equiv='refresh' content ='3, url=Ciao.php'>";
- }
- echo "</head><body>";
- if($numeroDiRighe == 1){
- echo "Ti sei loggato correttamente <br>";
- }else{
- echo "Login Fallito";
- VisualizzaForm();
- }
- mysqli_close($Link);
- echo "</body>";
- }else{
- echo "<head></head><body>";
- VisualizzaForm();
- echo"</body>";
- }
- ?>
- </html>
- <?php
- function VisualizzaForm(){
- echo "<form action='AccediDatabase.php' method='get'>";
- echo "User: <input type = 'text' name= 'utente'><br>";
- echo "Password: <input type='password' name='password'><br>";
- echo "<input type= 'submit' value='accedi'><br>";
- echo "</form>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement