Skip to content

Commit 792aee3

Browse files
author
Manish Kumar
authored
php files!
1 parent 9987198 commit 792aee3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+4839
-0
lines changed

add.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
if (!isset($_SESSION)) session_start();
3+
4+
if (($_SESSION['userlevel'] === NULL) OR ($_SESSION['userlevel'] == 0)) {
5+
die ("<h3 style='text-align: center; color: coral; margin-bottom: 10px'><span style='color: red'>Haha</span>! C'mon you can do better!</h3><form style='text-align: center' action=\"logout.php\" method=\"post\"><button style='font-size: larger' class=\"form1 btn btn-info btn-block\">Back</button><br/><br/></form>");
6+
}
7+
?>
8+
9+
<!DOCTYPE html>
10+
<html lang="en">
11+
<head>
12+
<title>Add New Account (Admin) : CCNB</title>
13+
<meta charset="utf-8">
14+
<meta name="viewport" content="width=device-width, initial-scale=1">
15+
<link rel="stylesheet" href="css/style.css">
16+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
17+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
18+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
19+
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
20+
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
21+
<link rel="icon" href="img/logo.png" type="image/x-icon">
22+
</head>
23+
<body>
24+
25+
<form action="loggedin.php" method="post">
26+
<button class="form1 btn btn-warning btn-block">Back</button><br/><br/>
27+
</form>
28+
<div class="form">
29+
<h2 class="heading" id="head">Add New Account </h2>
30+
</div>
31+
32+
<form action="add_save.php" class="form2" method="post">
33+
<input name="username" type="text" class="form-control" placeholder="1. Username" required/><br/>
34+
<input name="password" type="password" class="form-control" placeholder="2. Password" required/><br/>
35+
<input name="department" type="text" class="form-control" placeholder="3. Department's Name" required/><br/>
36+
<textarea name="description" rows="3" class="form-control" placeholder="4. About Department..." required></textarea><br/>
37+
<input name="link" type="url" class="form-control" placeholder="5. Department's link"/><br/>
38+
<input name="name" type="text" class="form-control" placeholder="6. Profile Name" required/><br/>
39+
<select name="userlevel" class="form-control" required><option value="NULL">User</option><option value="1">Admin</option></select><br/>
40+
<input name="designation" type="text" class="form-control" placeholder="8. Designation" required/><br/>
41+
<input name="website" type="url" class="form-control" placeholder="9. Profile Holder's Website"/><br/>
42+
<input name="phone" type="tel" class="form-control" placeholder="10. Phone Number" required/><br/>
43+
<input name="email" type="email" class="form-control" placeholder="11. E-Mail Id" required/><br/>
44+
<br/><input name="password1" type="password" class="form-control" placeholder="*Your Own Password" required/><br/>
45+
<input type="submit" class="form1 btn btn-success btn-sm" value="Proceed"/>
46+
</form>
47+
48+
<form action="loggedin.php" method="post">
49+
<button class="form1 btn btn-warning btn-block">Back</button><br/><br/>
50+
</form>
51+
52+
</body>
53+
</html>

