Skip to content

Commit

Permalink
membership working
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Friday committed Sep 2, 2014
1 parent 2429f58 commit 6007bc3
Show file tree
Hide file tree
Showing 16 changed files with 1,496 additions and 763 deletions.
92 changes: 72 additions & 20 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ input, select, textarea, option{
-moz-box-shadow:inset 0px 0px 1px #BEBEBE;
-webkit-box-shadow:inset 0px 0px 1px #BEBEBE;
box-shadow:inset 0px 0px 1px #BEBEBE;
z-index:5;
}
#nav{
border-radius: 10px;
Expand All @@ -72,6 +73,7 @@ input, select, textarea, option{
margin:0px auto 0px auto;
min-height:35px;
height:auto;
z-index:1;
}


Expand All @@ -84,7 +86,9 @@ input, select, textarea, option{
margin-top:7px;
border:none;
}

#nav li{
z-index:50;
}
#tab-nav li{
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
Expand Down Expand Up @@ -422,15 +426,15 @@ table { border-collapse: collapse; }
/*----------------------------*/
/*----MEMBERSHIP CSS RULES----*/
/*----------------------------*/
div#username_ok.green,div#password_ok.green,button#submit_user.green{
div#username_ok.green,div#password_ok.green,div#student_no_ok.green,button#submit_user.green{
background-color:#00FF00;
color:black;
}
button#submit_user.red{
background-color:#FF0000;
color:black;
}
#username_ok,#password_ok{
#username_ok,#password_ok,#student_no_ok{
position:absolute;
padding-left:-10px;
display:inline;
Expand All @@ -441,6 +445,21 @@ button#submit_user.red{
overflow:hidden;
text-align:left;
}
#container{
height:auto;
padding-left:10px;
width:95%;
margin-left:auto;
margin-right:auto;
margin-bottom:25px;
}

.containerrow{
display:inline-block;
width:100%;
overflow:visible;
margin-bottom:2px;
}
#membership{
width:916px;
background-color: grey;
Expand All @@ -450,28 +469,53 @@ button#submit_user.red{
margin-top:-1px;
margin-bottom:25px;
}
#membership_header{
text-align: center;
margin-left: auto;
margin-right: auto;
width:100%;
}
#member_result{
overflow: auto;
max-height:570px;
}
#container{
height:auto;
padding-left:10px;
width:95%;
width:100%;
overflow-y: auto;
overflow-x:hidden;
max-height:700px;
margin-left:auto;
margin-right:auto;
margin-bottom:25px;
}
#row6{
display:inline-block;
}
.containerrow{
.member_result_row{
display:inline-block;
margin-left:auto;
margin-right:auto;
width:100%;
overflow:visible;
margin-bottom:2px;
text-align:left;

}
#headerrow{
background-color: #a4a4a4;
}
#membership_table{
position:relative;
margin-left:30px;
}
.col1,.col2,.col3,.col4,.col5,.col6,.col7{
.member_row:hover{
cursor: pointer; cursor: hand;
background-color:blue;
}
#membership_year{
margin-left:auto;
margin-right:auto;
}
.membership_year_row td{
padding-left:10px;
padding-right:10px;
}
.data_set{
padding-left:5px;
padding-right:10px;
}

