Skip to content

Commit

Permalink
Merge pull request #6 from pradhuman1/master
Browse files Browse the repository at this point in the history
Cookie Updated
  • Loading branch information
pradhuman1 authored Jul 10, 2020
2 parents c491a3e + 2845122 commit e9ce1a8
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 151 deletions.
Binary file modified .DS_Store
Binary file not shown.
14 changes: 1 addition & 13 deletions data_game/admin.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<?php
require "../database/member_info.php";
session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
header('location:home.php');
}else{
header('location:login.php');
}
}else{
header('location:login.php');
}
?>

<?php
if(isset($_POST['admin_btn'])){
$credID = $_SESSION['admin_cred_id'];
$admin_value = $_POST['admin_value'];
if($admin_value=='0'||$admin_value=='1'){
if($admin_value=='0'||$admin_value=='1'||$admin_value=='2'){
$query = "UPDATE credentials SET `admin_value`='$admin_value' WHERE `credentialsID`='$credID'";
$query_run = mysqli_query($connection,$query);
header('location:../geekhaven/makeAdmin.php');
Expand Down
2 changes: 1 addition & 1 deletion data_game/savemem.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}else{
$query = "INSERT INTO social_handles VALUES('$social_handle_id','','','','','','','','','','')";
$query_run = mysqli_query($connection,$query);
$query = "INSERT INTO member VALUES ('', '', '', '', '$member_id', '0', '$social_handle_id', '$cred_id', '$mem_post', '$wing', '$sess')";
$query = "INSERT INTO member VALUES ('$username', '', '', '', '$member_id', '0', '$social_handle_id', '$cred_id', '$mem_post', '$wing', '$sess')";
$query_run = mysqli_query($connection,$query);
$query = "INSERT INTO credentials VALUES('$cred_id','$username','$pass','0','$member_id')";
$query_run = mysqli_query($connection,$query);
Expand Down
17 changes: 5 additions & 12 deletions geekhaven/addmember.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<?php
require "../database/member_info.php";

session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
header('location:home.php');
}else{
header('location:login.php');
}
}else{
header('location:login.php');
include 'auth.php';
$res = callCheck();
if($res<1){
header('location:login.php');
}
?>
<!DOCTYPE html>
Expand Down
18 changes: 4 additions & 14 deletions geekhaven/announcement.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
<?php
require "../database/wingsdb.php";
require "../database/member_info.php";

session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
// echo "welcome member";
}else{
header('location:login.php');
}
}else{
header('location:login.php');
}
include 'auth.php';
$res = callCheck();
?>
<!DOCTYPE html>
<html lang="en">
Expand Down
23 changes: 23 additions & 0 deletions geekhaven/auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
function checkCookie($cookie_name,$t){
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408)*2 + $cookie_name){
return 2;
}else if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
return 1;
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
return 0;
}else{
header('location:login.php');
}
}else{
header('location:login.php');
}
}
function callCheck(){
$res = checkCookie($GLOBALS['cookie_name'],$GLOBALS['t']);
return $res;
}
?>
18 changes: 4 additions & 14 deletions geekhaven/blog.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
<?php
require "../database/wingsdb.php";
require "../database/member_info.php";

session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
// echo "welcome member";
}else{
header('location:login.php');
}
}else{
header('location:login.php');
}
include 'auth.php';
$res = callCheck();
?>
<!DOCTYPE html>
<html lang="en">
Expand Down
17 changes: 4 additions & 13 deletions geekhaven/home.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
<?php
require "../database/member_info.php";

session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
// echo "welcome member";
}else{
header('location:login.php');
}
}else{
header('location:login.php');
}
include 'auth.php';
$res = callCheck();
?>

<!DOCTYPE html>
Expand Down
26 changes: 11 additions & 15 deletions geekhaven/makeAdmin.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<?php
require "../database/member_info.php";

session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
header('location:home.php');
}else{
header('location:login.php');
}
}else{
header('location:login.php');
include 'auth.php';
$res = callCheck();
if($res<1){
header('location:login.php');
}
?>
<!DOCTYPE html>
Expand Down Expand Up @@ -95,7 +88,7 @@
<form method='post' action='../data_game/admin.php'>
<div class="row">
<div class="form-group form-button col-lg-11">
<input name='admin_value' type='text' placeholder='Admin Value (0/1)'></input>
<input name='admin_value' type='text' placeholder='Admin Value (0/1/2)'></input>
</div>
<div class="form-group form-button col-lg-1">
<button name="admin_btn" type="submit" class="form-submit button" >SAVE</button>
Expand All @@ -121,8 +114,11 @@
?>
<br>
<label><?php if($name){echo $name;}else{echo 'Name Not Available';} echo ' : '; ;?></label>
<?php if($admin_value){
echo "Admin";
<?php
if($admin_value == '2'){
echo "Overall Coordinator";
}else if($admin_value == '1'){
echo "Coordinator";
}else{
echo "Member";
} ?>
Expand Down
17 changes: 5 additions & 12 deletions geekhaven/makehof.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<?php
require "../database/member_info.php";

session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
header('location:home.php');
}else{
header('location:login.php');
}
}else{
header('location:login.php');
include 'auth.php';
$res = callCheck();
if($res<1){
header('location:login.php');
}
?>
<!DOCTYPE html>
Expand Down
18 changes: 4 additions & 14 deletions geekhaven/project.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
<?php
require "../database/wingsdb.php";
require "../database/member_info.php";

session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
// echo "welcome member";
}else{
header('location:login.php');
}
}else{
header('location:login.php');
}
include 'auth.php';
$res = callCheck();
?>
<!DOCTYPE html>
<html lang="en">
Expand Down
18 changes: 4 additions & 14 deletions geekhaven/social_handles.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
<?php
require "../database/wingsdb.php";
require "../database/member_info.php";
session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
// echo "welcome member";
}else{
header('location:login.php');
}
}else{
header('location:login.php');
}

include 'auth.php';
$res = callCheck();
?>
<!DOCTYPE html>
<html lang="en">
Expand Down
19 changes: 4 additions & 15 deletions geekhaven/updateProfile.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@

<?php
// include './addmember.php'
require "../database/member_info.php";
require "../database/member_info.php";
session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){

}else if($_COOKIE[$cookie_name]==$t + $cookie_name){

}else{
header('location:login.php');
}
}else{
header('location:login.php');
}
include 'auth.php';
$res = callCheck();
?>
<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -65,7 +54,7 @@
$query = "SELECT * FROM member WHERE member_id='$mem_id'";
$query_run = mysqli_query($connection,$query);
while($row = mysqli_fetch_assoc($query_run)){
$name =$row['name'];
$name =$row['name'];
$roll =$row['roll_no'];
$image =$row['image'];
$des =$row['description'];
Expand Down
17 changes: 3 additions & 14 deletions geekhaven/wing.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
<?php
require "../database/wingsdb.php";
require "../database/member_info.php";
session_start();
$cookie_name = $_SESSION['member_id'];
$t = $_SESSION['time'];
if(isset($_COOKIE[$cookie_name])){
if($_COOKIE[$cookie_name]==$t + ($t%2408) + $cookie_name){
// echo "welcome Admin";
}else if($_COOKIE[$cookie_name]==$t + $cookie_name){
// echo "welcome member";
}else{
header('location:login.php');
}
}else{
header('location:login.php');
}
include 'auth.php';
$res = callCheck();
?>

<!DOCTYPE html>
Expand Down

0 comments on commit e9ce1a8

Please sign in to comment.