//for paging
$func = new COMMONFUNC();
$db = new DB();
$fldAthleteid = isset($_REQUEST["fldAthleteid"]) ? $_REQUEST["fldAthleteid"] : 0;
$fldYoutubelink = "";
$fldYoutubeModifiedDate = "";
$youID = "";
$error_msg = "";
if ($_POST['isSubmit'] == 'save') {
    $nowToday = date('Y-m-d H:i:s');
    $fldNoteID = $func->input_fun($_POST['fldNoteID']);
    if ($fldNoteID <= 0 || $fldNoteID == "") {
        $error_msg = '<div class="thankyoumessage" style="margin-right:29px;">Please select Note.</div>';
    } else {
        $strDataArr = array('fldAthleteId' => $fldAthleteid, 'fldNoteId' => $fldNoteID, 'fldPostDate' => $nowToday);
        $db->insertRec("tbl_athlete_notes", $strDataArr, "");
        $error_msg = '

				<script language="JavaScript" type="text/JavaScript">

				window.opener.location.reload(false);

				self.close();

				</script>

				';
    }
}
?>
//for common function
include_once "inc/page.inc.php";
include_once "inc/config.inc.php";
session_start();
//for paging
$func = new COMMONFUNC();
$db = new DB();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Messaging</title>
		<META NAME="Keywords" CONTENT="My Account">
		<META NAME="Description" CONTENT="My Account">
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<script language="Javascript" src="javascript/functions.js"></script>
		<script language="JavaScript" type="text/JavaScript"></script>
	</head>
	<body>
		<!--middle panel starts from here -->
		<!--content panel starts from here -->
		<div class="container">
			<div class="innerWraper">
				<div class="middle-bg">
					<div class="cantener">
						<div class="register-main">
							<h1 style="margin-bottom:5px;">Write your Comments</h1>
							<div class="registerPage smaller">
								<?php 