.col1,.col2,.col3,.col4,.col5,.col6,.col7,.col8{
display:inline-block;
position:relative;
float:left;
Expand All @@ -484,6 +528,7 @@ div.col2 input,div.col3 input,div.col4 input,div.col5 input,div.col6 input,div.c
max-width:140px;
}
.col1{
text-align:center;
width:100%;
}
.col2{
Expand All @@ -504,6 +549,9 @@ div.col2 input,div.col3 input,div.col4 input,div.col5 input,div.col6 input,div.c
.col7{
width:14.28%;
}
.col8{
width:12.5%;
}
.span5col6{
width:83.33%;
float:right;
Expand All @@ -513,10 +561,13 @@ div.col2 input,div.col3 input,div.col4 input,div.col5 input,div.col6 input,div.c
font-size:70%;
}
.largeinput{
width:66.4%;
width:550px;
max-width:83%;
height:100px;
max-height:100px;
max-height:75px;
}
.padded{
padding-top:5px;
}
.memlabel{
padding-left:15px;
Expand All @@ -530,6 +581,7 @@ div.col2 input,div.col3 input,div.col4 input,div.col5 input,div.col6 input,div.c
box-shadow:inset 0px 0px 1px #BEBEBE;
}


/*----------------------------*/
/*----PLAYLIST TABLE RULES----*/
/*----------------------------*/
Expand Down
162 changes: 123 additions & 39 deletions form-handlers/membership-add-handler.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,131 @@
<?php
require("../headers/db_header.php");
require("../headers/function_header.php");
require("../headers/password.php");

$username = getPost('username');
$password = getPost('password');
$firstname = getPost('firstname');
$lastname = getPost('lastname');
$email = getPost('email');
$phone = getPost('phone');
$cellphone = getPost('cellphone');
$member_type = getPost('member_type');
if($member_type = 'Student'){
$faculty = getPost('faculty');

$username = $_POST['username'];
$password = $_POST['password'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = htmlentities($_POST['address'],ENT_QUOTES);
$city = htmlentities($_POST['city'],ENT_QUOTES);
$province = $_POST['province'];
$postalcode = $_POST['postalcode'];
$canadian_citizen = $_POST['canadian_citizen'];
$member_type = $_POST['member_type'];
if($member_type == 'Student'){
$integrate = $_POST['integrate'];
$faculty = $_POST['faculty'];
$schoolyear = $_POST['schoolyear'];
$student_no = $_POST['student_no'];
}else{
$integrate = null;
$faculty = null;
$schoolyear = null;
$student_no = null;
}
$has_show = $_POST['has_show'];
$show_name = htmlentities ($_POST['show_name'],ENT_QUOTES);
$is_new = $_POST['is_new'];
$alumni = $_POST['alumni'];
$since = $_POST['since'];
$email = htmlentities ($_POST['email'],ENT_QUOTES);
$primary_phone = $_POST['primary_phone'];
$secondary_phone = $_POST['secondary_phone'];
$music = $_POST['music'];
$sports = $_POST['sports'];
$live_broadcast = $_POST['live_broadcast'];
$ads_psa = $_POST['ads_psa'];
$discorder = $_POST['discorder'];
$news = $_POST['news'];
$tech = $_POST['tech'];
$outreach = $_POST['outreach'];
$show_hosting = $_POST['show_hosting'];
$arts = $_POST['arts'];
$prog_comm = $_POST['prog_comm'];
$digital_library = $_POST['digital_library'];
$photography = $_POST['photography'];
$other = htmlentities($_POST['other'],ENT_QUOTES);
$about = htmlentities($_POST['about'],ENT_QUOTES);
$skills = htmlentities ($_POST['skills'],ENT_QUOTES);
$exposure = htmlentities ($_POST['exposure'],ENT_QUOTES);

$today = date("Y-m-d H:i:s");
$joined = $today;
//Check to see if we are before the end of school year or not (end of april)
$cutoff = mktime(00,00,00,4,30,date(Y));
if(strtotime($today) < strtotime($cutoff)){
//Still within the school year
$year = date("Y",strtotime("-1 year"));
$next = date("Y");
$membership_year = $year."/".$next;
}
else{
$faculty = null;
//After school year, renewing for next school year
$year = date("Y");
$next = date("Y",strtotime("+1 year"));
$membership_year = $year."/".$next;
}
if($member_type != 'Student'){
$insert_membership = "INSERT INTO membership (firstname,lastname,address,city,province,postalcode,canadian_citizen,member_type,is_new,alumni,since,has_show,show_name,email,primary_phone,secondary_phone,about,skills,exposure,joined) VALUES ('".$firstname."','".$lastname."','".$address."','".$city."','".$province."','".$postalcode."','".$canadian_citizen."','".$member_type."','".$is_new."','".$alumni."','".$since."','".$has_show."','".$show_name."','".$email."','".$primary_phone."','".$secondary_phone."','".$about."','".$skills."','".$exposure."','".$joined."');";
}else{
$insert_membership = "INSERT INTO membership (firstname,lastname,address,city,province,postalcode,canadian_citizen,member_type,is_new,alumni,since,faculty,schoolyear,integrate,student_no,has_show,show_name,email,primary_phone,secondary_phone,about,skills,exposure,joined) VALUES ('".$firstname."','".$lastname."','".$address."','".$city."','".$province."','".$postalcode."','".$canadian_citizen."','".$member_type."','".$is_new."','".$alumni."','".$since."','".$faculty."','".$schoolyear."','".$integrate."','".$student_no."','".$has_show."','".$show_name."','".$email."','".$primary_phone."','".$secondary_phone."','".$about."','".$skills."','".$exposure."','".$joined."');";
}
$insert_membership_year = "INSERT INTO membership_years (member_id,membership_year,paid,sports,music,arts,show_hosting,live_broadcast,ads_psa,tech,news,programming_committee,promotions_outreach,discorder,digital_library,photography,other) VALUES (LAST_INSERT_ID(),'".$membership_year."','0','".$sports."','".$music."','".$arts."','".$show_hosting."','".$live_broadcast."','".$ads_psa."','".$tech."','".$news."','".$prog_comm."','".$outreach."','".$discorder."','".$digital_library."','".$photography."','".$other."');";
$insert_user = " INSERT INTO user (member_id,username,password,status,create_date) VALUES(LAST_INSERT_ID(),'".$username."','".password_hash($password,PASSWORD_DEFAULT)."','enabled','".$today."');";
$insert_group_member = " INSERT INTO group_members (userid,member,dj,administrator,adduser,addshow,editdj,library,membership,editlibrary,operator) VALUES (LAST_INSERT_ID(),'1','0','0','0','0','0','0','0','0','0');";
$fail=false;
$db->query("START TRANSACTION");
$error[0] = "ERROR";

$result = $db -> query($insert_membership);
if(!$result){
$fail = true;
$error[1] = "Error with member insert ";
$error[2] = mysqli_error($db);
}
else{
$result = $db -> query($insert_membership_year);
if(!$result){
$fail = true;
$error[1] = "Error with membership year insert ";
$error[2] = mysqli_error($db);
}
else{
$result = $db -> query($insert_user);
if(!$result){
$error[1] = "Error with user insert ";
$error[2] = mysqli_error($db);
$fail = true;
}
else{
$result = $db -> query($insert_group_member);
if(!$result){
$error[1] = "Error with group insert ";
$error[2] = mysqli_error($db);
$fail = true;
}
}
}
}
if(!$_POST){
$error [1] = "This is not the page you're looking for";
$error [2] = "<img src = http://i.imgur.com/to4ZTET.gif>";
}

if($fail){
if( !( $db -> rollback() ) ){
$error[1] = " Rollback failed";
$error[2] = $insert_membership.$insert_membership_year.$insert_user.$insert_group_member;
}
echo json_encode($error);
}else{
if( !( $db -> commit() ) ){
$error[1] = " Commit failed";
$error[2] = $insert_membership.$insert_membership_year.$insert_user.$insert_group_member;
echo json_encode($error);
}
else echo json_encode(true);
}
$gender = getPost('gender');
switch(getPost('canadian')){
case 'Canadian Citizen':
$canadian = 2;
break;
case 'Landed Immigrant':
$canadian = 1;
break;
case 'Visitor':
$canadian = 0;
}
$music = getPost('music');
$sports = getPost('sports');
$live_broadcast = getPost('live_broadcast');
$ads_psa = getPost('ads_psa');
$discorder = getPost('discorder');
$news = getPost('news');
$tech = getPost('tech');
$outreach = getPost('outreach');
$show_hosting = getPost('show_hosting');
$arts = getPost('arts');
$prog_comm = getPost('prog_comm');
$about = getPost('about');
$skills = getPost('skills');

$insert_membership = "INSERT INTO membership ('firstname','lastname','canadian_citizen','address','city')
$insert_user = "INSERT INTO user ('username','".password_hash('password',PASSWORD_DEFAULT)."',

?>
Loading

0 comments on commit 6007bc3

Please sign in to comment.