add_save.php

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
if (!isset($_SESSION)) session_start();
3+
4+
if (($_SESSION['userlevel'] === NULL) OR ($_SESSION['userlevel'] == 0)) {
5+
die ("<h3 style='text-align: center; color: coral; margin-bottom: 10px'><span style='color: red'>Haha</span>! C'mon you can do better!</h3><form style='text-align: center' action=\"logout.php\" method=\"post\"><button style='font-size: larger' class=\"form1 btn btn-info btn-block\">Back</button><br/><br/></form>");
6+
}
7+
?>
8+
9+
<!DOCTYPE html>
10+
<html lang="en">
11+
<head>
12+
<title>Save New Account (Admin) : CCNB</title>
13+
<meta charset="utf-8">
14+
<meta name="viewport" content="width=device-width, initial-scale=1">
15+
<link rel="stylesheet" href="css/style.css">
16+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
17+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
18+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
19+
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
20+
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
21+
<link rel="icon" href="img/logo.png" type="image/x-icon">
22+
</head>
23+
<body>
24+
25+
<?php
26+
27+
require 'connect.php';
28+
29+
if (isset($_SESSION['password'])) {
30+
$pass = $_SESSION['password'];
31+
32+
if (isset($_POST['username']) AND isset($_POST['password']) AND isset($_POST['department']) AND isset($_POST['description']) AND isset($_POST['link']) AND isset($_POST['name']) AND isset($_POST['userlevel']) AND isset($_POST['designation']) AND isset($_POST['website']) AND isset($_POST['phone']) AND isset($_POST['email']) AND isset($_POST['password1'])) {
33+
$password1 = md5($_POST['password1']);
34+
35+
if ($pass === $password1) {
36+
$username = addslashes($_POST['username']);
37+
$password = md5($_POST['password']);
38+
$department = addslashes($_POST['department']);
39+
$description = addslashes($_POST['description']);
40+
$link = $_POST['link'];
41+
$name = addslashes($_POST['name']);
42+
$userlevel = $_POST['userlevel'];
43+
$designation = addslashes($_POST['designation']);
44+
$website = $_POST['website'];
45+
$phone = $_POST['phone'];
46+
$email = $_POST['email'];
47+
48+
$insert = "INSERT INTO departments (department, dep_description, linked) VALUES ('$department', '$description', '$link')";
49+
$res = mysqli_query($mysql, $insert) or die ("<h5 style=\"margin-bottom: 100px; text-align: center; color: coral\">Something went <span style=\"color: red\">wrong</span>! (<span style=\"color: red\">Database or Server issue</span>)</h5><form action=\"add.php\" method=\"post\"><button class=\"form1 btn btn-success btn-block\">Back</button></form>");
50+
if ($res === TRUE) {
51+
52+
$query = "SELECT * FROM departments WHERE department='$department'";
53+
$result = mysqli_query($mysql, $query) or die ("<h5 style=\"margin-bottom: 100px; text-align: center; color: coral\">Something went <span style=\"color: red\">wrong</span>! (<span style=\"color: red\">Database or Server issue</span>)</h5><form action=\"add.php\" method=\"post\"><button class=\"form1 btn btn-success btn-block\">Back</button></form>");
54+
while ($row = mysqli_fetch_assoc($result)) {
55+
$departmentID = $row['departmentId'];
56+
57+
$insert1 = "INSERT INTO login_details (departmentId, username, password, name, userlevel) VALUES ('$departmentID', '$username', '$password', '$name', '$userlevel')";
58+
$result1 = mysqli_query($mysql, $insert1) or die ("<h5 style=\"margin-bottom: 100px; text-align: center; color: coral\">Something went <span style=\"color: red\">wrong</span>! (<span style=\"color: red\">Database or Server issue</span>)</h5><form action=\"add.php\" method=\"post\"><button class=\"form1 btn btn-success btn-block\">Back</button></form>");
59+
if ($result1 === TRUE) {
60+
61+
$insert2 = "INSERT INTO contact_info (departmentId, designation, website, phone, email) VALUES ('$departmentID','$designation', '$website', '$phone', '$email')";
62+
$result2 = mysqli_query($mysql, $insert2) or die ("<h5 style=\"margin-bottom: 100px; text-align: center; color: coral\">Something went <span style=\"color: red\">wrong</span>! (<span style=\"color: red\">Database or Server issue</span>)</h5><form action=\"add.php\" method=\"post\"><button class=\"form1 btn btn-success btn-block\">Back</button></form>");
63+
if ($result2 === TRUE) {
64+
65+
if ($userlevel == 1) {
66+
67+
echo "<h3 style='text-align: center; color: #2daae4; margin-bottom: 10px'>Congratulations! New <span style='color: dodgerblue'>ADMIN</span> has been added successfully.</h3>";
68+
include 'add.php';
69+
} else {
70+
echo "<h3 style='text-align: center; color: #2daae4; margin-bottom: 10px'>Congratulations! New <span style='color: dodgerblue'>USER</span> has been added successfully.</h3>";
71+
include 'add.php';
72+
}
73+
} else {
74+
echo "<h3 style='text-align: center; color: coral; margin-bottom: 10px'>Sorry! Couldn't enter <span style='color: red'>details</span>!.3</h3>";
75+
include 'add.php';
76+
}
77+
} else {
78+
echo "<h3 style='text-align: center; color: coral; margin-bottom: 10px'>Sorry! Couldn't enter <span style='color: red'>details</span>!.2</h3>";
79+
include 'add.php';
80+
}
81+
}
82+
} else {
83+
echo "<h3 style='text-align: center; color: coral; margin-bottom: 10px'>Sorry! Couldn't enter <span style='color: red'>details</span>!.1</h3>";
84+
include 'add.php';
85+
}
86+
} else {
87+
echo "<h3 style='text-align: center; color: coral; margin-bottom: 10px'>Make sure your <span style='color: red'>password</span> is correct!</h3>";
88+
include 'add.php';
89+
}
90+
} else {
91+
echo "<h3 style='text-align: center; color: coral; margin-bottom: 10px'>Make sure all <span style='color: red'>entries</span> are filled with constraints!</h3>";
92+
include 'add.php';
93+
}
94+
} else {
95+
echo "<h3 style='text-align: center; color: coral; margin-bottom: 10px'>Make sure you're <span style='color: red'>logged in</span>!</h3>";
96+
include 'add.php';
97+
}
98+
?>
99+
100+
</body>
101+
</html>

