-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f85a28
commit fddb9b0
Showing
3 changed files
with
136 additions
and
163 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,127 +1,89 @@ | ||
<html> | ||
|
||
<head> | ||
|
||
<title>Add User</title> | ||
|
||
<style type="text/css"> | ||
|
||
body { | ||
body { | ||
display: flex; | ||
min-height: 100vh; | ||
flex-direction: column; | ||
} | ||
main { | ||
} | ||
|
||
main { | ||
flex: 1 0 auto; | ||
} | ||
} | ||
|
||
body { | ||
background: #fff; | ||
} | ||
.container{ | ||
|
||
.container { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
display:flex; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
</style> | ||
|
||
<link rel="stylesheet" type="text/css" href="css/materialize.min.css"> | ||
|
||
</head> | ||
|
||
|
||
|
||
|
||
<body> | ||
<!-- | ||
<div class="container"> | ||
|
||
|
||
|
||
<div class="row"> | ||
<div class="section"></div> --> | ||
<main> | ||
|
||
|
||
<div class="container"> | ||
|
||
|
||
<div class="z-depth-3 y-depth-3 x-depth-3 grey green-text lighten-4 row" style="display: inline-block; width: 40%; padding: 0px 48px 0px 48px; border: 1px; margin-top: 10px; solid #EEE;"> | ||
|
||
<h3 style="color:#26a69a;margin-bottom:10%; ">Add User</h3> | ||
|
||
|
||
|
||
<i class="mdi-alert-error red-text"></i> | ||
|
||
|
||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="text" name='sub_code' id='sub_code' required / style="padding:"> | ||
<label for='submit'>Submit</label> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="text" name='p_id' id='p_id' required /> | ||
<label for='p_id'>PaperID</label> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="text" name='max_marks' id='max_marks' required /> | ||
<label for='max_marks'>Max. Marks</label> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="number" name='sem' id='sem' required /> | ||
<label for='sem'>Semester</label> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="number" name='year' id='year' required /> | ||
<label for='year'>Year</label> | ||
</div> | ||
</div> | ||
|
||
|
||
<!-- </div> --> | ||
|
||
|
||
<div class='row' style="color:white;padding:10%;"> | ||
<button style="margin-left:50px;color:white;font-size: 1rem" type='submit' name='btn_add_ppr' class='col s7 btn btn-small white waves-effect z-depth-1 y-depth-1 teal lighten-1'>sign up</button></div> | ||
|
||
|
||
|
||
|
||
<main> | ||
<div class="container"> | ||
<div class="z-depth-3 y-depth-3 x-depth-3 grey green-text lighten-4 row" style="display: inline-block; width: 40%; padding: 0px 48px 0px 48px; border: 1px; margin-top: 10px; solid #EEE;"> | ||
<h3 style="color:#26a69a;margin-bottom:10%; ">Add User</h3> | ||
<i class="mdi-alert-error red-text"></i> | ||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="text" name='sub_code' id='sub_code' required / style="padding:"> | ||
<label for='submit'>Submit</label> | ||
</div> | ||
</div> | ||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="text" name='p_id' id='p_id' required /> | ||
<label for='p_id'>PaperID</label> | ||
</div> | ||
</div> | ||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="text" name='max_marks' id='max_marks' required /> | ||
<label for='max_marks'>Max. Marks</label> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</main> | ||
|
||
</div> | ||
</div> | ||
|
||
<script type="text/javascript" src="js/materialize.min.js"></script> | ||
|
||
<script src="js/jquery-3.4.1.min.js"></script> | ||
|
||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="number" name='sem' id='sem' required /> | ||
<label for='sem'>Semester</label> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="number" name='year' id='year' required /> | ||
<label for='year'>Year</label> | ||
</div> | ||
</div> | ||
<div class='row' style="color:white;padding:10%;"> | ||
<button style="margin-left:50px;color:white;font-size: 1rem" type='submit' name='btn_add_ppr' class='col s7 btn btn-small white waves-effect z-depth-1 y-depth-1 teal lighten-1'>sign up</button></div> | ||
</div> | ||
</div> | ||
</main> | ||
</div> | ||
</div> | ||
<script type="text/javascript" src="js/materialize.min.js"></script> | ||
<script src="js/jquery-3.4.1.min.js"></script> | ||
</body> | ||
|
||
</html> | ||
<?php | ||
if(isset($_POST['btn_login'])){ | ||
$sql = 'SELECT * FROM user WHERE uname = "'.$_POST["username"].'" and password ="'.$_POST["password"].'"'; | ||
$result = mysqli_query($conn,$sql); | ||
if (isset($_POST['btn_login'])) { | ||
$sql = 'SELECT * FROM user WHERE uname = "' . $_POST["username"] . '" and password ="' . $_POST["password"] . '"'; | ||
$result = mysqli_query($conn, $sql); | ||
} | ||
?> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
<?php | ||
session_start(); | ||
$conn = mysqli_connect("localhost","root","","hack"); | ||
if (mysqli_connect_errno()) | ||
{ | ||
echo "Failed to connect to MySQL: " . mysqli_connect_error(); | ||
$conn = mysqli_connect("localhost", "root", "", "hack"); | ||
if (mysqli_connect_errno()) { | ||
echo "Failed to connect to MySQL: " . mysqli_connect_error(); | ||
} | ||
|
||
function checkQuery($exe, $message) | ||
{ | ||
if ($exe) { | ||
echo "<script>alert('" . $message . "');</script>"; | ||
} else { | ||
echo "<script>alert('Please Retry')</script>"; | ||
} | ||
?> | ||
} | ||
|
||
function addDepartment($deptName) | ||
{ | ||
global $conn; | ||
$qry = "INSERT into departments values('','$deptName')"; | ||
$exe = mysqli_query($conn, $qry); | ||
checkQuery($exe, 'Inserted'); | ||
} | ||
|
||
function login($username, $passwd) | ||
{ | ||
global $conn; | ||
$sql = 'SELECT * FROM user WHERE uname = "' . $username . '" and password ="' . $passwd . '"'; | ||
$result = mysqli_query($conn, $sql); | ||
$row = mysqli_fetch_array($result); | ||
$count = mysqli_num_rows($result); | ||
if ($count == 1) { | ||
$_SESSION['userName'] = $row[1]; | ||
$_SESSION['userType'] = $row[3]; | ||
header("location: index.php"); | ||
} else { | ||
echo "<script>console.log('Your Login Name or Password is invalid')</script>"; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,75 @@ | ||
<?php include 'config.php' ?> | ||
<html> | ||
|
||
<head> | ||
|
||
<title> | ||
AdminForm | ||
</title> | ||
|
||
<style type="text/css"> | ||
|
||
body { | ||
body { | ||
display: flex; | ||
min-height: 100vh; | ||
flex-direction: column; | ||
} | ||
main { | ||
} | ||
|
||
main { | ||
flex: 1 0 auto; | ||
} | ||
} | ||
|
||
body { | ||
background: #fff; | ||
} | ||
.container{ | ||
|
||
.container { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
display:flex; | ||
display: flex; | ||
align-items: center; | ||
} | ||
</style> | ||
|
||
<link rel="stylesheet" type="text/css" href="css/materialize.min.css"> | ||
|
||
</head> | ||
|
||
<body> | ||
<main> | ||
<div class="container"> | ||
<div class="z-depth-3 y-depth-3 x-depth-3 grey green-text lighten-4 row" style="display: inline-block; padding: 0px 48px 0px 48px; border: 1px; margin-top: 50px; solid #EEE;"> | ||
<h3 style="color:#26a69a;margin-bottom:10%; ">Login</h3> | ||
|
||
|
||
|
||
<i class="mdi-alert-error red-text"></i> | ||
|
||
<form method="POST"> | ||
<div > | ||
<div class='input-field col s12'> | ||
<input class='validate' type="text" name='username' id='email' required /> | ||
<label for='email'>Username</label> | ||
</div> | ||
<main> | ||
<div class="container"> | ||
<div class="z-depth-3 y-depth-3 x-depth-3 grey green-text lighten-4 row" style="display: inline-block; padding: 0px 48px 0px 48px; border: 1px; margin-top: 50px; solid #EEE;"> | ||
<h3 style="color:#26a69a;margin-bottom:10%; ">Login</h3> | ||
<i class="mdi-alert-error red-text"></i> | ||
<form method="POST"> | ||
<div> | ||
<div class='input-field col s12'> | ||
<input class='validate' type="text" name='username' id='email' required /> | ||
<label for='email'>Username</label> | ||
</div> | ||
<div> | ||
<div class='input-field col m12'> | ||
<input class='validate' type='password' name='password' id='password' required /> | ||
<label for='password'>Password</label> | ||
</div> | ||
<label style='float: right;'> | ||
<a><b style="color: #F5F5F5;">Forgot Password?</b></a> | ||
</label> | ||
</div> | ||
<div> | ||
<div class='input-field col m12'> | ||
<input class='validate' type='password' name='password' id='password' required /> | ||
<label for='password'>Password</label> | ||
</div> | ||
<br/> | ||
<div class='row' style="color:white;padding-bottom:10%; "> | ||
<button style="margin-left:65px;color:white;font-size: 1rem" type='submit' name='btn_login' class='col s7 btn btn-small white waves-effect z-depth-1 y-depth-1 teal lighten-1'>Login</button></div> | ||
<form> | ||
</div> | ||
</div> | ||
</main> | ||
|
||
</div> | ||
</div> | ||
|
||
<script type="text/javascript" src="js/materialize.min.js"></script> | ||
|
||
<script src="js/jquery-3.4.1.min.js"></script> | ||
|
||
|
||
<label style='float: right;'> | ||
<a><b style="color: #F5F5F5;">Forgot Password?</b></a> | ||
</label> | ||
</div> | ||
<br /> | ||
<div class='row' style="color:white;padding-bottom:10%; "> | ||
<button style="margin-left:65px;color:white;font-size: 1rem" type='submit' name='btn_login' class='col s7 btn btn-small white waves-effect z-depth-1 y-depth-1 teal lighten-1'>Login</button></div> | ||
<form> | ||
</div> | ||
</div> | ||
</main> | ||
</div> | ||
</div> | ||
<script type="text/javascript" src="js/materialize.min.js"></script> | ||
<script src="js/jquery-3.4.1.min.js"></script> | ||
</body> | ||
|
||
</html> | ||
<?php | ||
if(isset($_POST['btn_login'])){ | ||
$sql = 'SELECT * FROM user WHERE uname = "'.$_POST["username"].'" and password ="'.$_POST["password"].'"'; | ||
$result = mysqli_query($conn,$sql); | ||
$row = mysqli_fetch_array($result); | ||
$count = mysqli_num_rows($result); | ||
if($count == 1) { | ||
$_SESSION['userName'] = $row[1]; | ||
$_SESSION['userType'] = $row[3]; | ||
header("location: index.php"); | ||
} else { | ||
echo "<script>console.log('Your Login Name or Password is invalid')</script>"; | ||
} | ||
} | ||
if (isset($_POST['btn_login'])) { | ||
login($_POST['username'], $_POST['password']); | ||
} | ||
?> |