????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.36 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.supervision-online.se/ |
Upload File : |
<?php
$source_encoding = "ISO-8859-1";
$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("supervision");
$sql = "SELECT * FROM tblPositionsTemp where id = 7499";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$xmlstr = $row['xmlData'];
}
$xml = simplexml_load_string($xmlstr);
$LastUpdateDate = $xml->Info->attributes()->LastUpdateDate;
$UserId = $xml->Info->attributes()->UserId;
$CompanyId = $xml->Info->attributes()->CompanyId;
$UpdateDate = gmdate("Y-m-d H:i:s");
foreach($xml->Positions->Position as $position){
$Title = iconv( "UTF-8", "ISO-8859-1",$position->attributes()->Title);
$Id = $position->attributes()->Id;
$TempPositionId = $position->attributes()->TempId;
$PositionId = $position->attributes()->PositionId;
$IsNew = $position->attributes()->IsNew;
$Status = $position->attributes()->Status;
$SymbolSetId = $position->attributes()->SymbolSetId;
$Lat = $position->attributes()->Lat;
$Long = $position->attributes()->Long;
$Comment = $position->attributes()->Comments;
$ImagePath = $position->attributes()->ImagePath;
$exist = false;
if($IsNew == "Yes"){
$sql = "SELECT * FROM tblPositions where pos_lat = '".$Lat."' and pos_long = '".$Long."' and symbolSetId = ".$SymbolSetId;
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$exist = true;
}
if($exist == false){
$sql = "INSERT into tblPositions Values(NULL , '$PositionId', '$TempPositionId', '$Title', '$Lat', '$Long', '', '$Comment', '$ImagePath', '', '', '$Status', '$SymbolSetId', '$UpdateDate', '$UserId');";
mysql_query($sql);
$Id = mysql_insert_id();
}
}else{
$sql = "UPDATE tblPositions SET label = '$Title', status = $Status, comment = '$Comment', updatedate = '$UpdateDate' where id = $Id";
mysql_query($sql);
}
if($exist == false){
// Add Answers to tblAnswers
foreach($position->Answers->Answer as $answer){
$QuestionId = $answer->attributes()->QuestionId;
$Comment = iconv( "UTF-8", "ISO-8859-1",$answer->attributes()->Comment);
$Answer = $answer->attributes()->Answer;
$SubAnswerId = $answer->attributes()->SubAnswerId;
$SubAnswer = iconv( "UTF-8", "ISO-8859-1", $answer->attributes()->SubAnswer);
$ImagePath = $answer->attributes()->ImagePath;
$VideoPath = $answer->attributes()->VideoPath;
$SoundPath = $answer->attributes()->SoundPath;
$AdditionalComments = $answer->attributes()->AdditionalComments;
$sql = "Select * from tblAnswers where PositionId = $Id and questionId = $QuestionId";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) { // Answer exists, UPDATE!
$row = mysql_fetch_assoc($result);
$sql = "UPDATE tblAnswers SET labelYesNo = '$Answer', AdditionalComments = '$AdditionalComments', comment = '$Comment', subAnswer = '$SubAnswer', subAnswerId = $SubAnswerId, imagePath = '$ImagePath', videoPath = '$VideoPath', soundPath = '$SoundPath', updatedate = '$UpdateDate' WHERE answerId = ".$row['answerId'];
mysql_query($sql);
$answerId = $row['answerId'];
}else{// Answer dont exists, ADD NEW!
$sql = "INSERT INTO tblAnswers VALUES(NULL, $Id,$QuestionId,'$Answer','$AdditionalComments','$Comment','$SubAnswer','$SubAnswerId','$ImagePath','$VideoPath','$SoundPath','$UpdateDate')";
mysql_query($sql);
$answerId = mysql_insert_id();
}
// Add to history shall always be done!
if($AdditionalComments != ""){
$Answer = $AdditionalComments;
}
if($Answer == "1"){
$Answer = "JA";
}
if($Answer == "2"){
$Answer = "NEJ";
}
if($SubAnswer != ""){
$Answer = $SubAnswer;
}
$date_value = date("Y-m-d H:i:s");
if($Answer != "4"){
mysql_query("INSERT INTO tblHistory VALUES(NULL,$answerId,$QuestionId,'$Answer','$date_value')");
}
}
}
}
$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("supervision");
$x=1;
$nbr_pos = 0;
$sql = "SELECT * FROM tblSymbolSets where companyid = ".$CompanyId;
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$sql = "SELECT count(*) as pos FROM tblPositions where updatedate > '$LastUpdateDate' and symbolSetId = ".$row['symbolSetId'];
$result1 = mysql_query($sql);
while ($row1 = mysql_fetch_assoc($result1)){
$nbr_pos += $row1['pos'];
}
}
$temp = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">';
$temp .= '<dict>';
$sql = "SELECT * FROM tblSymbolSets where companyid = ".$CompanyId;
$result1 = mysql_query($sql);
$SymbolSetX = 0;
while ($row1 = mysql_fetch_assoc($result1)){
$symbolSetId = $row1['symbolSetId'];
$SymbolSetX++;
$temp .= ' <key>SymbolSet'.$SymbolSetX.'</key>';
$temp .= ' <dict>';
$temp .= ' <key>IdentifyData</key>';
$temp .= ' <dict>';
$temp .= ' <key>Name</key>';
$temp .= ' <string>'.$row1['name'];
$temp .= '</string>';
$temp .= ' <key>LastUpdateDate</key>';
$temp .= ' <string>'.gmdate("Y-m-d H:i:s");
$temp .= '</string>';
$temp .= ' <key>SymbolSetId</key>';
$temp .= ' <integer>'.$row1['symbolSetId'];
$temp .= '</integer>';
$temp .= ' <key>Status1</key>';
$temp .= ' <dict>';
$temp .= ' <key>Image</key>';
$temp .= ' <string>'.$row1['status1'];
$temp .= '</string>';
$temp .= ' <key>ImageURL</key>';
$temp .= ' <string>'.$row1['status1url'];
$temp .= '</string>';
$temp .= ' </dict>';
$temp .= ' <key>Status2</key>';
$temp .= ' <dict>';
$temp .= ' <key>Image</key>';
$temp .= ' <string>'.$row1['status2'];
$temp .= '</string>';
$temp .= ' <key>ImageURL</key>';
$temp .= ' <string>'.$row1['status2url'];
$temp .= '</string>';
$temp .= ' </dict>';
$temp .= ' <key>Status3</key>';
$temp .= ' <dict>';
$temp .= ' <key>Image</key>';
$temp .= ' <string>'.$row1['status3'];
$temp .= '</string>';
$temp .= ' <key>ImageURL</key>';
$temp .= ' <string>'.$row1['status3url'];
$temp .= '</string>';
$temp .= ' </dict>';
$temp .= ' <key>Status4</key>';
$temp .= ' <dict>';
$temp .= ' <key>Image</key>';
$temp .= ' <string>'.$row1['status4'];
$temp .= '</string>';
$temp .= ' <key>ImageURL</key>';
$temp .= ' <string>'.$row1['status4url'];
$temp .= '</string>';
$temp .= ' </dict>';
$temp .= ' </dict>';
$temp .= ' <key>Questions</key>';
$temp .= ' <dict>';
$sql = "SELECT * FROM tblQuestions where tblQuestions.symbolSetId = ".$symbolSetId." order by questionId";
$result2 = mysql_query($sql);
$QuestionX = 0;
while ($row2 = mysql_fetch_assoc($result2)){
$QuestionX++;
$temp .= ' <key>Question'.$QuestionX.'</key>';
$temp .= ' <dict>';
$temp .= ' <key>QuestionId</key>';
$temp .= ' <integer>'.$row2['questionId'];
$temp .= '</integer>';
$temp .= ' <key>Text</key>';
$temp .= ' <string>'.$row2['question'];
$temp .= '</string>';
$temp .= ' <key>Info</key>';
$temp .= ' <string>'.$row2['info'];
$temp .= '</string>';
$temp .= ' <key>LabelYes</key>';
$temp .= ' <string>'.$row2['labelYes'];
$temp .= '</string>';
$temp .= ' <key>LabelNo</key>';
$temp .= ' <string>'.$row2['labelNo'];
$temp .= '</string>';
$temp .= ' <key>LabelYesGreen</key>';
$temp .= ' <string>'.$row2['labelYesGreen'];
$temp .= '</string>';
$temp .= ' <key>Forced</key>';
$temp .= ' <integer>'.$row2['forced'];
$temp .= '</integer>';
$temp .= ' <key>SubQuestions</key>';
$temp .= ' <dict>';
$sql = "SELECT * FROM tblSubQuestions where questionId = ".$row2['questionId'];
$result4 = mysql_query($sql);
$SubQuestionX = 0;
while ($row4 = mysql_fetch_assoc($result4)){
$SubQuestionX++;
$temp .= ' <key>SubQuestion'.$SubQuestionX.'</key>';
$temp .= ' <dict>';
$temp .= ' <key>SubQuestion</key>';
$temp .= ' <string>'.$row4['question'];
$temp .= '</string>';
$temp .= ' <key>SubQuestionId</key>';
$temp .= ' <integer>'.$row4['subExternalId'];
$temp .= '</integer>';
$temp .= ' </dict>';
$SubQuestionX++;
}
$temp .= ' </dict>';
$temp .= ' </dict>';
}
$temp .= ' </dict>';
}
$bytes = 7200 * $nbr_pos + strlen($temp);
header("Content-type: application/octet-stream");
header('Content-Disposition: attachment; filename="SymbolSets_'.$bytes.'.plist"');
echo(iconv($source_encoding,"UTF-8",'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">'));
echo(iconv($source_encoding,"UTF-8",'<dict>'));
$sql = "SELECT * FROM tblSymbolSets where companyid = ".$CompanyId;
$result1 = mysql_query($sql);
$SymbolSetX = 0;
while ($row1 = mysql_fetch_assoc($result1)){
$symbolSetId = $row1['symbolSetId'];
$SymbolSetX++;
echo(iconv($source_encoding,"UTF-8",' <key>SymbolSet'.$SymbolSetX.'</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>IdentifyData</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Name</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['name']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>LastUpdateDate</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.gmdate("Y-m-d H:i:s")));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>SymbolSetId</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$row1['symbolSetId']));
echo(iconv($source_encoding,"UTF-8",'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>Status1</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Image</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['status1']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>ImageURL</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['status1url']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Status2</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Image</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['status2']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>ImageURL</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['status2url']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Status3</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Image</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['status3']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>ImageURL</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['status3url']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Status4</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Image</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['status4']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>ImageURL</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row1['status4url']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Questions</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
$sql = "SELECT * FROM tblQuestions where tblQuestions.symbolSetId = ".$symbolSetId." order by questionId";
$result2 = mysql_query($sql);
$QuestionX = 0;
while ($row2 = mysql_fetch_assoc($result2)){
$QuestionX++;
echo(iconv($source_encoding,"UTF-8",' <key>Question'.$QuestionX.'</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>QuestionId</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$row2['questionId']));
echo(iconv($source_encoding,"UTF-8",'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>Text</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row2['question']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>Info</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row2['info']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>IsLabelYesNoRequired</key>'));
if($row2['labelYes'] == "TEXT"){
echo(iconv($source_encoding,"UTF-8",' <false/>'));
}else{
echo(iconv($source_encoding,"UTF-8",' <true/>'));
}
if($row2['labelYes'] == "TEXT"){
$min = $row2['minValue'];
$max = $row2['maxValue'];
echo(iconv($source_encoding,"UTF-8",' <key>TextMinValue</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$min));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>TextMaxValue</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$max));
echo(iconv($source_encoding,"UTF-8",'</string>'));
}
echo(iconv($source_encoding,"UTF-8",' <key>LabelYes</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row2['labelYes']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>LabelNo</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row2['labelNo']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>LabelYesGreen</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row2['labelYesGreen']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>Forced</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$row2['forced']));
echo(iconv($source_encoding,"UTF-8",'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>SubQuestions</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
$sql = "SELECT * FROM tblSubQuestions where questionId = ".$row2['questionId'];
$result4 = mysql_query($sql);
$SubQuestionX = 0;
while ($row4 = mysql_fetch_assoc($result4)){
$SubQuestionX++;
$subExternalId = $row4['subExternalId'];
if($subExternalId == ""){
$subExternalId = "0";
}
echo(iconv($source_encoding,"UTF-8",' <key>SubQuestion'.$SubQuestionX.'</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>SubQuestion</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row4['question']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>SubQuestionId</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$subExternalId));
echo(iconv($source_encoding,"UTF-8",'</integer>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
}
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>History</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
$sql = "SELECT * FROM tblHistory where questionId = ".$row2['questionId'];
$result4 = mysql_query($sql);
$HistoryX = 0;
while ($row4 = mysql_fetch_assoc($result4)){
$HistoryX++;
echo(iconv($source_encoding,"UTF-8",' <key>History'.$HistoryX.'</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>History</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row4['history_value']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>HistoryDate</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row4['date_value']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
}
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
}
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Positions</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
$sql = "SELECT * FROM tblPositions where updatedate > '$LastUpdateDate' and symbolSetId = ".$symbolSetId;
$result3 = mysql_query($sql);
$PositionsX = 0;
while ($row3 = mysql_fetch_assoc($result3)){
$PositionsX++;
echo(iconv($source_encoding,"UTF-8",' <key>Position'.$PositionsX.'</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Id</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$row3['id'].'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>PositionId</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$row3['posid'].'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>TempPositionId</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$row3['tempposid'].'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>Label</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row3['label'].'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>Long</key>'));
echo(iconv($source_encoding,"UTF-8",' <real>'.$row3['pos_long'].'</real>'));
echo(iconv($source_encoding,"UTF-8",' <key>Lat</key>'));
echo(iconv($source_encoding,"UTF-8",' <real>'.$row3['pos_lat'].'</real>'));
echo(iconv($source_encoding,"UTF-8",' <key>Status</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$row3['status'].'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>Description</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row3['description'].'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>Comment</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row3['comment'].'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>ImagePath</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row3['photopath'].'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>Answers</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
$sql = "SELECT * FROM tblQuestions where tblQuestions.symbolSetId = ".$symbolSetId;
$result2 = mysql_query($sql);
$QuestionX = 0;
while ($row2 = mysql_fetch_assoc($result2)){
$QuestionX++;
$answerId = "0";
$labelYesNo = "";
$comment = "";
$subAnswer = "";
$imagePath = "";
$videoPath = "";
$soundPath = "";
$subAnswerId = "0";
$AdditionalComments = "";
//$sql = "SELECT * FROM tblAnswers where updatedate > '$LastUpdateDate' and questionId = ".$row2['questionId']." and PositionId = ".$row3['id'];
$sql = "SELECT * FROM tblAnswers where questionId = ".$row2['questionId']." and PositionId = ".$row3['id'];
$result5 = mysql_query($sql);
while ($row5 = mysql_fetch_assoc($result5)){
$labelYesNo = $row5['labelYesNo'];
$answerId = $row5['answerId'];
$comment = $row5['comment'];
$subAnswer = $row5['subAnswer'];
$subAnswerId = $row5['subAnswerId'];
$imagePath = $row5['imagePath'];
$videoPath = $row5['videoPath'];
$soundPath = $row5['soundPath'];
$AdditionalComments = $row5['AdditionalComments'];
}
if($subAnswerId == ""){
$subAnswerId = "0";
}
if($answerId == ""){
$answerId = "0";
}
$QuestionID = $row2['questionId'];
if($QuestionID == ""){
$QuestionID = "0";
}
echo(iconv($source_encoding,"UTF-8",' <key>Answer'.$QuestionX.'</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>AdditionalComments</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$AdditionalComments));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>QuestionId</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$QuestionID));
echo(iconv($source_encoding,"UTF-8",'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>Answer</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$labelYesNo));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>Comment</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$comment));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>SubAnswer</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$subAnswer));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>SubAnswerId</key>'));
echo(iconv($source_encoding,"UTF-8",' <integer>'.$subAnswerId));
echo(iconv($source_encoding,"UTF-8",'</integer>'));
echo(iconv($source_encoding,"UTF-8",' <key>ImagePath</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$imagePath));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>VideoPath</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$videoPath));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>SoundPath</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$soundPath));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>History</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
$sql = "SELECT * FROM tblHistory where answerId = ".$answerId;
$result6 = mysql_query($sql);
$HistoryX = 0;
while ($row6 = mysql_fetch_assoc($result6)){
$HistoryX++;
echo(iconv($source_encoding,"UTF-8",' <key>History'.$HistoryX.'</key>'));
echo(iconv($source_encoding,"UTF-8",' <dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>History</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row6['history_value']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>HistoryDate</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row6['date_value']));
echo(iconv($source_encoding,"UTF-8",'</string>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
}
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
}
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",' <key>Comment</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row3['comment'].'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>PhotoPath</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row3['photopath'].'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>VideoPath</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row3['videopath'].'</string>'));
echo(iconv($source_encoding,"UTF-8",' <key>SoundPath</key>'));
echo(iconv($source_encoding,"UTF-8",' <string>'.$row3['soundpath'].'</string>'));
echo(iconv($source_encoding,"UTF-8",' </dict>'));
}
echo(iconv($source_encoding,"UTF-8",' </dict>'));
echo(iconv($source_encoding,"UTF-8",'</dict>'));
}
echo(iconv($source_encoding,"UTF-8",'</dict>'));
echo(iconv($source_encoding,"UTF-8",'</plist>'));
?>