clubs.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
if (!isset($_SESSION)) session_start();
3+
?>
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
<head>
8+
<title>Clubs : CCNB</title>
9+
<meta charset="utf-8">
10+
<meta name="viewport" content="width=device-width, initial-scale=1">
11+
<link rel="stylesheet" href="css/style.css">
12+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
13+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
14+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
15+
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
16+
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
17+
<link rel="icon" href="img/logo.png" type="image/x-icon">
18+
</head>
19+
<body>
20+
<!-- header -->
21+
<?php
22+
include 'header.php';
23+
?>
24+
<!-- background image -->
25+
<div class="container-fluid">
26+
<div class="row" style="max-height: 500px; min-height: 500px; overflow: hidden;">
27+
<div class="image">
28+
<img src="img/bg.png" alt="Centralised College Notice Board" />
29+
<h1 class="col-lg-12">Centralised College Notice Board</h1>
30+
</div>
31+
</div>
32+
</div>
33+
<!-- content -->
34+
<div class="form"><h2 id="head">Departments & Clubs</h2></div>
35+
<div class="container-fluid" style="max-width: 95%">
36+
<div class="row">
37+
<?php
38+
require "connect.php";
39+
40+
$query = "SELECT * FROM departments";
41+
$result = mysqli_query($mysql, $query) or die('<h3>Sorry! Couldn\'t connect. (0)</h3>');
42+
while ($row = mysqli_fetch_assoc($result)) {
43+
$departmentID = $row['departmentId'];
44+
45+
$query1 = "SELECT * FROM departments WHERE departmentId='$departmentID'";
46+
$result1 = mysqli_query($mysql, $query1) or die('<h3>Sorry! Couldn\'t connect. (1)</h3>');
47+
while ($row1 = mysqli_fetch_assoc($result1)) {
48+
$department = $row1['department'];
49+
$description = $row1['dep_description'];
50+
$link = $row1['linked'];
51+
52+
echo '<div class="col-lg-3" style="padding: 10px;"><div style="overflow: scroll; padding: 15px; text-align: center; border-radius: 5px; max-height: 700px; min-height: 700px; background-color: dimgrey;"><h3 class="form2"><a id="link" style="color: aliceblue" href="' . $link . '" target="_blank">' . $department . '</a></h3><p style="color: white; white-space: pre-line">' . $description . '</p><form style="margin-top: 80px" method="post" action="visit2.php"><button name="department" value="' . $department . '" type="submit" class="form1 btn btn-primary btn-block">Visit posts</button></form></div></div>';
53+
}
54+
}
55+
?>
56+
</div>
57+
</div>
58+
<!-- footer -->
59+
<?php
60+
include 'footer.php';
61+
?>
62+
</body>
63+
</html>

