Skip to content

Commit

Permalink
Merge branch 'teja'
Browse files Browse the repository at this point in the history
  • Loading branch information
teja963 committed Nov 30, 2021
2 parents f1c7f85 70ce4d9 commit 282a7ed
Show file tree
Hide file tree
Showing 19 changed files with 1,930 additions and 0 deletions.
116 changes: 116 additions & 0 deletions Download.php
Original file line number Diff line number Diff line change
@@ -0,0 1,116 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-black.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!--bootstrapCDN-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP VmmDGMN5t9UJ0Z" crossorigin="anonymous"/>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C OGpamoFVy38MVBnE IbbVYUew OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU 6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV rV" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/Download.css" type = "text/css">
<title>Download Qpaper</title>
<!--js for dropdowns-->
<script>
var subjectObject = {
"1": {
"CSE": ["Moonji1", "Moonji2", "Moonji3", "Moonji4"],
"ECE": ["Resistors", "conductors", "DSA", "bleh"],
"EEE": ["bleh1", "bleh2", "bleh3", "bleh4"]
},
"2": {
"CSE": ["Variables", "Strings", "Arrays"],
"ECE": ["SELECT", "UPDATE", "DELETE"]
}
}
window.onload = function() {
var YearSel = document.getElementById("Year");
var BranchSel = document.getElementById("Branch");
var SubjectSel = document.getElementById("Subject");
for (var x in subjectObject) {
YearSel.options[YearSel.options.length] = new Option(x, x);
}
YearSel.onchange = function() {
    //empty Chapters- and Topics- dropdowns
    SubjectSel.length = 1;
    BranchSel.length = 1;
//display correct values
for (var y in subjectObject[this.value]) {
BranchSel.options[BranchSel.options.length] = new Option(y, y);
}
}
BranchSel.onchange = function() {
    //empty Chapters dropdown
    SubjectSel.length = 1;
//display correct values
var z = subjectObject[YearSel.value][this.value];
for (var i = 0; i < z.length; i ) {
SubjectSel.options[SubjectSel.options.length] = new Option(z[i], z[i]);
}
}
}
</script>
</head>
<body>
<!-- Navbar -->
<div class="w3-top">
<div class="w3-bar w3-theme-d2 w3-left-align">
<a class="w3-bar-item w3-button w3-hide-medium w3-hide-large w3-right w3-hover-white w3-theme-d2" href="javascript:void(0);" onclick="openNav()"><i class="fa fa-bars"></i></a>
<a href="HomePage.php" class="w3-bar-item w3-button"><i class="fa fa-home w3-margin-right"></i>NITC Question Bank</a>
<a href="#QnPaper" class="w3-bar-item w3-button w3-hide-small w3-hover-white w3-teal">QPaper</a>
<a href="#ElectiveInfo" class="w3-bar-item w3-button w3-hide-small w3-hover-white">Elective Info</a>
<a href="#PlacementInfo" class="w3-bar-item w3-button w3-hide-small w3-hover-white">Placement Info</a>
<button onclick="document.getElementById('id01').style.display='block'" class="w3-button w3-theme w3-hover-teal">Notifications</button>
</div>
<!-- Navbar on small screens -->
<div id="navDemo" class="w3-bar-block w3-theme-d2 w3-hide w3-hide-large w3-hide-medium">
<a href="#QnPaper" class="w3-bar-item w3-button">QPaper</a>
<a href="#ElectiveInfo" class="w3-bar-item w3-button">Elective Info</a>
<a href="#PlacementInfo" class="w3-bar-item w3-button">Placement Info</a>
</div>
</div>
<div class = "w3-padding-64">
<h1 class = "text-center">Download Question Paper</h1>
<!--choosing year, branch and subjects-->
<div class="m-3">
<form action="list_files.php" method="post" enctype="multipart/form-data">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<h1 class = "qpHeading">Enter the following details</h1>
<h4 class="qpDetails">Year </h4>
<select class = "dropdowns" name="Year" id="Year">
<option value="" selected="selected">Select Year</option>
</select>
<h4 class="qpDetails">Branch </h4>
<select class = "dropdowns" name="Branch" id="Branch">
<option value="" selected="selected">Select Branch</option>
</select>
<h4 class="qpDetails">Subject </h4>
<select class = "dropdowns" name="Subject" id="Subject">
<option value="" selected="selected">Please select Branch first</option>
</select>
</div>
<div class="col-12 d-flex flex-row justify-content-center">
<button type="submit" class="upload-button" name= "Submit"> Download </button>
</div>
</div>
</div>
</form>
</div>
</div>
<script src="js/qnpaper-upload.js"></script>
</body>
</html>
206 changes: 206 additions & 0 deletions HomePage.php
Original file line number Diff line number Diff line change
@@ -0,0 1,206 @@


