Tengo una web donde puedes ingresar normalmente con username y password
Pero necesito que no sea la unica opción, si no que tambien se pueda ingresar con card_number y password.
PD: card_number es una table en la base de datos.
ésto es como si estuvieras ingresando en instagram
Puedes ingresar con:
username y password
o
correo y password
pero quiero que se pueda ingresar con username o card_number y seguidamente la clave, lo quiero es que haya mas opciones, a continuacion mi login.php
Cita:
Saludos y muchas gracias. <?php
include('dbcon.php');
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
/* st.admin */
$resultFilms = $conn->prepare("select * from users where username = '$username' and password = '$password'")or die(mysql_error());
$resultFilms->execute();
$num_row = $resultFilms->rowcount();
$row = $resultFilms->fetch();
/* teach.distributor */
$query_teacher = $conn->prepare("SELECT * FROM program_coordinator WHERE username='$username' AND password='$password'")or die(mysql_error());
$query_teacher->execute();
$num_row_teacher = $query_teacher->rowcount();
$row_teahcer = $query_teacher->fetch();
if( $num_row > 0 ) {
$_SESSION['id']=$row['user_id'];
echo 'true_user';
$conn->query("insert into user_log (username,login_date,user_id)values('$username',NO W(),".$row['user_id'].")")or die(mysql_error());
}else if ($num_row_teacher > 0){
$_SESSION['id']=$row_teahcer['program_coordinator_id'];
echo 'true';
$conn->query("insert into user_log (username,login_date,user_id)values('$username',NO W(),".$row_teahcer['program_coordinator_id'].")")or die(mysql_error());
} else{
echo 'false';
}
?>
include('dbcon.php');
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
/* st.admin */
$resultFilms = $conn->prepare("select * from users where username = '$username' and password = '$password'")or die(mysql_error());
$resultFilms->execute();
$num_row = $resultFilms->rowcount();
$row = $resultFilms->fetch();
/* teach.distributor */
$query_teacher = $conn->prepare("SELECT * FROM program_coordinator WHERE username='$username' AND password='$password'")or die(mysql_error());
$query_teacher->execute();
$num_row_teacher = $query_teacher->rowcount();
$row_teahcer = $query_teacher->fetch();
if( $num_row > 0 ) {
$_SESSION['id']=$row['user_id'];
echo 'true_user';
$conn->query("insert into user_log (username,login_date,user_id)values('$username',NO W(),".$row['user_id'].")")or die(mysql_error());
}else if ($num_row_teacher > 0){
$_SESSION['id']=$row_teahcer['program_coordinator_id'];
echo 'true';
$conn->query("insert into user_log (username,login_date,user_id)values('$username',NO W(),".$row_teahcer['program_coordinator_id'].")")or die(mysql_error());
} else{
echo 'false';
}
?>