if ($_POST['isSubmit'] == 'save') {
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Messaging</title>
		<META NAME="Keywords" CONTENT="My Account">
		<META NAME="Description" CONTENT="My Account">
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<script language="Javascript" src="javascript/functions.js"></script>
		<script type="text/javascript">
                  
           function validate() {
                var error_msg = "";    
                
                //Check Values
                if(trimString(document.messageform.subject.value) == "") {
                    error_msg += "Please Enter Subject. \n";
                } else {
                }                
                if(trimString(document.messageform.message.value) == "") {
                    error_msg += "Please Enter Message. \n";
                } else {
                    if(hasSpecialCharaters(document.messageform.message.value)) {
                        error_msg += "Enter valid Message. \n";
                    }
                }
                               
                //Display Error
                if(error_msg != '') {
                    alert(error_msg);
                    return false;
                } else {
                $fldprice = $fldprice - $re['amount'];
                $coupondiscount = $re['amount'];
            }
            $fldpaymentstatus = "INCOMPLETE";
            ##INSERT Enent###
            #######################################
            $strDataArr = array('fldFirstName' => $func->input_fun($_POST['fldFirstName']), 'fldLastName' => $func->input_fun($_POST['fldLastName']), 'fldAddress' => $func->input_fun($_POST['fldBSAddress']), 'fldCity' => $func->input_fun($_POST['fldBSCity']), 'fldState' => $func->input_fun($_POST['fldBSState']), 'fldZipCode' => $func->input_fun($_POST['fldBSZipCode']), 'fldPhone' => $func->input_fun($_POST['fldPhone']), 'fldEmail' => $func->input_fun($_POST['fldEmail']), 'fldSpecialEvent' => $func->input_fun($_POST['fldSpecialEvent']), 'fldReferredBy' => $func->input_fun($_POST['fldReferredBy']), 'fldClass' => $func->input_fun($_POST['fldClass']), 'fldPrimaryPosition' => $func->input_fun($_POST['fldPrimaryPosition']), 'fldSecondaryPosition' => $func->input_fun($_POST['fldSecondaryPosition']), 'fldHSCoachName' => $func->input_fun($_POST['fldHSCoachName']), 'fldSchool' => $func->input_fun($fldSchool), 'fldOthers' => $func->input_fun($_POST['txtfldName']), 'Address' => $func->input_fun($Address), 'City' => $func->input_fun($City), 'State' => $func->input_fun($State), 'Zipcode' => $func->input_fun($Zipcode), 'fldAAUCoachName' => $func->input_fun($_POST['fldAAUCoachName']), 'AAUOther' => $func->input_fun($_POST['txtfldAAUName']), 'HS_AAU_Team' => $func->input_fun($fldAAUSchool), 'AAUAddress' => $func->input_fun($fldAAUAddress), 'AAUCity' => $func->input_fun($fldAAUCity), 'AAUState' => $func->input_fun($fldAAUState), 'AAUZipCode' => $func->input_fun($fldAAUZipcode), 'fldCouponNumber' => $func->input_fun($_POST['fldCouponNumber']), 'fldTransportation' => $func->input_fun($fldTransportation), 'fldTranscript' => $newname, 'fldprice' => $fldprice, 'fldpaymentstatus' => $fldpaymentstatus, 'fldAddDate' => date("y-m-d"));
            //print_r($strDataArr);
            $debugstep = 2;
            //Insert Data - Get NewUserID
            if (isset($_REQUEST['fld_id']) && $_REQUEST['fld_id'] != '') {
                $where_reg_update = "fldId = " . $_REQUEST['fld_id'];
                $result = $db->updateRec(TBL_SPECIAL_EVENT_REGISTER, $strDataArr, $where_reg_update);
                $NewUserId = $_SESSION['fld_id'];
            } else {
                $NewUserId = $db->insertRec(TBL_SPECIAL_EVENT_REGISTER, $strDataArr);
            }
            $error_msg = "Thankyou for Register with Our Event";
            $_SESSION['fld_id'] = $NewUserId;
            $debugstep = 3;
            ?>

	  <script> window.location.href='Event_confirmation.php';</script>
	  <?php 
            exit;
        }
    }
    ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        $query_Athlete = " Select * from " . TBL_ATHELETE_REGISTER . " where fldUsername ='******'FRONTEND_USER'] . "'";
        $db1->query($query_Athlete);
        $db1->next_record();
        //Insert data
        ///////////
        $newname = "video/" . $video_name;
        $flvobj = new flv();
        $flvobj->FFLV_PATH = '/usr/bin/';
        $flvobj->APP_ROOT = 'video/';
        $flvobj->output_file = 'video/';
        //$flvobj -> newname = time();
        $flvobj->newname = "cpn_" . $db1->f('fldId') . "-" . time();
        //append cpn_AthleteID- to filename
        $video = $flvobj->convert_video($_FILES['fldVideo']);
        $strDataArr = array('fldTitle' => $func->input_fun($_POST['fldTitle']), 'fldVideo' => $video, 'fldAddDate' => date("y-m-d"), 'fldStatus' => $func->input_fun($_POST['fldStatus']), 'fldAthleteId' => $db1->f('fldId'));
        $db->insertRec(TBL_ATHLETE_VIDEO, $strDataArr);
        #redirect to listing page on successfull updation
        header("Location:Video-List.php?msg=Game Tape successfully added.");
    }
    //this section is use to filup the value after erro message.
    if ($error_msg != "") {
        $fldTitle = $_REQUEST['fldTitle'];
        $fldThirdParty = $_REQUEST['fldThirdParty'];
        $fldStatus = $_REQUEST['fldStatus'];
    }
}
//END if submit
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     }
     if ($_REQUEST['txtfldContactInfo'] == '') {
         $error_msg[] = "Please Enter Coach's Phone";
     }
 } else {
     $Team_id = $func->input_fun($_POST['fldSchool']);
 }
 if ($_REQUEST['fldJerseyNumber'] == '') {
     $error_msg[] = "Please Select Jersey Number.";
 }
 $mysqlDateString = date('Y-m-d H:i:s', $phpdate);
 $strDataArr = array('fldUsername' => $func->input_fun($_POST['fldUsername']), 'fldPassword' => $func->input_fun($_POST['fldPassword']), 'fldEmail' => $func->input_fun($_POST['fldEmail']), 'fldFirstname' => $func->input_fun($_POST['fldFirstname']), 'fldLastname' => $func->input_fun($_POST['fldLastname']), 'fldClass' => $func->input_fun($_POST['fldClass']), 'fldHeight' => $func->input_fun($_POST['fldHeight']), 'fldWeight' => $func->input_fun($_POST['fldWeight']), 'fldSchool' => $Team_id, 'fldSport' => $sport_empty, 'fldStatus' => $func->input_fun($_POST['fldStatus']), 'fldIntendedMajor' => $func->input_fun($_POST['fldIntendedMajor']), 'fldOthers' => $func->input_fun($_POST['fldOthers']), 'fldQuestion' => $func->input_fun($_POST['fldQuestion']), 'fldAnswer' => $func->input_fun($_POST['fldAnswer']), 'fldState' => $func->input_fun($_POST['fldState']), 'fldJerseyNumber' => $func->input_fun($_POST['fldJerseyNumber']), 'fldAddDate' => date("y-m-d"));
 //Continue If No Form Errors
 if (count($error_msg) == 0) {
     //Insert Data - Get NewUserID
     $res = $db->insertRec(TBL_ATHELETE_REGISTER, $strDataArr);
     $NewUserId = $res;
     if ($_POST['fldSchool'] == "other") {
         ##########################################
         ### Insert Custom College ###
         ##########################################
         //Get Lattitude & Longitude
         $Zipcode_lat_lon = $func->getLatLong($_POST['fldZipcode'], MAPS_APIKEY);
         //Build Insert Data
         $fldStatus = "ACTIVE";
         $strDataArr_school = array('fldSchoolname' => $func->input_fun($_POST['txtfldName']), 'fldAddress' => $func->input_fun($_POST['fldAddress']), 'fldCity' => $func->input_fun($_POST['fldCity']), 'fldState' => $func->input_fun($_POST['fldState']), 'fldZipcode' => $func->input_fun($_POST['fldZipcode']), 'fldStatus' => $fldStatus, 'fldLatitude' => $Zipcode_lat_lon['Latitude'], 'fldLongitude' => $Zipcode_lat_lon['Longitude'], 'fldAdminApproved' => 0, 'fldAddByAthleteUsername' => $_POST['fldUsername'], 'fldAddDate' => date("y-m-d"));
         //Insert & Set CollegeSchoolId
         $NewSchoolId = $db->insertRec(TBL_HS_AAU_TEAM, $strDataArr_school);
         $HighSchoolId = $NewSchoolId;
         //Update  User's fldSchool column
         $strDataArr_schoolreg_update = array('fldSchool' => $HighSchoolId);
        $whereClause_team = "fldSchoolname='" . $func->input_fun($_POST['txtfldName']) . "'";
        $flagss = 0;
        if ($db->MatchingRec(TBL_HS_AAU_TEAM, $whereClause_team) > 0) {
            #user Username already exists
            $strDataArr_other = array('fldCoachName' => $func->input_fun($_POST['txtfldAddress']), 'fldCoachPhone' => $func->input_fun($_POST['txtfldContactInfo']));
            $strDataArr_team = array('fldCoachPhone' => $func->input_fun($_POST['txtfldAddress']), 'fldStatus' => "DEACTIVE");
            $where_team_other_Update = 'fldUserId =' . $fldAtheleteid;
            $db->updateRec(TBL_HS_AAU_TEAM_OTHER, $strDataArr_other, $where_team_other_Update);
            $where_team_Update = "fldSchoolname='" . $func->input_fun($_POST['txtfldName']) . "'";
            $db->updateRec(TBL_HS_AAU_TEAM, $strDataArr, $where_team_Update);
            $flagss++;
        }
        if ($flagss == 0) {
            $strDataArr_other = array('fldName' => $func->input_fun($_POST['txtfldName']), 'fldCoachName' => $func->input_fun($_POST['txtfldAddress']), 'fldCoachPhone' => $func->input_fun($_POST['txtfldContactInfo']), 'fldUserId' => $fldAtheleteid);
            $strDataArr_team = array('fldSchoolname' => $func->input_fun($_POST['txtfldName']), 'fldCoachPhone' => $func->input_fun($_POST['txtfldContactInfo']), 'fldStatus' => "DEACTIVE");
            $db->insertRec(TBL_HS_AAU_TEAM_OTHER, $strDataArr_other);
            $db->insertRec(TBL_HS_AAU_TEAM, $strDataArr_team);
        }
    }
    $db->updateRec(TBL_ATHELETE_REGISTER, $strDataArr, $where);
    #redirect to listing page on successfull updation
    header("Location: myaccount.php?page=" . $_REQUEST['page'] . "&msg=Profile successfully updated.");
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
$db = new DB();
//$flag=1;
if ($_POST['isSubmit'] == 'save') {
    if ($_REQUEST['collegeid'] == '') {
        $error_msg[] = " Please Select College";
    }
    $collegeid = $func->input_fun($_POST['collegeid']);
    $ath_name = $func->selectTableOrder(TBL_ATHELETE_REGISTER, "fldFirstname,fldLastname", "fldId", "where fldId='" . $_SESSION['Athlete_id'] . "' and fldStatus ='ACTIVE'");
    $name = ucfirst($ath_name[0]['fldFirstname']) . ' ' . ucfirst($ath_name[0]['fldLastname']);
    $strDataArr = array('collegeid' => $collegeid, 'athleteid' => $_SESSION['Athlete_id'], 'athname' => $name, 'status' => $func->input_fun($_POST['status']));
    $whereClause = "athleteid='" . $_SESSION['Athlete_id'] . "' and collegeid = '" . $collegeid . "'";
    if ($db->MatchingRec(TBL_ADDTONETWORK_REQUEST, $whereClause) > 0) {
        $error_msg[] = 'You Have Already Send the Request!';
    }
    if (count($error_msg) == 0) {
        $db->insertRec(TBL_ADDTONETWORK_REQUEST, $strDataArr);
        $msg = "Your Request has been sent! Wait for Approval";
        header("Location: myaccount.php?msg={$msg}");
    }
}
?>









if ($_REQUEST['mode'] == "active") {
    $Id = $_REQUEST['fldId'];
    $active_query_details = "update " . TBL_ATHELETE_REGISTER . " set fldStatus = 'ACTIVE',fldApproveCoachId=" . $_SESSION['Coach_id'] . " where fldId='" . $Id . "'";
    $activemsg = $db->query($active_query_details);
    $strDataArr = array('fldSenderid' => $Id, 'fldSenderType' => 'athlete', 'fldReceiverid' => $_SESSION['Coach_id'], 'fldReceiverType' => 'coach', 'fldStatus' => "Active");
    //Build WhereClause
    $whereClause = "(fldSenderid='" . $Id . "' AND fldSenderType='athlete' AND fldReceiverid='" . $ReceiverID . "' AND fldReceiverType='coach') ";
    $whereClause .= " OR (fldSenderid='" . $_SESSION['Coach_id'] . "' AND fldSenderType='athlete' AND fldReceiverid='" . $Id . "' AND fldReceiverType='coach') ";
    //Check if Network Request already exists
    if ($db->MatchingRec(TBL_NETWORK, $whereClause) > 0) {
        //Request Already Exists
        $msg = 'There is already an Active or Pending Network Request with this user.';
        header("Location: " . $GLOBALPage . "{$ReceiverID}&errormsg={$msg}");
    } else {
        ##INSERT
        $db->insertRec(TBL_NETWORK, $strDataArr);
        ##SENT EMAIL to USER
        $subjectStrek = "College Prospect Network - New Network Request";
        #Login Info & Directions
        $EmailUsername = "";
        $EmailPassword = "";
        $EmailTo = "";
        $EmailUserID = $_SESSION['Coach_id'];
        //Set Email User ID
        $EmailUserType = 'coach';
    }
    //auto add athlete func start
    $sel = "select `tbl_athelete_register`.* from `tbl_athelete_register` where `tbl_athelete_register`.`fldId`='" . $Id . "'";
    $db2->query($sel);
    $db2->next_record();
    $approve_coach_id = $func->output_fun($db2->f('fldApproveCoachId'));
    if ($_REQUEST['fldSport'] == '') {
        $error_msgg[] = "Please Select Sport";
    }
    if ($_REQUEST['fldPosition'] == '') {
        $error_msgg[] = "Please Enter Position";
    }
    $where = "fldUsername='******'";
    $strDataArr = array('fldName' => $func->input_fun($_POST['fldName']), 'fldLastName' => $func->input_fun($_POST['fldLastName']), 'fldEmail' => $func->input_fun($_POST['fldEmail']), 'fldAEmail' => $func->input_fun($_POST['fldAEmail']), 'fldPhone' => $func->input_fun($_POST['fldPhone']), 'fldAPhone' => $func->input_fun($_POST['fldAPhone']), 'fldSchool' => $func->input_fun($_POST['fldSchool']), 'fldSport' => $func->input_fun($_POST['fldSport']), 'fldPosition' => $func->input_fun($_POST['fldPosition']));
    if (count($error_msgg) == 0) {
        $db->updateRec(TBL_HS_AAU_COACH, $strDataArr, $where);
        $delete_query_details = "delete from " . TBL_HS_AAU_COACH_SPORT_POSITION . " where fldCoachNameId='" . $fldCoachMemberId . "'";
        $delmsg = $db->query($delete_query_details);
        for ($n = 0; $n < $_POST['currentrow']; $n++) {
            if ($n == 0) {
                $strDataArrw = array('fldSportId' => $func->input_fun($_POST['fldSport']), 'fldPosition' => $func->input_fun($_POST['fldPosition']), 'fldCoachNameId' => $fldCoachMemberId);
                $db->insertRec(TBL_HS_AAU_COACH_SPORT_POSITION, $strDataArrw);
            } else {
                $strDataArrw = array('fldSportId' => $func->input_fun($_POST['fldSport' . $n]), 'fldPosition' => $func->input_fun($_POST['fldPosition' . $n]), 'fldCoachNameId' => $fldCoachMemberId);
                $db->insertRec(TBL_HS_AAU_COACH_SPORT_POSITION, $strDataArrw);
            }
        }
        #redirect to listing page on successfull updation
        //$returnmsg = "You have successfully updated profile." . "SportCount-" . $_POST['currentrow'];
        $returnmsg = "You have successfully updated profile.";
        header("Location: myaccount.php?page=" . $_REQUEST['page'] . "&msg=" . $returnmsg);
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
 if ($_REQUEST['fldPhone'] == '') {
     $error_msg[] = "Please Enter Phone.";
 }
 if ($_REQUEST['fldSchool'] == '') {
     $error_msg[] = "Please Select School.";
 }
 if ($_REQUEST['fldPassword'] == '') {
     $error_msg[] = "Please Enter Password.";
 }
 if ($_REQUEST['fldSport'] == '') {
     $error_msg[] = "Please Select Sport.";
 }
 $strDataArr = array('fldUsername' => $func->input_fun($_POST['fldUsername']), 'fldPassword' => $func->input_fun($_POST['fldPassword']), 'fldName' => $func->input_fun($_POST['fldName']), 'fldLastName' => $func->input_fun($_POST['fldLastName']), 'fldEmail' => $func->input_fun($_POST['fldEmail']), 'fldAEmail' => $func->input_fun($_POST['fldAEmail']), 'fldPhone' => $func->input_fun($_POST['fldPhone']), 'fldAPhone' => $func->input_fun($_POST['fldAPhone']), 'fldSchool' => $HighSchoolId, 'fldSport' => $func->input_fun($_POST['fldSport']), 'fldPosition' => $func->input_fun($_POST['fldPosition']), 'fldStatus' => $func->input_fun($_POST['fldStatus']), 'fldQuestion' => $func->input_fun($_POST['fldQuestion']), 'fldAnswer' => $func->input_fun($_POST['fldAnswer']), 'fldAddDate' => date("y-m-d"));
 if (count($error_msg) == 0) {
     //Insert Data - Get NewUserID
     $coach_max_id = $db->insertRec(TBL_HS_AAU_COACH, $strDataArr);
     $NewUserId = $coach_max_id;
     if ($_POST['fldSchool'] == "other") {
         ##########################################
         ### Insert Custom High School  ###
         ##########################################
         //Get Lattitude & Longitude
         $Zipcode_lat_lon = $func->getLatLong($_POST['fldZipcode'], MAPS_APIKEY);
         //Build Insert Data
         $fldStatus = "ACTIVE";
         $strDataArr_school = array('fldSchoolname' => $_POST['txtfldName'], 'fldAddress' => $_POST['fldAddress'], 'fldCity' => $_POST['fldCity'], 'fldState' => $_POST['fldState'], 'fldZipcode' => $_POST['fldZipcode'], 'fldStatus' => $fldStatus, 'fldLatitude' => $Zipcode_lat_lon['Latitude'], 'fldLongitude' => $Zipcode_lat_lon['Longitude'], 'fldAdminApproved' => 0, 'fldAddByCoachUsername' => $_POST['fldUsername'], 'fldAddDate' => date("y-m-d"));
         //Insert & Set CollegeSchoolId
         $NewSchoolId = $db->insertRec(TBL_HS_AAU_TEAM, $strDataArr_school);
         $HighSchoolId = $NewSchoolId;
         //Update  User's fldSchool column
         $strDataArr_schoolreg_update = array('fldSchool' => $HighSchoolId);
$athemail = $db->f('fldEmail');
$coach_id = $db->f('fldApproveCoachId');
$userid = $db->f('fldId');
$fldSport = $db->f('fldSport');
$fldFirstname = $db->f('fldFirstname');
$fldLastname = $db->f('fldLastname');
if ($_GET['fldEventId']) {
    $programe_event = $func->selectTableOrder(TBL_EVENT, "fldEventId,fldEventName", "fldEventId", "where fldEventId=" . $_GET['fldEventId']);
}
$AthleteName = $fldFirstname . " " . $fldLastname;
$EventName = $programe_event[0]['fldEventName'];
if ($_POST['isSubmit'] == 'save') {
    if ($flag == 0) {
        for ($cataStatcount = 0; $cataStatcount < count($_POST['category']); $cataStatcount++) {
            $strDataArr = array('fldPrograme' => $programe_event[0]['fldEventId'], 'fldCategoryId' => $func->input_fun($_POST['categoryId'][$cataStatcount]), 'fldValue' => $func->input_fun($_POST['category'][$cataStatcount]), 'fldLabelname' => $func->input_fun($_POST['labelname'][$cataStatcount]), 'fldStatus' => 0, 'fldCoachId' => $coach_id, 'fldSportid' => $fldSport, 'fldAtheleteId' => $userid, 'fldAddDate' => date("y-m-d"));
            $db->insertRec(TBL_ATHELETE_STAT, $strDataArr);
        }
        $msg = "Hello Coach, <br /><br />\r\r\n            You are receiving this email because an Athlete on your team has posted Game Stats for a particular game/event. Please login to your Account at www.collegeprospectnetwork.com, and review these Stats @ 'My Account > Athlete Stats Approval' section.\r            <br /><br />  \r            <b>Athlete:</b> " . $AthleteName . "<br />  \r            <b>Game / Event:</b> " . $EventName . "<br />  \r            <br />     \r\r\n            Thank you in advance Coach,<br />\r\r\n            College Prospect Network<br />\r\r\n            www.CollegeProspectNetwork.com";
        $query_Coach_id = " Select fldEmail  from " . TBL_HS_AAU_COACH . " where fldId ='" . $coach_id . "'";
        $db->query($query_Coach_id);
        $db->next_record();
        $coachEmail = $db->f('fldEmail');
        $toStre1 = $coachEmail;
        $subjectStre = "College Prospect Network  - Stats Approvel Request";
        $bodyStre = $msg;
        #$t = $func -> sendEmail($coachEmail, $subjectStre, $bodyStre, $athemail);
        header("Location: AtheleteStat.php?msg=1&fldEventId=" . $_GET['fldEventId'] . "&&page =" . $_GET['page']);
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 #} else if ($db -> MatchingRec(TBL_COLLEGE_COACH_REGISTER, $whereClause_subscribe) > 0) {
 #user Username already exists
 //$fldSubscribe = 1;
 #} else {
 //$fldSubscribe = 0;
 #}
 if ($flag == 0) {
     //Insert data
     $fldCancelCount = 0;
     $debugstep = 1;
     ##INSERT COLLEGE COACH###
     #######################################
     $strDataArr = array('fldUserName' => $func->input_fun($_POST['fldUserName']), 'fldPassword' => $func->input_fun($_POST['fldPassword']), 'fldCollegename' => $CollegeSchoolId, 'fldAddress' => $func->input_fun($_POST['fldAddress']), 'fldCity' => $func->input_fun($_POST['fldCity']), 'fldState' => $func->input_fun($_POST['fldState']), 'fldZipCode' => $func->input_fun($_POST['fldZipCode']), 'fldSport' => $func->input_fun($_POST['fldNeedType']), 'fldStatus' => "ACTIVE", 'fldPosition' => $func->input_fun($_POST['fldPosition']), 'fldNeedType' => $func->input_fun($_POST['fldNeedType']), 'fldEmail' => $func->input_fun($_POST['fldEmail']), 'fldAlternativeEmail' => $func->input_fun($_POST['fldAlternativeEmail']), 'fldFirstName' => $func->input_fun($_POST['fldFirstName']), 'fldLastName' => $func->input_fun($_POST['fldLastName']), 'fldPhone' => $func->input_fun($_POST['fldPhone']), 'fldAlternativePhone' => $func->input_fun($_POST['fldAlternativePhone']), 'fldDivison' => $func->input_fun($_POST['fldDivison']), 'fldQuestion' => $func->input_fun($_POST['fldQuestion']), 'fldAnswer' => $func->input_fun($_POST['fldAnswer']), 'fldSubscribe' => $fldSubscribe, 'fldCancelCount' => $fldCancelCount, 'fldAddDate' => date("y-m-d"));
     $debugstep = 2;
     //Insert Data - Get NewUserID
     $NewUserId = $db->insertRec(TBL_COLLEGE_COACH_REGISTER, $strDataArr);
     $debugstep = 3;
     //If NewUser success, check for Custom College
     if ($NewUserId) {
         $debugstep = 4;
         $_SESSION['FRONTEND_USER'] = $_POST['fldUserName'];
         $_SESSION['mode'] = 'college';
         $_SESSION['fldSubscribe'] = $fldSubscribe;
         $_SESSION['College_Coach_id'] = $NewUserId;
         if ($_POST['fldCollegename'] == "other") {
             ##########################################
             ### Insert Custom College ###
             ##########################################
             //Get Lattitude & Longitude
             $Zipcode_lat_lon = $func->getLatLong($_POST['fldZipCode'], MAPS_APIKEY);
             //Build Insert Data
        $buff[] = $_POST['fldHonest'];
        $buff[] = $_POST['fldPrepration'];
        //Date
        $buff[] = date("y-m-d");
        //$buff[] = '<pre style="text-align:left">'.print_r($_POST, true).'</pre>';
    } else {
        $buff[] = 'No POST data';
    }
    //$buff[] = $_SERVER['HTTP_X_REQUESTED_WITH'] ? 'This is AJAX request' : 'This is POST request<br><a href="javascript:history.back();">&laquo; Back</a>';
    echo implode('<br>', $buff);
    //header("Location:RatingAthlete.php?fldId=" . $_REQUEST['fldId'] . "&msg=$buff");
}
if ($_POST['save'] == 'save') {
    if ($IsCollegeCoach == 1) {
        $starr = array('fldHs_Aau_Coach_id' => $_REQUEST['fldId'], 'fld_College_Coach_id' => $college_coach_id, 'fldAthlete_contribue' => $_POST['fldAthlete_contribue'], 'fldComunication' => $_POST['fldComunication'], 'fldRequest_Game_Tape' => $_POST['fldRequest_Game_Tape'], 'fldHonest' => $_POST['fldHonest'], 'fldPrepration' => $_POST['fldPrepration'], 'fldAddDate' => date("y-m-d"));
        $db->insertRec(TBL_HS_AAU_COACH_RATE, $starr);
        //$msg = 'Rating successfully added.  <a href="javascript:refreshParent();">Close Window</a>';
        $msg = 'Success';
        header("Location:RatingHsAauCoach.php?fldId=" . $_REQUEST['fldId'] . "&mode=view&msg={$msg}");
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>College Prospect Network - HS/AAU Coach Rating</title>
        <META NAME="Keywords" CONTENT="My Account">
        <META NAME="Description" CONTENT="My Account">
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <script language="Javascript" src="javascript/functions.js"></script>
        $buff[] = $_POST['fldHustle'];
        $buff[] = $_POST['fldStrength'];
        //Date
        $buff[] = date("y-m-d");
        //$buff[] = '<pre style="text-align:left">'.print_r($_POST, true).'</pre>';
    } else {
        $buff[] = 'No POST data';
    }
    //$buff[] = $_SERVER['HTTP_X_REQUESTED_WITH'] ? 'This is AJAX request' : 'This is POST request<br><a href="javascript:history.back();">&laquo; Back</a>';
    echo implode('<br>', $buff);
    //header("Location:RatingAthlete.php?fldId=" . $_REQUEST['fldId'] . "&msg=$buff");
}
if ($_POST['save'] == 'save') {
    if ($IsHSCoach == 1) {
        $starr = array('fldAthlete_id' => $_REQUEST['fldId'], 'fldCoach_id' => $coach_id, 'fldLeaderShip' => $_POST['fldLeaderShip'], 'fldWork_Ethic' => $_POST['fldWork_Ethic'], 'fldPrimacy_Go_To_Guy' => $_POST['fldPrimacy_Go_To_Guy'], 'fldMental_Toughness' => $_POST['fldMental_Toughness'], 'fldComposure' => $_POST['fldComposure'], 'fldAwareness' => $_POST['fldAwareness'], 'fldInstincts' => $_POST['fldInstincts'], 'fldVision' => $_POST['fldVision'], 'fldConditioning' => $_POST['fldConditioning'], 'fldPhysical_Toughness' => $_POST['fldPhysical_Toughness'], 'fldTenacity' => $_POST['fldTenacity'], 'fldHustle' => $_POST['fldHustle'], 'fldStrength' => $_POST['fldStrength'], 'fldAddDate' => date("y-m-d"));
        $db->insertRec(TBL_RATING, $starr);
        //$msg = 'Rating successfully added.  <a href="javascript:refreshParent();">Close Window</a>';
        $msg = 'Success';
        header("Location:RatingAthlete.php?fldId=" . $_REQUEST['fldId'] . "&mode=view&msg={$msg}");
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>College Prospect Network - Athlete Rating</title>
		<META NAME="Keywords" CONTENT="My Account">
		<META NAME="Description" CONTENT="My Account">
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<script language="Javascript" src="javascript/functions.js"></script>
 $fldEventStartDate = $func->input_fun($_POST['fldEventStartDate']);
 $fldEventEndDate = $func->input_fun($_POST['fldEventEndDate']);
 $fldHomeTeam = $func->input_fun($_POST['fldHomeTeam']);
 $fldAwayTeam = $func->input_fun($_POST['fldAwayTeam']);
 $fldEventStatus = $func->input_fun($_POST['fldEventStatus']);
 //Check if Home or Away is your own team
 if ($fldHomeTeam != $Myteam && $fldAwayTeam != $Myteam) {
     $error_msg = 'Home or Away Team must be your Team!';
     $flag++;
 }
 if ($flag == 0) {
     //Set Dates to MySQL Format
     $MySQLStartDate = $_POST['fldEventStartDate'];
     $MySQLEndDate = $_POST['fldEventEndDate'];
     $strDataArr = array('fldEventName' => $func->input_fun($_POST['fldEventName']), 'fldSport' => $func->input_fun($_POST['fldSport']), 'fldEventDescription' => $func->input_fun($_POST['fldEventDescription']), 'fldEventLocation' => $func->input_fun($_POST['fldEventLocation']), 'fldEventStartDate' => $MySQLStartDate, 'fldEventEndDate' => $MySQLEndDate, 'fldHomeTeam' => $func->input_fun($_POST['fldHomeTeam']), 'fldAwayTeam' => $func->input_fun($_POST['fldAwayTeam']), 'fldEventStatus' => 1, 'fldUserName' => $func->input_fun($_SESSION['FRONTEND_USER']), 'fld_UserType' => "athlete");
     $newRowID = $db5->insertRec(TBL_EVENT, $strDataArr);
     #Debug - Print Array Details
     #print_r(array_values($strDataArr));
     #echo ("NewID:" . $newRowID . ":");
     #Redirect User
     header("Location: listevent.php?msg=Event successfully added.");
 }
 //this section is use to filup the value after erro message.
 #if ($error_msg != "") {
 $fldEventName = $_REQUEST['fldEventName'];
 $fldSport = $_REQUEST['fldSport'];
 $fldEventDescription = $_REQUEST['fldEventDescription'];
 $fldEventLocation = $_REQUEST['fldEventLocation'];
 $fldEventStartDate = $_REQUEST['fldEventStartDate'];
 $fldEventEndDate = $_REQUEST['fldEventEndDate'];
 $fldHomeTeam = $_REQUEST['fldHomeTeam'];