Created
January 27, 2014 15:09
-
-
Save juanwilde/8650049 to your computer and use it in GitHub Desktop.
acceso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(isset($_POST['intro'])){ | |
$link = mysql_connect('localhost', 'root', 'admin') | |
or die('No se ha podido conectar al server'); | |
mysql_select_db('dwes') or die('No se ha encontrado la base de datos'); | |
$query = 'select * from usuarios'; | |
$result = mysql_query($query, $link); | |
$is = false; | |
while($lines = mysql_fetch_row($result)){ | |
if(($lines[0] == $_POST['user'] && $lines[1] == $_POST['pass'])){ | |
$is = true; | |
} | |
} | |
if($is && $_POST['user'] == 'admin'){ | |
echo 'estás dentro administrador!!'; | |
} | |
else if($is && $_POST['user'] == 'invitado'){ | |
echo 'estás dentro invitado!!'; | |
} | |
else{ | |
echo 'Error'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment