$value){ //echo "$key,$value
"; if(substr($key,0,4)==$prefix){ $sqlUpdate = "Update $sortTable set DisplayOrder = '".cleanSQL($thisDO)."' WHERE id='".cleanSQL($value)."' AND $parentFieldName = $parentId"; //echo "$sqlString
"; $thisDO = $thisDO + 10; mysql_query($sqlUpdate) or die (__LINE__ . ": " . mysql_error()); } } } //function doSortUpdate() function isValidURL($url){ $pattern = '/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/'; return preg_match($pattern, $url); } function updateTableValue($thisId,$tableName,$fieldName,$passedValue){ $fieldValue = trim($_POST[$fieldName]); if($passedValue===0)$passedValue="__ZERO__"; if ($passedValue!="")$fieldValue=$passedValue; if ($thisId&&$fieldValue&&$fieldName){ $setClause = " $fieldName='".cleanSQL($fieldValue)."' "; if ($passedValue=="SYSDATE()")$setClause = " $fieldName=SYSDATE() "; if ($passedValue=="_BLANK")$setClause = " $fieldName='' "; if ($passedValue=="NULL")$setClause = " $fieldName=NULL "; if ($passedValue=="__ZERO__")$setClause = " $fieldName='0' "; $sql = "Update $tableName SET $setClause WHERE id = '".cleanSQL($thisId)."'"; mysql_query($sql) or die (basename(__FILE__).':'.__LINE__.':'.mysql_error()); } } //function updateTableValue function getFormBody($fields,$formName){ GLOBAL $clearBothString; $formBody = array(); foreach ($fields as $fieldName =>$fieldInfo){ list($Label, $FormField,$ErrText,$showField,$Type,$Column,$currVal) = funDrawQuestion($fieldName,$fields,$formName); $labelClass = "QDivtext"; $thisLabelStyle = ""; $Required = $fields[$fieldName]["Required"]; $requiredIndicator = ""; if ($Required)$requiredIndicator = "*"; $thisLabelClass = $fields[$fieldName]["LabelClass"]; $fieldMessage = $fields[$fieldName]["fieldMessage"]; if ($thisLabelClass)$labelClass=$thisLabelClass; $thisLabelStyle = $fields[$fieldName]["LabelStyle"]; if ($thisLabelStyle)$thisLabelStyle = " style=\"$thisLabelStyle\" "; $answerClass = "ADivtext"; $thisAnswerClass = $fields[$fieldName]["AnswerClass"]; if ($thisAnswerClass)$answerClass=$thisAnswerClass; $thisAnswerStyle = $fields[$fieldName]["AnswerStyle"]; $thisAnswerDivStyle = $fields[$fieldName]["AnswerDivStyle"]; if ($thisAnswerStyle)$thisAnswerStyle = " style=\"$thisAnswerStyle\" "; if ($thisAnswerDivStyle)$thisAnswerDivStyle = " style=\"$thisAnswerDivStyle\" "; if ($Type=="groupHeading"){ $formBody[$Column] .= "
".$Label."
\n"; $formBody[$Column] .= $clearBothString; }else if($Type=="htmlContent"){ $formBody[$Column] .= $currVal; }else if($Type=="groupHeadingEnd"){ $formBody[$Column] .= "
"; }else{ if ($showField){ if($Label)$formBody[$Column] .= "
".$Label.$requiredIndicator."
\n"; $formBody[$Column] .= "
".$FormField."".$fieldMessage."
\n"; if ($ErrText!="")$formBody[$Column] .= "
".$ErrText."
\n"; $formBody[$Column] .= $clearBothString; }else{ $formBody[$Column] .="$FormField\n"; } } } //if (count($formBody)==1)$formBody=$formBody[1]; return $formBody; } function getSQLSelectList($fields){ foreach ($fields as $fieldName =>$fieldInfo){ $DoNotUpdate = $fieldInfo["DoNotUpdate"]; $LoadValue = $fieldInfo["LoadValue"]; if ($fieldInfo["Type"]=="id"&&$fieldInfo["ValueCur"]!=""&&!$DoNotUpdate){ $idClause = " WHERE id='".cleanSQL($fieldInfo["ValueCur"])."' "; }else{ if (!$DoNotUpdate||$LoadValue){ if ($sqlFieldList!="")$sqlFieldList.=", "; $sqlField = ""; if ($fieldInfo["TablePrefix"]!="")$sqlField = $fieldInfo["TablePrefix"] . "."; $sqlField .= $sqlField; $sqlFieldList .= $fieldName; } } } return array($sqlFieldList,$idClause); } //getSQLSelectList function loadEditValues($fields,$row){ foreach ($fields as $fieldName =>$fieldInfo){ $Type=strtolower($fieldInfo["Type"]); $MatchValueField=$fieldInfo["MatchValueField"]; $DoEncrypt=$fieldInfo["DoEncrypt"]; $ValueCur = stripslashes($row[$fieldName]); //echo "$fieldName - $ValueCur
"; if (!$ValueCur&&$MatchValueField)$ValueCur = stripslashes($row[$MatchValueField]); if ($ValueCur!=""){ if ($Type=="phone")list($ValueCur,$whatever)=funFormatPhone($ValueCur,$method="output"); if ($Type=="date")$ValueCur=date("m/d/Y",strtotime($ValueCur)); if ($Type=="ccnum")$ValueCur=displayCCNum($ValueCur); if ($fieldName=="URL")$ValueCur=cleanURL($ValueCur,$InOut="OUT"); if ($DoEncrypt)$ValueCur=encryptDecrypt($ValueCur,"d"); if ($Type=="redemptioncode")$ValueCur = formatRedemptionCode($ValueCur); $fields[$fieldName]["ValueCur"]=$ValueCur; } } return $fields; } //getSQLSelectList function encryptDecrypt($value,$encDec){ if($encDec=="d"){ //decrypt } if($encDec=="e"){ //encrypt } return $value; } function cleanCommas($string){ $string = str_replace(", "," ",$string); $string = str_replace(" ,"," ",$string); $string = str_replace(","," ",$string); return $string; } function getSQLUpdateData($fields){ global $boolDebug; $formError=false; foreach ($fields as $fieldName =>$fieldInfo){ $ValueCur = $_POST[$fieldName]; $fields[$fieldName]["ValueCur"]=$ValueCur; $ValueCur=str_replace("","®",$ValueCur); $ValueCur=str_replace("","",$ValueCur); $Type = strtolower($fieldInfo["Type"]); $Required = $fieldInfo["Required"]; $DoNotUpdate = $fieldInfo["DoNotUpdate"]; $AddCookie = $fieldInfo["AddCookie"]; $fieldLabel = $fieldInfo["Label"]; $DoEncrypt=$fieldInfo["DoEncrypt"]; if ($AddCookie)setcookie($fieldName, $ValueCur); if ($Type=="redemptioncode"&&!$DoNotUpdate){ list($redemptionCode,$isValid,$isUsed,$redemptionData)=checkRedemptionCode($redemptionCode="",$patientId="",$action=""); $ValueCur = $redemptionCode; if ($isValid&&$isUsed){ $fields[$fieldName]["ErrText"]="Starter Code has already been redeemed!"; $fields[$fieldName]["ErrState"]=true; $formError=true; } if (!$isValid){ $fields[$fieldName]["ErrText"]="Starter Code is invalid!"; $fields[$fieldName]["ErrState"]=true; $formError=true; } } if ($Type=="redemptioncouponcode"&&!$DoNotUpdate){ list($redemptionCode,$isValid,$isUsed,$redemptionData)=checkRedemptionCouponCode($redemptionCode="",$patientId="",$action=""); $ValueCur = $redemptionCode; if ($isValid&&$isUsed){ $fields[$fieldName]["ErrText"]="Error: This code has expired or has been used the maximum number of times"; $fields[$fieldName]["ErrState"]=true; $formError=true; } if (!$isValid){ $fields[$fieldName]["ErrText"]="Error: Invalid code. Please try again"; $fields[$fieldName]["ErrState"]=true; $formError=true; } } if (!$DoNotUpdate){ $sqlFieldName = ""; if ($sqlUpdate!="")$sqlUpdate.=", "; if ($fieldInfo["TablePrefix"]!="")$sqlFieldName = $fieldInfo["TablePrefix"] . "."; $sqlFieldName .= $fieldName; if ($Required&&$ValueCur==""&&!$DoNotUpdate){ $fields[$fieldName]["ErrText"]="$fieldLabel is REQUIRED!"; $fields[$fieldName]["ErrState"]=true; $formError=true; if ($boolDebug)echo "$fieldName == $ValueCur [error]
"; } //$ValueCur = $_POST[$fieldName]; if ($fieldInfo["Type"]=="id"){ if ($ValueCur!=""&&$ValueCur!="0")$idClause = " WHERE id='".cleanSQL($ValueCur)."' "; }else if ($fieldName=="URL"){ if ($ValueCur!="")$ValueCur = cleanURL($ValueCur,$InOut="IN"); $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; }else if ($Type=="date"){ if ($ValueCur!=""){ $ValueCur = date("Y-m-d H:i:s",strtotime(trim($ValueCur))); $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; }else{ $ValueCur ="null"; $sqlUpdate .= " $sqlFieldName = null"; } }else if ($Type=="timestamp"){ if ($ValueCur!="")$ValueCur = date("Y-m-d H:i:s",time()); $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; }else if ($Type=="phone"){ if ($ValueCur!="")$ValueCur = funFormatPhone($ValueCur,$method="input"); $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; }else if ($Type=="price"){ if ($ValueCur!="")$ValueCur = floatval(ereg_replace("[^-0-9\.]","",$ValueCur)); $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; }else if ($Type=="number"){ //if ($ValueCur!="")$ValueCur = floatval(ereg_replace("[^-0-9\.]","",$ValueCur)); $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; }else if ($Type=="radio"){ if (isBlank($ValueCur)){ $sqlUpdate .= " $sqlFieldName = null"; }else{ $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; } }else if ($Type=="ccnum"){ //if ($ValueCur!="")$ValueCur = floatval(ereg_replace("[^-0-9\.]","",$ValueCur)); $ValueCur = substr($ValueCur,-4); $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; }else{ if (!$DoNotUpdate){ if($DoEncrypt){ $sqlUpdate .= " $sqlFieldName = '".encryptDecrypt(cleanSQL($ValueCur),"e")."'"; }else{ $sqlUpdate .= " $sqlFieldName = '".cleanSQL($ValueCur)."'"; } } } } //if (!$DoNotUpdate){ } if ($formError==true)$sqlUpdate=""; return array($fields,$sqlUpdate,$idClause,$formError); } //getSQLUpdateData function funDrawQuestion($fieldName,$fields,$formName) { GLOBAL $clearBothString; $fieldInfo = $fields[$fieldName]; $Type = $fieldInfo["Type"]; $Column = $fieldInfo["Column"]; if ($Column=="")$Column=1; $TablePrefix = $fieldInfo["TablePrefix"]; $Label = $fieldInfo["Label"]; $DoNotUpdate = $fieldInfo["DoNotUpdate"]; $Height = $fieldInfo["Height"]; $Width = $fieldInfo["Width"]; $Required = $fieldInfo["Required"]; $ValueDef = $fieldInfo["ValueDef"]; $ValueCur = $fieldInfo["ValueCur"]; $ErrText = $fieldInfo["ErrText"]; $ErrState = $fieldInfo["ErrState"]; $class = $fieldInfo["class"]; $style = $fieldInfo["style"]; $jsContent = $fieldInfo["jsContent"]; $orderby = $fieldInfo["orderby"]; $valuetype = $fieldInfo["valuetype"]; $dbTable = $fieldInfo["dbTable"]; $dbWhere = $fieldInfo["dbWhere"]; $Unique = $fieldInfo["Unique"]; $UniqueValue = $fieldInfo["UniqueValue"]; $otherValueField = $fieldInfo["otherValue"]; $strThisQSubType = $fieldInfo["subtype"]; $specialValue = $fieldInfo["specialValue"]; if ($otherValueField)$otherValue = $fields[$otherValueField]["ValueCur"]; $showField=true; if ($Type=="id"||$Type=="hidden"||$Type=="note"||$Type=="otherValue")$showField=false; if ($class!=""){ $strThisAnswerClass = " class=\"".$class."\" "; }else{ $strThisAnswerClass = ""; } if ($style!=""){ $strThisAnswerStyle = " style=\"".$style."\" "; }else{ $strThisAnswerStyle = ""; } if ($ValueCur==""&&$ValueDef!="")$ValueCur=$ValueDef; $strThisQDefault = $row["Default"]; if (strtolower($Type)=="radio"){ if ($strThisQSubType=="YN"){ $strValue1 = "1";$strValue0 = "0"; if ($ValueCur == "1"){ $str1Checked = " checked"; $str0Checked = ""; }else if($ValueCur == "0"||$ValueCur == "") { $str1Checked = ""; $str0Checked = " checked"; }else{ $str1Checked = "";$str0Checked = ""; } }else{ $strValue1 = "1";$strValue0 = "0"; if ($ValueCur == "1"){ $str1Checked = " checked=\"checked\" "; $str0Checked = ""; }else if($ValueCur == "0") { $str1Checked = ""; $str0Checked = " checked=\"checked\" "; }else{ $str1Checked = "";$str0Checked = ""; } } $FormField .=" YES   "; $FormField .=" NO"; }else if (strtolower($Type)=="select"){ if ($FormField==""){ $FormField="\n"; }else if (strtolower($Type)=="checkbox"){ if (funIsInList($strThisAnswerData,$intAID)){$strThisSelected = " checked";}else{$strThisSelected = "";} if ($boolDefault&&$boolNewEntry){$strThisSelected = " checked";} $FormField .="
".$ValueCur."
\n"; }else if (strtolower($Type)=="radiolist"){ if (funIsInList($strThisAnswerData,$intAID)){$strThisSelected = " checked";}else{$strThisSelected = "";} if ($strAnswerClass=="")$strAnswerClass = "checkTextDivSmWide"; if ($boolDefault&&$boolNewEntry){$strThisSelected = " checked";} $FormField .="
".$ValueCur."
\n"; }else if (strtolower($Type)=="text"||strtolower($Type)=="date"||strtolower($Type)=="ccnum"||strtolower($Type)=="email"||strtolower($Type)=="email2"|| strtolower($Type)=="phone"|| strtolower($Type)=="price" || strtolower($Type)=="number" ){ if ($Unique)$onchange=" onblur=\"javascript:checkEmail();\" "; if (strtolower($Type)=="price")$FormField.="$"; $FormField.=""; if ($Unique||$UniqueValue){ $FormField.=" "; //$FormField.="
". $GVAR["clearBothDiv"]." $FormField.="
"; } }else if (strtolower($Type)=="password"){ $FormField="
"; }else if (strtolower($Type)=="password2"){ $FormField=""; }else if (strtolower($Type)=="longdesc"){ $FormField=""; $FormField.=" "; }else if (strtolower($Type)=="readonly"){ $FormField="
$ValueCur
"; }else if (strtolower($Type)=="displayonly"){ $FormField="
$ValueCur
"; }else if (strtolower($Type)=="datepair"){ $FormField .= "
"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " \"Calendar\"
\n"; $FormField .= "
"; $FormField .= "
\n"; $FormField .= " TO
\n"; $FormField .= "
"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " \"Calendar\"
\n"; $FormField .= "
"; $FormField .= "
"; $FormField .= "
\n"; $FormField .= "\n"; }else if (strtolower($Type)=="redemptioncode"){ $rc1 = trim($_POST["rc1"]); $rc2 = trim($_POST["rc2"]); $rc3 = trim($_POST["rc3"]); if ($DoNotUpdate){ $FormField .= "
$ValueCur
"; }else{ $FormField .= "
"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " -"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " -"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
"; $FormField .= "
\n"; } }else if (strtolower($Type)=="redemptioncouponcode"){ $rc1 = trim($_POST["rc1"]); $rc2 = trim($_POST["rc2"]); $rc3 = trim($_POST["rc3"]); if ($DoNotUpdate){ $FormField .= "
$ValueCur
"; }else{ $FormField .= "
"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " -"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " -"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
"; $FormField .= "
\n"; } }else if (strtolower($Type)=="dateOldWay"){ $FormField .= "
"; $FormField .= "
\n"; $FormField .= " \n"; $FormField .= "
\n"; $FormField .= "
\n"; $FormField .= " \"Calendar\"
\n"; $FormField .= "
"; $FormField .= "
"; $FormField .= "
\n"; }else if (strtolower($Type)=="textarea"){ $FormField=""; }else if (strtolower($Type)=="dropdowndb"){ if ($dbWhere!="")$dbWhere = " WHERE ". $dbWhere; $matched=false; $hasOther=false; if ($jsContent){ $FormField=""; } $FormField.="\n"; $sql = "Select id,ShortDesc,OtherValue,dataValue FROM $dbTable $dbWhere Order By $orderby"; //echo "
$sql
"; $rs = mysql_query($sql) or die (__LINE__ . ": " . mysql_error()); $recordCount = mysql_num_rows($rs); $ff=1; while($row = mysql_fetch_array($rs)) { $id = stripslashes($row["id"]); $ShortDesc = stripslashes($row["ShortDesc"]); $dataValue = stripslashes($row["dataValue"]); $OtherValue = stripslashes($row["OtherValue"]); if ($strThisQSubType=="CoPledgeMultiplier"){ $ShortDesc = "$ShortDesc x Original Pledge (".formatCurrency($specialValue).") = " . formatCurrency(round(($ShortDesc * $specialValue),2)); $dataValue = round(($ShortDesc * $specialValue),2); } if ($OtherValue){ $hasOther=true; $otherLabel=$ShortDesc; } if ($valuetype=="ShortDesc")$id=$ShortDesc; if ($valuetype=="dataValue")$id=$dataValue; $selected = ""; if ($ValueCur==$id||($ff==$recordCount&&!$matched&&$OtherValue&&$ValueCur)){ $selected = " selected=\"selected\""; $matched=true; if ($OtherValue)$otherSelected=true; } //$debugMe = " $ValueCur == $id||( $ff == $recordCount&&! $matched && $OtherValue && $ValueCur "; $FormField.="\n"; $ff++; } $FormField.=""; if ($hasOther){ $showOther="none"; if ($otherSelected)$showOther="block"; $FormField.="$clearBothString"; $FormField.="
$otherLabel
\n"; } }else if (strtolower($Type)=="dropdownarray"){ $matched=false; $hasOther=false; $dropdownArray = $fieldInfo["dropdownArray"]; if ($jsContent){ $FormField=""; } $FormField.="\n"; foreach($dropdownArray as $id=>$ShortDesc){ //while($row = mysql_fetch_array($rs)) { //$id = stripslashes($row["id"]); // $ShortDesc = stripslashes($row["ShortDesc"]); // $dataValue = stripslashes($row["dataValue"]); // $OtherValue = stripslashes($row["OtherValue"]); if ($OtherValue){ $hasOther=true; $otherLabel=$ShortDesc; } if ($valuetype=="ShortDesc")$id=$ShortDesc; $selected = ""; if ($ValueCur==$id||($ff==$recordCount&&!$matched&&$OtherValue&&$ValueCur)){ $selected = " selected=\"selected\""; $matched=true; if ($OtherValue)$otherSelected=true; } //$debugMe = " $ValueCur == $id||( $ff == $recordCount&&! $matched && $OtherValue && $ValueCur "; $FormField.="\n"; $ff++; } $FormField.=""; if ($hasOther){ $showOther="none"; if ($otherSelected)$showOther="block"; $FormField.="$clearBothString"; $FormField.="
$otherLabel
\n"; } }else if (strtolower($Type)=="dropdownstates"){ $matched=false; $hasOther=false; $FormField=""; if ($hasOther){ $showOther="none"; if ($otherSelected)$showOther="block"; $FormField.="$clearBothString"; $FormField.="
$otherLabel
\n"; } }else if (strtolower($Type)=="dropdownlab"){ $matched=false; $hasOther=false; $FormField=""; if ($hasOther){ $showOther="none"; if ($otherSelected)$showOther="block"; $FormField.="$clearBothString"; $FormField.="
$otherLabel
\n"; } }else if (strtolower($Type)=="dropdownsurvey"){ $matched=false; $hasOther=false; $FormField="   [ MANAGE SURVEYS ]"; if ($hasOther){ $showOther="none"; if ($otherSelected)$showOther="block"; $FormField.="$clearBothString"; $FormField.="
$otherLabel
\n"; } }else if (strtolower($Type)=="ccexppair"){ $ccExpPairValues = explode("/",$ValueCur); $ccExpMMValue = $ccExpPairValues[0]; $ccExpYYYYValue = $ccExpPairValues[1]; if ($ccExpMMValue==""&&$ccExpYYYYValue==""){ $ccExpMMValue = trim($_POST["ccExpMM"]); $ccExpYYYYValue = trim($_POST["ccExpYYYY"]); } $matched=false; $hasOther=false; $q=1; $ValueCur = $ccExpMMValue; $FormField=""; $q=1; $ValueCur = $ccExpYYYYValue; $thisYear = date("Y",time()); $FormField.=" "; }else if ($Type=="note"){ $FormField=$Label; }else if (!$showField&&$Type!="otherValue"){ $FormField=""; } // if (strtolower($Type)=="select"){$FormField .="";} return array($Label,$FormField,$ErrText,$showField,$Type,$Column,$ValueCur); } //function funDrawQuestion($fieldName,$strThisAnswerData,$strAnswerClass) function funLeadingZero($val){ if (is_numeric($val)){ if ($val>=1&&$val<=9)$val="0".$val; } return $val; } function listFormErrors($fields){ foreach ($fields as $fieldName =>$fieldInfo){ $ErrText = $fieldInfo["ErrText"]; if ($ErrText){} echo "$fieldName
$ErrText
"; } } function getRequiredJS($fields,$formName){ foreach ($fields as $fieldName =>$fieldInfo){ $QTextShort = str_replace("'","\'",$fieldInfo["Label"]); $Required = $fieldInfo["Required"]; $Unique = $fieldInfo["Unique"]; $UniqueValue = $fieldInfo["UniqueValue"]; if ($QTextShort=="")$QTextShort=$fieldName; $QType = strtolower($fieldInfo["Type"]); $minDate = $fieldInfo["minDate"]; $maxDate = $fieldInfo["maxDate"]; $otherJQFunction = $fieldInfo["otherJQFunction"]; if ($Required){ //if ($QType=="text"||$QType=="select"){ if ($QType=="text"||$QType=="dropdowndb"||$QType=="dropdownstates"||$QType=="dropdown"||$QType=="password"||$QType=="longdesc"||$QType=="date"){ $jsRequired .="if (isBlank(document.forms.".$formName.".".$fieldName.".value)){\n"; $jsRequired .=" errMessage = errMessage + '".$QTextShort." is required.\\n';\n"; $jsRequired .="}\n"; } if ($QType=="ccexppair"){ $firstOfNextMonth = firstOfNextMonth(); $jsRequired .="if (isBlank(document.forms.".$formName.".ccExpMM.value)){\n"; $jsRequired .=" errMessage = errMessage + 'Card Expiration Month is required.\\n';\n"; $jsRequired .="}\n"; $jsRequired .="if (isBlank(document.forms.".$formName.".ccExpYYYY.value)){\n"; $jsRequired .=" errMessage = errMessage + 'Card Expiration Year is required.\\n';\n"; $jsRequired .="}\n"; $jsRequired .=" if (!isBlank(document.forms.".$formName.".ccExpMM.value)&&!isBlank(document.forms.".$formName.".ccExpYYYY.value)){\n var expYear = document.forms.".$formName.".ccExpYYYY.value; var expMonth = document.forms.".$formName.".ccExpMM.value; if (expMonth==12){ expYear = parseFloat(expYear) + 1; expMonth = 1; }else{ expMonth = parseFloat(expMonth) + 1; } var expDate = expMonth+'/1/' + expYear; var firstOfNextMonth = new Date('".$firstOfNextMonth ."'); var dateCompare = new Date(expDate); if (dateCompare$fieldInfo){ return $jsRequired; }//end function getRequiredJSJQ function getRequiredJSJQ($fields,$formName){ foreach ($fields as $fieldName =>$fieldInfo){ $QTextShort = str_replace("'","\'",$fieldInfo["Label"]); $Required = $fieldInfo["Required"]; $Unique = $fieldInfo["Unique"]; $UniqueValue = $fieldInfo["UniqueValue"]; if ($QTextShort=="")$QTextShort=$fieldName; $QType = strtolower($fieldInfo["Type"]); $minDate = $fieldInfo["minDate"]; $maxDate = $fieldInfo["maxDate"]; $jqFunctionArr = array(); if($minDate!=="")$jqFunctionArr[] = " minDate: -$minDate"; if($maxDate!=="")$jqFunctionArr[] = " maxDate: +$maxDate"; $jqFunctionArr[] = $fieldInfo["otherJQFunction"]; $jqFunctionArrText = implode($jqFunctionArr,","); if ($Required){ //if ($QType=="text"||$QType=="select"){ if ($QType=="text"||$QType=="dropdowndb"||$QType=="dropdownstates"||$QType=="dropdown"||$QType=="password"||$QType=="longdesc"||$QType=="date"){ $jsRequired .="if (isBlank(document.forms.".$formName.".".$fieldName.".value)){\n"; $jsRequired .=" errMessage = errMessage + '".$QTextShort." is required.\\n';\n"; $jsRequired .="}\n"; } if ($QType=="ccexppair"){ $firstOfNextMonth = firstOfNextMonth(); $jsRequired .="if (isBlank(document.forms.".$formName.".ccExpMM.value)){\n"; $jsRequired .=" errMessage = errMessage + 'Card Expiration Month is required.\\n';\n"; $jsRequired .="}\n"; $jsRequired .="if (isBlank(document.forms.".$formName.".ccExpYYYY.value)){\n"; $jsRequired .=" errMessage = errMessage + 'Card Expiration Year is required.\\n';\n"; $jsRequired .="}\n"; $jsRequired .=" if (!isBlank(document.forms.".$formName.".ccExpMM.value)&&!isBlank(document.forms.".$formName.".ccExpYYYY.value)){\n var expYear = document.forms.".$formName.".ccExpYYYY.value; var expMonth = document.forms.".$formName.".ccExpMM.value; if (expMonth==12){ expYear = parseFloat(expYear) + 1; expMonth = 1; }else{ expMonth = parseFloat(expMonth) + 1; } var expDate = expMonth+'/1/' + expYear; var firstOfNextMonth = new Date('".$firstOfNextMonth ."'); var dateCompare = new Date(expDate); if (dateCompare$fieldInfo){ return array($jsRequired,$localJqueryData); }//end function getRequiredJSJQ function checkEmailUnique($fields,$formError,$tableName,$recordType,$recordId,$Email){ if ($recordId>0)$recordIdClause = " AND id <> $recordId "; $errText = ""; $recordTypeClause = " RecordType = '". cleanSQL($recordType) ."' AND "; if ($errText==""){ // lastly, see if it's used anywhere else in the same data type $sql = "SELECT COUNT(email) as EmailCount FROM $tableName WHERE $recordTypeClause email = '". cleanSQL($Email) ."' AND (Deleted = 0 OR Deleted is null) $recordIdClause"; //echo "$sql
"; $rs = mysql_query($sql) or die (__LINE__ . ": " . mysql_error()); if($row = mysql_fetch_array($rs)) { $count1 = funRequestInt($row["EmailCount"]); if ($count1>0){ $errText .= "A $recordType account already exists with email address: $Email!"; } } } if ($errText!=""){ $formError = True; $existingError = $fields["Email"]["ErrText"]; if ($existingError)$existingError .= "
"; $fields["Email"]["ErrText"].= $errText; $fields["Email"]["ErrState"]=true; } return array($fields,$formError); } //checkEmailUnique function checkDefaultItem($custId,$tableName){ $sql = "Select * from $tableName where custId='".cleanSQL($custId)."' AND (Deleted is null OR Deleted=0) order by CreateDate DESC"; $rs = mysql_query($sql) or die (__LINE__ . ": " . mysql_error()); $recordCount = mysql_num_rows($rs); if ($recordCount==1){ $row = mysql_fetch_array($rs); $id = stripslashes($row["id"]); $sql = "UPDATE $tableName set DefaultItem=1,LastUpdateDate = SYSDATE() WHERE id = $id"; mysql_query($sql) or die (__LINE__ . ": " . mysql_error()); } } //checkDefaultItem function listCustomerss($pageLimit,$editPageName,$tableName,$recordTypeDesc,$recordSubType,$searchFilters,$searchFiltersHaving,$isNotesSearch,$isShortResult,$isContactSearch,$Qparams) { global $GVAR; global $mySQLDateToday; global $mySQLDateTimeNow; global $boolAdminUser; global $boolHasPhotoApproval; global $ActUserRoles; global $usertype; global $getRec; global $boolPrintCSV; $gridcolor = $GVAR["GRIDCOLOR"]; $csvFieldArray = array( "id", "CompanyName", "ContactType", "Address", "Address2", "City", "State", "Zip", "Latitude", "Longitude", "Phone", "PhoneExt", "CellPhone", "Fax", "ProfileEmail", "Website", "FTEmployees", "PTEmployees", "AnnualSalesRevenue", "MemberSince", "Notes", "Prefix", "FirstName", "Middlename", "LastName", "Nickname", "Suffix", "Title", "Email", "Prefix2", "FirstName2", "Middlename2", "LastName2", "Nickname2", "Suffix2", "Title2", "Email2", "HoursofOperation", "BusinessCategory", "BusinessDescription", "SocialMedia1", "SocialMediaLink1", "SocialMedia2", "SocialMediaLink2", "SocialMedia3", "SocialMediaLink3", "SocialMedia4", "SocialMediaLink4", "SocialMedia5", "SocialMediaLink5", "Active", "Deleted", "CreateDate", "LastUpdateDate" ); if ($searchFilters!="")$FilterSQL = " AND ($searchFilters $searchFilters2) "; if ($recordTypeDesc=="Patient"){ $defaultSortFieldName = "LastName"; $defaultSortOrder = ""; }else{ $defaultSortFieldName = "CreateDate"; $defaultSortOrder = "DESC"; } //$aSortFields["defaultSortOrder"] $aSortFields = array("CreateDate" => "", "LastName" => "", "CompanyName" => "", "Email" => "","defaultSortOrder"=>$defaultSortOrder); list($sort,$ord,$aSortFields) = funGetSortData($aSortFields,$defaultSortFieldName); $sql = "SELECT * from Customers WHERE RecordType='$recordTypeDesc' $FilterSQL AND (Deleted is null OR Deleted = 0) ORDER BY $sort $ord"; //echo "
$sql
"; if ($boolPrintCSV){ list($total_items, $prevHTML, $indxHTML, $pagesHTML, $nextHTML, $rs,$recstart) = sqlQueryLimit($sql, $pageLimit=5000000); }else{ list($total_items, $prevHTML, $indxHTML, $pagesHTML, $nextHTML, $rs,$recstart) = sqlQueryLimit($sql, $pageLimit); } //$recstart = $_GET["recstart"]; if (!$getRec){ if($total_items > 0) { echo "$prevHTML"; if($total_items > $pageLimit) { echo "$indxHTML"; } echo "$nextHTML\n"; echo "\n"; echo ""; if ($recordTypeDesc=="Patient"){ $thisSortFieldName = "LastName";$thisSortFieldLabel = "Name"; }else{ $thisSortFieldName = "CompanyName";$thisSortFieldLabel = "Company Name"; } printSortHeader($thisSortFieldName,$aSortFields[$thisSortFieldName],$thisSortFieldLabel,$self,$qstr); $thisSortFieldName = "Email";$thisSortFieldLabel = "Email"; printSortHeader($thisSortFieldName,$aSortFields[$thisSortFieldName],$thisSortFieldLabel,$self,$qstr); $thisSortFieldName = "CreateDate";$thisSortFieldLabel = "Create Date"; printSortHeader($thisSortFieldName,$aSortFields[$thisSortFieldName],$thisSortFieldLabel,$self,$qstr); if (!$isNotesSearch&&$recordTypeDesc!="Patient")echo ""; if (!$isNotesSearch)echo ""; echo "\n"; } else { if (!$isNotesSearch)echo "No Records Found"; } } // if (!$getRec){ //echo "$sql
"; $count = 1; $currRecordPos = $recstart; while($row = mysql_fetch_array($rs)) { $arow = array(); $id = $row["id"]; $lastEditId = funRequestInt($_GET["EditID"]); $FirstName = stripslashes($row["FirstName"]); $LastName = stripslashes($row["LastName"]); $MemberName = "$FirstName $LastName"; $Approved = stripslashes($row["Approved"]); if (isBlank($Approved))$Status = "Pending Approval"; if ($Approved=="1")$Status = "APPROVED"; if ($Approved=="0")$Status = "REJECTED"; if ($recordTypeDesc!="Patient")$MemberName = stripslashes($row["CompanyName"]); if ($MemberName=="")$MemberName="EDIT"; $Email = stripslashes($row["Email"]); $CreateDate = $row["CreateDate"]; $editLinkHREF = "$editPageName?id=$id&rP=$currRecordPos&tR=$total_items".$backPageLink."$Qparams"; $editLinkHREFJS = str_replace("&","&",$editLinkHREF); $editLink = "$MemberName"; $editProfileEmailLink = "$ProfileEmail"; $deleteLink = "DELETE"; $editLink = "$MemberName"; //all start with edit link $arow[] = $editLink; $arow[] = $Email; $arow[] = funShowLocalTime($row["CreateDate"],"",""); if ($recordTypeDesc!="Patient")$arow[] = $Status; $arow[] = $deleteLink; $rowStyle=$gridcolor[$count % 2]; if ($lastEditId==$id)$rowStyle="gridRowEdited"; printTableRow($arow, $rowStyle); $count++; $currRecordPos++; } echo "
StatusDelete
\n"; } //listCustomerss function getBusinessCategories($recordId,$delimiter){ $sql = "SELECT S.ShortDesc FROM SysCategories S,RecordCategories C WHERE C.RecordId='".cleanSQL($recordId)."' AND S.id = C.CategoryId"; $rs = mysql_query($sql) or die (basename(__FILE__).':'.__LINE__.':'.mysql_error()); $catList = ""; while($row = mysql_fetch_array($rs)) { if ($catList!="")$catList.=$delimiter; $catList.= stripslashes($row["ShortDesc"]); } return $catList; } function funDoStoreLogin(){ //session_start(); $username = trim($_POST["username"]); if ($username=="bmsmarter@hotmail.com")$doTest=true; $password = trim($_POST["password"]); $userType = trim($_POST["userType"]); $rememberMe = trim($_POST["rememberMe"]); $remUid = $_COOKIE["remUid"]; $usrguid = $_COOKIE["usrguid"]; $ecpRegId = $_SESSION["ecpRegId"]; $loginError = "";//array(); $realLogin =False; if (strtolower($username)=="none")$username=""; if ($username==""&&$remUid!=""&&$usrguid!=""){ $guidLogin=true; $realLogin=true; $sql = "SELECT paCompany,Active,id as userId,firstName,lastName,CompanyName,email,companyId,GUID FROM Customers U WHERE RecordType = '".cleanSQL($userType)."' AND U.id = '".cleanSQL($remUid)."' AND U.guid='".cleanSQL($usrguid)."' and (U.deleted is null or U.deleted = 0)"; }else{ $realLogin=true; $sql = "SELECT paCompany,Active,id as userId,firstName,lastName,CompanyName,email,companyId,GUID FROM Customers U WHERE RecordType = '".cleanSQL($userType)."' AND U.email='".cleanSQL($username)."' AND U.password='".cleanSQL($password)."' and (U.deleted is null or U.deleted = 0)"; } //echo "$sql
"; if ($doTest){ //echo "$sql
"; //exit; } //echo ""; $rs = mysql_query($sql) or die (__LINE__ . ": " . mysql_error()); if ((($username != '' && $password != '')||$guidLogin||($ecpRegId&&$doEcpTempLogin)||$doMemberInitialLogin)) { while ($row = mysql_fetch_array($rs)){ $Active = $row["Active"]; $Approved = $row["Approved"]; if ($Active)$boolUserFound = true; $userType = $row["userType"]; //echo "
$usertype
"; //$accountname = $row["name"]; $userId = $row["userId"]; $paCompany =stripslashes($row["paCompany"]); $ActUserEmail =stripslashes($row["email"]); $ActUserCompany = stripslashes($row["CompanyName"]); $companyId = stripslashes($row["companyId"]); $ActUserName = stripslashes($row["firstName"])." ".stripslashes($row["lastName"]); $GUID = stripslashes($row["GUID"]); $customerId = $userId; if (($rememberMe||$guidLogin)&&$Active&&!$doMemberInitialLogin){ $cookieExp = time() + (3600 * 24 * 30); $newGUID = substr(strrev(uniqid()),0,10); $sql = "update Customers SET GUID = '".cleanSQL($newGUID)."' WHERE id=$userId"; mysql_query($sql) or die (__LINE__ . ": " . mysql_error()); setcookie("remUid", $userId,$cookieExp); setcookie("usrguid", $newGUID,$cookieExp); } if ($boolUserFound){ logActivity($userId,$activityType="Login",$activityDetail="",$qid="",$qaid=""); $_SESSION['session_userid'] = $userId; $_SESSION['actUserId'] = $userId; $_SESSION['actUserEmail'] = $ActUserEmail; $_SESSION['actUserCompany'] = $ActUserCompany; $_SESSION['paCompany'] = $paCompany; $_SESSION['actUserCompanyId'] = $companyId; $_SESSION['actUserName'] = $ActUserName; $_SESSION['actUserType'] = $userType; $ActDefaultPage="/rios/index.php"; if ($defaultPage!="")$ActDefaultPage=$defaultPage; $loginReqURL = $_COOKIE['loginReqURL']; setcookie("loginReqURL", ""); setcookie("ActDefaultPage", $ActDefaultPage); if ($loginReqURL!=""){ header("Location: $loginReqURL"); exit; }else{ header("Location: $ActDefaultPage"); exit; } }else{ //if ($boolUserFound){ $loginError = "
INVALID CREDENTIALS
Please try again
"; //$loginError[] = "Invalid login. Please try again."; setcookie("id",$userId); setcookie("remUid", ""); setcookie("usrguid", ""); } }//while ($row = mysql_fetch_array($rs)){ } else { //if ($boolUserFound){ # username is invalid //$loginError[] = "Invalid login. Please try again."; $loginError = "
INVALID CREDENTIALS
Please try again
"; // clear guid login if it fails! if ($guidLogin){ setcookie("remUid", ""); setcookie("usrguid", ""); } } //if ($boolUserFound){ return $loginError; } //function funDoStoreLogin(){ function funDoStoreLogout(){ global $noRedirect; $userType = strtolower($_SESSION['actUserType']); $boolForceLogout = funRequestInt($_GET["forcelogout"]); setcookie("customLogo", ''); setcookie("remUid", ""); setcookie("usrguid", ""); $_SESSION['session_userid'] = ''; $_SESSION['actUserId'] = ''; $_SESSION['actUserEmail'] = ''; $_SESSION['actUserCompany'] = ''; $_SESSION['paCompany'] = ''; $_SESSION['actUserCompanyId'] = ''; $_SESSION['actUserName'] = ''; $_SESSION['actUserType'] = ''; if (!$noRedirect){ $ActDefaultPage= "index.php?forcelogout=$boolForceLogout"; $ActDefaultPage = $_SERVER["PHP_SELF"];//"index.php"; header("Location: $ActDefaultPage"); exit; } } //function funDoStoreLogout(){ function getPhotoDisplayCode($pageType="listView",$photoId,$photoDesc,$photoFileName,$photoFilePath){ // } //function getPhotoDisplayCode function funShowRecordFileLink($fileLink,$parentTable,$parentRecordType,$EditID){ global $GVAR; $sql = "Select id,FileName,fileType from Files WHERE parentRecordId='".cleanSQL($EditID)."' AND parentTable='".cleanSQL($parentTable)."' AND (Deleted is null OR Deleted=0) ORDER BY DisplayOrder,CreateDate"; $imageExtList = $GVAR["imageExtList"]; //echo "
$sql
"; $rs = mysql_query($sql) or die (basename(__FILE__).':'.__LINE__.':'.mysql_error()); $recordCount = mysql_num_rows($rs); // Commented out... only one file per item. //$fileList .= $fileLink; if ($recordCount>=1){ while($row = mysql_fetch_array($rs)) { $FileName = $row["FileName"]; $fileType = $row["fileType"]; $id = $row["id"]; $deleteLink = "DELETE"; $imgThumbURL = $GVAR["ImagePreviewPath"].$FileName."&size=thumb"; $imgBigURL = $GVAR["ImagePreviewPath"].$FileName."&size=large"; $previewText = "PREVIEW"; if ($FileName!=""){ if (in_array($fileType,$imageExtList)){ $previewLink = "

$deleteLink
"; }else{ $previewLink = "
$previewText $FileName
$deleteLink
"; } //$previewLink = "
LOGO:(click to preview)

$deleteLink
"; $fileList .= $previewLink; } //if ($FileName!="") } //while($row = mysql_fetch_array($rs)) }else{ //if ($recordCount>=1) $fileList .= $fileLink; } return $fileList; } //function funShowRecordFileLink($fileLink,$parentTable,$parentRecordType,$EditID){ function getNextAnswerDisplayOrder($qid){ if($qid&&!$qaid)$idClause = " qid = '".cleanSQL($qid)."' AND (qid is null or qid = 0) "; $sql = "Select DisplayOrder as nextDisplayOrder from QAnswer WHERE $idClause Order By DisplayOrder desc limit 1"; $rs = mysql_query($sql) or trigger_error("SQL: ".mysql_error()." - ($sql)", E_USER_ERROR); while($row = mysql_fetch_array($rs)) { $nextDisplayOrder = $row["nextDisplayOrder"]; } if($nextDisplayOrder)$nextDisplayOrder = $nextDisplayOrder + 10; if(!$nextDisplayOrder)$nextDisplayOrder = 10; return $nextDisplayOrder; } //function getNextPropDisplayOrder function getNextDisplayOrder($parentTable,$parentRecordType,$ParentID){ global $GVAR; $sql = "Select DisplayOrder from Files WHERE parentRecordId='".cleanSQL($ParentID)."' AND parentTable='".cleanSQL($parentTable)."' AND (Deleted is null OR Deleted=0) ORDER BY DisplayOrder DESC LIMIT 1 "; //echo "
$sql
"; $rs = mysql_query($sql) or die (basename(__FILE__).':'.__LINE__.':'.mysql_error()); $row = mysql_fetch_array($rs); $DisplayOrder = $row["DisplayOrder"]; if ($DisplayOrder!=""&&$DisplayOrder!=0)$DisplayOrder += 10; if ($DisplayOrder==""||$DisplayOrder==0)$DisplayOrder = 10; return $DisplayOrder; } //function getNextDisplayOrder($parentTable,$parentRecordType,$EditID){ function logActivity($userId,$activityType,$activityDetail,$qid,$qaid){ if($qid==="")$qid=0; if($qaid==="")$qaid=0; if($userId){ $sql = "INSERT INTO logging SET userId = '".cleanSQL($userId)."', activityType = '".cleanSQL($activityType)."', activityDetail = '".cleanSQL($activityDetail)."', qid = '".cleanSQL($qid)."', qaid = '".cleanSQL($qaid)."', activityDate=SYSDATE()"; mysql_query($sql) or die (basename(__FILE__).':'.__LINE__.':'.mysql_error()); } } function isBlank($value) { return empty($value) && !is_numeric($value); } function firstOfMonth() { return date("m/d/Y", strtotime(date('m').'/01/'.date('Y').' 00:00:00')); } function lastOfMonth() { return date("m/d/Y", strtotime('-1 second',strtotime('+1 month',strtotime(date('m').'/01/'.date('Y').' 00:00:00')))); } function firstOfNextMonth() { return date("m/d/Y", strtotime('+1 month',strtotime(date('m').'/01/'.date('Y').' 00:00:00'))); } function sendPassword($username,$usertype){ global $GVAR; $passFound =False; if ($username&&$usertype){ $confMsg = "
No user was found with this e-mail address and User Type combination.
Please check the address and try again.
"; if ($usertype=="Administrator"){ $tableName="Users"; $sql = "Select FirstName,LastName,Password,RecordType,id from $tableName WHERE Active=1 AND RecordType='USER' AND Email = '".cleanSQL($username)."'"; }else{ $tableName="Customers"; $sql = "Select FirstName,LastName,Password,RecordType,id from $tableName WHERE Active=1 AND Email = '".cleanSQL($username)."' AND RecordType = '".cleanSQL($usertype)."'"; } $rs = mysql_query($sql) or die (basename(__FILE__).':'.__LINE__.':'.mysql_error()); while($row = mysql_fetch_array($rs)) { $Password = stripslashes($row["Password"]); $parentRecordID = stripslashes($row["id"]); $RecordType = stripslashes($row["RecordType"]); $FirstName = stripslashes($row["FirstName"]); $LastName = stripslashes($row["LastName"]); } if ($Password){ $passFound=true; $confMsg = "
Your Username & Password have been e-mailed to: $username
"; //$notifyWhom = "bradley.mohr@smarter.net"; $emailFrom = $GVAR["CUSTSVC_NOTIFICATION_EMAIL"]; $emailFromName = $GVAR["REPLY_NAME"]; $notifyWhom = $username; $emailServer = $GVAR["EMAIL_SERVER"]; $grandParentType="--Password Request--"; $emailSubject = "Notification - Lost Password Request"; $emailBody = "Dear $FirstName $LastName,

We've processed your lost password request. Please find your password below:

Password: $Password

"; $parentTable=$tableName; $parentRecordType=$RecordType; $emailId = funRecordEmail($emailFrom,$emailFromName,$notifyWhom,$emailCC,$emailBCC,$emailSubject,$emailBody,$emailServer,$emailAttachmentIdList,$parentRecordID,$parentTable,$parentRecordType,$grandParentId,$grandParentType,$orderId=0); $emailResult = funSendDBEmail($emailId); } //if ($Password){ } //if ($username&&$usertype){ return array($passFound,$confMsg); } //function sendPassword function getDateDiff($start, $end) { $start_ts = strtotime($start); $end_ts = strtotime($end); $diff = $end_ts - $start_ts; return round($diff / 86400); } function killCookies(){ session_destroy(); //list of cookies that we do NOT want to kill: $goodCookies = array("erECPId","erLabId","erPmId","remUid","usrguid"); if (isset($_SERVER["HTTP_COOKIE"])) { $cookies = explode(";", $_SERVER["HTTP_COOKIE"]); foreach($cookies as $cookie) { $parts = explode("=", $cookie); $name = trim($parts[0]); //if (!in_array($name,$goodCookies)){ setcookie($name, "", time()-1000); setcookie($name, "", time()-1000, "/"); //} } } } //function killLogin(){ function killLogin(){ session_destroy(); //list of cookies that we do NOT want to kill: $goodCookies = array("erECPId","erLabId","erPmId","remUid","usrguid"); if (isset($_SERVER["HTTP_COOKIE"])) { $cookies = explode(";", $_SERVER["HTTP_COOKIE"]); foreach($cookies as $cookie) { $parts = explode("=", $cookie); $name = trim($parts[0]); if (!in_array($name,$goodCookies)){ setcookie($name, "", time()-1000); setcookie($name, "", time()-1000, "/"); } } } } //function killLogin(){ function printSession(){ echo "
";
	print_r($_SESSION);
	echo "

"; } ////////////////LOGIN STUFF ////////////////////// // page session stuff: if (!isset($_SESSION))session_start(); $action = $_GET["action"]; $customerId = trim($_SESSION["actUserId"]); $actUserId = trim($_SESSION["actUserId"]); $custId = $customerId; if ($customerId=="")$customerId=0; $userType = trim($_SESSION["actUserType"]); $actUserEmail = trim($_SESSION["actUserEmail"]); $actUserCompany = trim($_SESSION["actUserCompany"]); $actUserName = trim($_SESSION["actUserName"]); if($action=="logout")funDoStoreLogout(); if($action=="alogout")funDoLogout(); if ($customerId>0&&$userType!=""){ $custLoggedIn=true; }else{ $remUid = $_COOKIE["remUid"]; $usrguid = $_COOKIE["usrguid"]; if ($remUid&&$usrguid)funDoStoreLogin(); } $custId=$customerId; if ($customerId){ $custLoggedIn=true; }