confirm_delete.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
if (!isset($_SESSION)) session_start();
3+
4+
if (($_SESSION['userlevel'] === NULL) OR ($_SESSION['userlevel'] == 0)) {
5+
die ("<h3 style='text-align: center; color: coral; margin-bottom: 10px'><span style='color: red'>Haha</span>! C'mon you can do better!</h3><form style='text-align: center' action=\"logout.php\" method=\"post\"><button style='font-size: larger' class=\"form1 btn btn-info btn-block\">Back</button><br/><br/></form>");
6+
}
7+
?>
8+
9+
<!DOCTYPE html>
10+
<html lang="en">
11+
<head>
12+
<title>Confirm Delete Account (Admin) : CCNB</title>
13+
<meta charset="utf-8">
14+
<meta name="viewport" content="width=device-width, initial-scale=1">
15+
<link rel="stylesheet" href="css/style.css">
16+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
17+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
18+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
19+
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
20+
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
21+
<link rel="icon" href="img/logo.png" type="image/x-icon">
22+
</head>
23+
<body>
24+
25+
<?php
26+
require 'connect.php';
27+
28+
if (isset($_SESSION['username']) AND isset($_SESSION['departId'])) {
29+
$departID= $_SESSION['departId'];
30+
31+
$query = "DELETE FROM departments WHERE departmentId='$departID'";
32+
$result = mysqli_query($mysql, $query) or die ('<h3>Something went wrong!.</h3>');
33+
34+
$query4 = "DELETE FROM contact_info WHERE departmentId='$departID'";
35+
$result4 = mysqli_query($mysql, $query4) or die ('<h3>Something went wrong!.4</h3>');
36+
37+
$query1 = "SELECT * FROM login_details WHERE departmentId='$departID'";
38+
$result1 = mysqli_query($mysql, $query1) or die ('<h3>Something went wrong!.1</h3>');
39+
while ($row1 = mysqli_fetch_assoc($result1)) {
40+
$username = $row1['username'];
41+
42+
$query2 = "DELETE FROM notification WHERE username='$username'";
43+
$result2 = mysqli_query($mysql, $query2) or die ('<h3>Something went wrong!.2</h3>');
44+
45+
$query3 = "DELETE FROM login_details WHERE username='$username'";
46+
$result3 = mysqli_query($mysql, $query3) or die ('<h3>Something went wrong!.3</h3>');
47+
}
48+
49+
echo '<h3 style="text-align: center; color: coral; margin-bottom: 10px;">Account has been <span style="color: red">deleted</span> successfully!</h3><form action="edit_others_profile.php" method="post"><button class="form1 btn btn-success btn-block">Back to Control Panel</button></form>';
50+
}
51+
?>
52+
53+
</body>
54+
</html>

confirm_delete_post.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
if (!isset($_SESSION)) session_start();
3+
4+
if (($_SESSION['userlevel'] === NULL) OR ($_SESSION['userlevel'] == 0)) {
5+
echo "<!DOCTYPE html>
6+
<html lang=\"en\">
7+
<head>
8+
<title>Confirm Delete post (Non-Admin) : CCNB</title>
9+
<meta charset=\"utf-8\">
10+
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
11+
<link rel=\"stylesheet\" href=\"css/style.css\">
12+
<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">
13+
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>
14+
<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>
15+
<link href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css\" rel=\"stylesheet\">
16+
<link rel=\"shortcut icon\" href=\"img/logo.png\" type=\"image/x-icon\">
17+
<link rel=\"icon\" href=\"img/logo.png\" type=\"image/x-icon\">
18+
</head>
19+
<body>";
20+
} else {
21+
echo "<!DOCTYPE html>
22+
<html lang=\"en\">
23+
<head>
24+
<title>Confirm Delete post (Admin) : CCNB</title>
25+
<meta charset=\"utf-8\">
26+
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
27+
<link rel=\"stylesheet\" href=\"css/style.css\">
28+
<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">
29+
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>
30+
<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>
31+
<link href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css\" rel=\"stylesheet\">
32+
<link rel=\"shortcut icon\" href=\"img/logo.png\" type=\"image/x-icon\">
33+
<link rel=\"icon\" href=\"img/logo.png\" type=\"image/x-icon\">
34+
</head>
35+
<body>";
36+
}
37+
?>
38+
39+
<?php
40+
require 'connect.php';
41+
42+
if (isset($_SESSION['username']) AND $_POST['delete']) {
43+
$notificationID = $_POST['delete'];
44+
45+
$query = "DELETE FROM notification WHERE notificationId='$notificationID'";
46+
$result = mysqli_query($mysql, $query) or die ("<h3>Sorry! Couldn't connect!</h3>");
47+
48+
echo "<h3 style='text-align: center; color: #2daae4; margin-bottom: 10px'>Dear <span style='color: dodgerblue'>" . $_SESSION['name'] . "</span>, your post has been <span style='color: red'>deleted</span> successfully.</h3>";
49+
include 'view_post.php';
50+
} else {
51+
die ('<h3 style="text-align: center; color: coral; margin-bottom: 10px;">Something went wrong!</h3>
52+
<form action="loggedin.php" method="post">
53+
<button class="form1 btn btn-success btn-block">Back</button>
54+
</form>');
55+
}
56+
?>
57+
58+
</body>
59+
</html>

0 commit comments

Comments
 (0)