<?php
require_once('functions/functions.php');
session_start();
$safe=TRUE;
if (!empty($_POST))
{
foreach ($_POST as $value)
{
if (!is_safe($value))
{
$safe=FALSE;
}
}
}
else
{
$safe=FALSE;
}
if (permission_check('K')&&$safe)
{
//parse emails
for ($i=0;$i<4;$i++)
{
$emails=array_merge($emails,array($_POST['newemail'.$i]));
}
//parse phones
for ($i=0;$i<4;$i++)
{
$tempPhone=array('loc'=>$_POST['newphoneloc'.$i],'num'=>$_POST['newphonenum'.$i],'ext'=>$_POST['newphoneext'.$i]);
$phones=array_merge($phones,array($tempPhone));
}
//effective date
$_POST['effectivedate']=trim($_POST['effectivedate']).'-01';
//add ref
$userid=add_ref($_POST['firstname'], $_POST['lastname'], $_POST['badge'], $_POST['address'], $_POST['city'], $_POST['state'], $_POST['zip'], $_POST['trained'], $_POST['born'], $_POST['center'], $_POST['comfortlevel'], $_POST['yearsexperiance'], $_POST['safehaven'], $_POST['relyemail'], $_POST['wwwaccess'], $_POST['gender'], $_POST['unisize'], $_POST['upgradenotes'], $_POST['otherrole'], $_POST['aysoid'], $_POST['priorexperiance'],$emails,$phones,$_POST['callstatus'],$_POST['effectivedate'],trim($_POST['servicepointteams']));
header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/leadviewdata.php?datafor=".$userid);
}
else
{
header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/main.php");
}
?>