<!DOCTYPE html>
<html>
<head>
<title>NITC QUESTION BANK</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-black.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/HomePage.css">
</head>
<body id="HomePage">
<!-- Sidebar on click -->
<nav class="w3-sidebar w3-bar-block w3-white w3-card w3-animate-left w3-xxlarge" style="display:none;z-index:2" id="mySidebar">
<a href="javascript:void(0)" onclick="w3_close()" class="w3-bar-item w3-button w3-display-topright w3-text-teal">Close
<i class="fa fa-remove"></i></a>
<a href="#" class="w3-bar-item w3-button">Link 1</a>
<a href="#" class="w3-bar-item w3-button">Link 2</a>
<a href="#" class="w3-bar-item w3-button">Link 3</a>
<a href="#" class="w3-bar-item w3-button">Link 4</a>
<a href="#" class="w3-bar-item w3-button">Link 5</a>
</nav>
<!-- Navbar -->
<div class="w3-top">
<div class="w3-bar w3-theme-d2 w3-left-align">
<a class="w3-bar-item w3-button w3-hide-medium w3-hide-large w3-right w3-hover-white w3-theme-d2" href="javascript:void(0);" onclick="openNav()"><i class="fa fa-bars"></i></a>
<a href="#" class="w3-bar-item w3-button w3-teal"><i class="fa fa-home w3-margin-right"></i>NITC Question Bank</a>
<a href="#QnPaper" class="w3-bar-item w3-button w3-hide-small w3-hover-white">QPaper</a>
<a href="#ElectiveInfo" class="w3-bar-item w3-button w3-hide-small w3-hover-white">Elective Info</a>
<a href="#PlacementInfo" class="w3-bar-item w3-button w3-hide-small w3-hover-white">Placement Info</a>
<button onclick="document.getElementById('id01').style.display='block'" class="w3-button w3-theme w3-hover-teal">Notifications</button>
</div>
<!-- Navbar on small screens -->
<div id="navDemo" class="w3-bar-block w3-theme-d2 w3-hide w3-hide-large w3-hide-medium">
<a href="#QnPaper" class="w3-bar-item w3-button">QPaper</a>
<a href="#ElectiveInfo" class="w3-bar-item w3-button">Elective Info</a>
<a href="#PlacementInfo" class="w3-bar-item w3-button">Placement Info</a>
</div>
</div>
<!-- Modal -->
<div id="id01" class="w3-modal">
<div class="w3-modal-content w3-card-4 w3-animate-top">
<header class="w3-container w3-teal w3-display-container">
<span onclick="document.getElementById('id01').style.display='none'" class="w3-button w3-teal w3-display-topright"><i class="fa fa-remove"></i></span>
<h4>All Notifications</h4>
</header>
<div class="w3-container">
<p>1. New question paper uploaded!</p>
</div>
</div>
</div>
<!-- home-page Container -->
<div class="w3-container w3-padding-64 w3-center home-bg" id="home">
<h2 class="homepage-info">NITC Question Bank</h2>
<p class="homepage-para">From Normal book to a digitalised question bank, </br>
we provide an all-in-one space of information for the NITC students to access all the
</br><span style="font-weight:bold">previous year's question papers, placement information,
reference materials and elective information of their core subjects.</span> </p>
</div>
<!--Qpaper content-->
<div class="w3-container w3-padding-64 w3-theme-l5 qpaper-gap" id="QnPaper">
<div class="w3-row">
<div class="w3-col m6">
<div class="paper">
<form action="qnpaper-upload.php" method="POST">
<div class="w3-padding-16"><span class="w3-xlarge w3-border-teal w3-bottombar">Question Papers</span></div>
<p>Users can upload previous year's question papers as well as download them <br> for their respective courses provided in the dropdown options.</p>
<button type="submit" class="w3-button w3-center w3-theme-l1" name="upload">Upload Paper</button>
</form>
<form action="Download.php" method="POST">
<button type="submit" class="w3-button w3-center w3-theme-l1" name="Submit">Download Paper</button>
</form>
</div>
</div>
<div class="w3-col m6">
<div class="w3-padding-16"><span class="w3-xlarge w3-border-teal w3-bottombar">Reference notes</span></div>
<p>Description</p>
<button type="submit" class="w3-button w3-center w3-theme-l1">Get Info</button>
</div>
</div>
</div>
</div>
<!--Elective info-->
<div class="w3-container w3-padding-64 w3-theme-l1 elective-gap" id="ElectiveInfo">
<div class="w3-row">
<div class="w3-col m6">
<div class="w3-padding-16"><span class="w3-xlarge w3-border-teal w3-bottombar">Elective information</span></div>
<p>Description</p>
</div>
<div class="w3-col m5">
<form class="w3-container w3-card-4 w3-padding-16 w3-white" action="display1.php" target="_blank" method="POST" >
<table>
<tr>
<td>
<h1 class="info-details">Course ID:</h1>
<select class = "dropdown-option" name="Course_ID" id="Course_ID" required>
<option value="" selected="selected">Select Course ID</option>
</select>
<br>
</td>
</tr>
<tr>
<td>
<h1 class="info-details">Course Name:</h1>
<select class = "dropdown-option" name="Course_name" id="Course_name" required>
<option value="" selected="selected">Please select Course ID first</option>
</select>
<br>
</td>
</tr>
<tr>
<td>
<h1 class="info-details">Faculty Name:</h1>
<select class = "dropdown-option" name="Faculty_name" id="Faculty_name" required>
<option value="" selected="selected">Please select Course Name first</option>
</select>
<br><br>
</td>
</tr>
</table>
<button type="submit" class="w3-button w3-right w3-theme-l1" name="Submit">Get Info</button>
</form>
</div>
</div>
</div>
<!--placement info-->
<div class="w3-container w3-padding-64 w3-theme-l5 placement-gap" id="PlacementInfo">
<div class="w3-row">
<div class="w3-col m6">
<div class="w3-padding-16"><span class="w3-xlarge w3-border-teal w3-bottombar">Placement information</span></div>
<p>Description</p>
</div>
<div class="w3-col m5">
<form class="w3-container w3-card-4 w3-padding-16 w3-white" action="display2.php" target="_blank" method="POST">
<h1 class="info-details">Role:</h1>
<select class = "dropdown-option" name="Role" id="Role" required>
<option value="" selected="selected">Please select Role</option>
</select>
<br>
<h1 class="info-details">Company Name:</h1>
<select class = "dropdown-option" name="Company_name" id="Company_name" required>
<option value="" selected="selected">Please Select Role First</option>
</select>
<br>
<button type="submit" class="w3-button w3-right w3-theme-l1" name="Submit">Get Info</button>
</form>
</div>
</div>
</div>
<!-- Footer -->
<footer class="w3-container w3-padding-32 w3-theme-d1 w3-center">
<h4>For any help or suggestion, Contact us.</h4>
<p><i class="fa fa-map-marker w3-text-teal w3-xlarge"></i> NIT Calicut, Kerala.</p>
<p><i class="fa fa-phone w3-text-teal w3-xlarge"></i> 00 1515151515</p>
<p><i class="fa fa-envelope-o w3-text-teal w3-xlarge"></i> [email protected]</p>
</footer>
<script src="js/elective_placement_info.js"></script>
<script>
// Script for side navigation
function w3_open() {
var x = document.getElementById("mySidebar");
x.style.width = "300px";
x.style.paddingTop = "10%";
x.style.display = "block";
}
// Close side navigation
function w3_close() {
document.getElementById("mySidebar").style.display = "none";
}
// Used to toggle the menu on smaller screens when clicking on the menu button
function openNav() {
var x = document.getElementById("navDemo");
if (x.className.indexOf("w3-show") == -1) {
x.className = " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
}
</script>
</body>
</html>
Binary file added NITC light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions add_file.php
Original file line number Diff line number Diff line change
@@ -0,0 1,53 @@
<?php
// Check if a file has been uploaded
if(isset($_FILES['uploaded_file']) and isset ($_POST['Submit'])) {
// Make sure the file was sent without errors
if($_FILES['uploaded_file']['error'] == 0) {
// Connect to the database
$dbLink = new mysqli('localhost', 'root', '', 'nitcq');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}

// Gather all required data
$name = $dbLink->real_escape_string($_FILES['uploaded_file']['name']);
$Q_paper = $dbLink->real_escape_string(file_get_contents($_FILES ['uploaded_file']['tmp_name']));
$Branch = $_POST['Branch'];
$Year = $_POST['Year'];
$Subject = $_POST['Subject'];
$Roll_no = $_POST['Roll_no'];
$mime = $dbLink->real_escape_string($_FILES['uploaded_file']['type']);
$size = intval($_FILES['uploaded_file']['size']);

// Create the SQL query
$query = "
INSERT INTO `Question_paper`(`Branch`, `Year`, `Subject`, `Q_paper`, `Roll_no`, `Id`, `Qp_name`, `type`, `size`)
VALUES ('$Branch',$Year,'$Subject','{$Q_paper}','$Roll_no',12345,'{$name}','{$mime}','{$size}')";

// Execute the query
$result = $dbLink->query($query);

// Check if it was successfull
if($result) {
echo 'Success! Your file was successfully added!';
}
else {
echo 'Error! Failed to insert the file'
. "<pre>{$dbLink->error}</pre>";
}
}
else {
echo 'An error accured while the file was being uploaded. '
. 'Error code: '. intval($_FILES['uploaded_file']['error']);
}

// Close the mysql connection
$dbLink->close();
}
else {
echo 'Error! A file was not sent!';
}

// Echo a link back to the main page
echo '<p>Click <a href="qnpaper-upload.php">here</a> to go back</p>';
?>
Loading

0 comments on commit 282a7ed

Please sign in to comment.