硕士学位等级奋斗.php,SQL问题! [英] Master degree grade struggle.php, SQL question!
问题描述
您好我已经创建了这个Web应用程序的硕士学位,但我需要您的帮助来做一些事情!所以这个网络应用程序都是关于学习。有老师和学生。我创建了数据库来存储用户,我创建了2个表('教师'和'学生')。所以注册表已经完成并且有效。我可以注册到两个表。我只有1个登录页面(表格),我可以作为老师和学生登录,但我想要的是能够定义,如果用户是老师,可以访问不同主题的上传。基本上我需要代码检查教师的表格,以及用户是否存在将他重定向到教师主页。!
我的实际登录页面代码是这个!:
任何帮助都会非常感激。
我正在使用Xampp!
Hello so i have created this web application for a master degree grade but i need your help to do something! So this web app is all about learning. There are teachers and students. I have created the database to store the users and i have created 2 tables ('teachers' and 'students'). So the registration form is done and works.I can register to both tables. I have only 1 login page(form) where i can login both as a teacher and student but what I want is to be able to define that if a user is a 'teacher' to have access to the uploads for different subjects.Basically i need the code to check the teachers' table and if the user exists redirect him to the teacher homepage.!
My actual login page code is this!:
Any help would be very appreciated .
I am using Xampp!
<?php
session_start();
require_once("class.user.php");
$login = new USER();
if($login->is_loggedin()!="")
{
$login->redirect('home.php');
}
if(isset($_POST['btn-login']))
{
$uname = strip_tags($_POST['txt_uname_email']);
$umail = strip_tags($_POST['txt_uname_email']);
$upass = strip_tags($_POST['txt_password']);
if($login->doLogin($uname,$umail,$upass))
{
$login->redirect('home.php');
}
else
{
$error = "Emaili ose fjalëkalimi ishin gabim. Ju lutem provoni përsëri";
}
if($login->doLogin_teacher($uname,$umail,$upass))
{
$login->redirect('home.php');
}
else
{
$error = "Emaili ose fjalëkalimi ishin gabim. Ju lutem provoni përsëri";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IB-Learning</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="bootstrap/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="signin-form">
<div class="container">
<form class="form-signin" method="post" id="login-form">
<h2 class="form-signin-heading">Kyquni tani!</h2><hr />
<div id="error">
<?php
if(isset($error))
{
?>
<div class="alert alert-danger">
<?php echo $error; ?> !
</div>
<?php
}
?>
</div>
<div class="form-group">
<input type="text" class="form-control" name="txt_uname_email" placeholder="Username ose Emaili juaj" required />
<span id="check-e"></span>
</div>
<div class="form-group">
<input type="password" class="form-control" name="txt_password" placeholder="Fjalëkalimi juaj" />
</div>
<hr />
<div class="form-group">
<button type="submit" name="btn-login" class="btn btn-default">
Kyquni
</button>
</div>
<br />
<label>Nuk jeni regjistruar ende? <a href="sign-up_student.php">Regjistrohuni këtu</a></label>
</form>
</div>
</div>
</body>
</html>
我尝试过:
我没有尝试过任何东西,因为我不知道怎么做!!
请帮忙......
What I have tried:
I haven't tried anything because i dont know how!!
Please help...
推荐答案
login = new USER();
if(
login = new USER(); if(
login-> is_loggedin()!=)
{
login->is_loggedin()!="") {
login - >重定向( 'home.php');
}
if(isset(
login->redirect('home.php'); } if(isset(
这篇关于硕士学位等级奋斗.php,SQL问题!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!