Ошибка XLSB To CSV через переполнение стека

У меня возникли проблемы с поиском проблемы с PHP-скриптом, который должен конвертировать файл XLSB в CSV. По какой-то причине он выдает эту ошибку разбора. Я пытался посмотреть на код, но я не понимаю, что я сделал не так.

Я столкнулся со следующей ошибкой:

Parse error: syntax error, unexpected end of file in /storage/ssd3/577/2617577/public_html/XLSB2CSV/XLSB2CSV/index.php on line 163

Я разместил index.php и поделился файлами через сайт ge.tt, который http://ge.tt/7k7vZDm2

Индекс

<?php$result=0;
if (isset($_POST["convert"])) {
$filetoname = basename($_FILES['xlsbfile']['name']);
if($filetoname==""){$alert = "Select a file";}else{
$ext = substr($filetoname,-4);
if($ext!="xlsb"){$alert = "Invalid file type. Select an .xlsb file.";}else{
$throttle=0;
//$throttle=preg_replace("/[^0-9]/","",$throttle);
$result = @move_uploaded_file($_FILES['xlsbfile']['tmp_name'], $filetoname); // upload it
$file=$filetoname;
$throttle=0;

//Code for reading xlsb file
$workbook = new COM("EasyXLS.ExcelDocument");
$workbook->easy_LoadXLSBFile($file);

//Code for converting to CSV
$workbook->easy_WriteCSVFile("file.csv", $workbook->easy_getSheetAt(0)->getSheetName());if(isset($_GET[$workbook]){  $csvFile = $workbook;
$alert = "Your download will start in <span id='timer'>5</span>
seconds<br/>or click <a href=$csvFile>this link</a> to start download now:";
$redir= '<meta http-equiv="refresh" content="5;url=index.php?file='.$csvFile.'">'; };

echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>XLSB TO CSV Web application</title>
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE"/>
<meta http-equiv="PRAGMA" content="NO-CACHE"/>
<meta http-equiv="EXPIRES" content="0"/>
<meta content="NONE" name="ROBOTS"/>
<meta content="JavaScript" name="vs_defaultClientScript"/>
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"/>
<link href="style_new.css" type="text/css" rel="stylesheet"/>
<script language="javascript" src="_js/jsCommon.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
/*if(document.location.href.indexOf(\'https\')>-1){
document.location = document.location.href.replace(\'https\', \'http\');
}*/

function findPosX(obj){
var curleft = 0;
if (obj.offsetParent){
while (obj.offsetParent){
curleft += obj.offsetLeft;
obj = obj.offsetParent;
}
}else if (obj.x)
curleft += obj.x;
return curleft;
}

function findPosY(obj){
var curtop = 0;
if (obj.offsetParent){
while (obj.offsetParent){
curtop += obj.offsetTop;
obj = obj.offsetParent;
}
}else if (obj.y)
curtop += obj.y;
return curtop;
}

function showTooltip(objDiv, strMessage, e){
getID(\'divToolti\').style.display = \'block\';
getID(\'divTooltip\').innerHTML = strMessage;

objDiv.onmousemove = function(e){
if(typeof e==\'undefined\')
e = window.event;

getID(\'divTooltip\').style.left = e.clientX - (getID(\'divTooltip\').offsetWidth / 2);
getID(\'divTooltip\').style.top = e.clientY + 20 + document.body.scrollTop;
}
}

function hideTooltip(objDiv){
getID(\'divTooltip\').style.display = \'none\';
getID(\'divTooltip\').style.left = -200;
getID(\'divTooltip\').style.top = -50;
objDiv.onmousemove = null;
}
</script>
</head>
<body>
<div class="clsPanelText" id="divTooltip" style="border-right:#666 1px solid;padding-right:4px;border-top:#666 1px solid;display:none;padding-left:4px;padding-bottom:4px;border-left:#666 1px solid;padding-top:4px;border-bottom:#666 1px solid;position:absolute;background-color:#fff"></div>
<form name="Form1" method="post" action="index.php" id="Form1" enctype="multipart/form-data">
<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr valign="middle">
<td align="center">
<div id="pnlDemoFirstStep" style="text-align:center;">

<table class="clsPanelText" cellspacing="0" cellpadding="0" width="900" align="center" style="position:relative;top:10px" border="0">
<tr>
<td>
<div class="clsH3" align="middle">
XLSB TO CSV Converter Web Application
</div><br/><br/>
<br/>
<span class="clsH3">Step One:</span>
Please select the Excel file you saved on your local hard
drive with your data and convert it back into downloadbale CSV into this website.<br/>
</td>
</tr>
<tr>
<td style="padding-left:140px"><br/>
<img style="vertical-align:middle" src="step1.jpg" alt="Step 3"/>
<b>Upload the Excel file</b><br/><br />
<table class="clsPanelText" cellspacing="0" cellpadding="10" width="620" border="0" style="border:solid 1px #DDD;background-color:#eaf0f0">
<tr>
<td valign="bottom">
Upload the XLSB template:<br/>
<input type="hidden" name="convert">
<input name="xlsbfile" type="file" id="txtUploadTemplate" class="clsInputText6" oncontextmenu="this.blur();" onkeydown="this.blur();" style="width:390px;height:24px" size="61" />
<input type="submit" name="btnUploadXLS" value="Upload XLSB template" id="btnUploadXLS" class="clsButton1" onmouseover="this.style.backgroundColor=\'#80B3C4\'" onmouseout="this.style.backgroundColor=\'#22769D\'" style="width:170px;" />
</td>
</tr>
</table>
</td>
</tr>
</table>

<br/>

<table class="clsPanelText" cellspacing="0" cellpadding="0" width="900" align="center" style="position:relative;top:10px" border="0">
<tbody>
<tr>
<td style="padding-left:140px"><br>
<img style=" vertical-align:middle" src="step2.jpg" alt="Step 2">
<b>Generate custom CSV file</b><br><br>
<table class="clsPanelText" cellspacing="0" cellpadding="10" width="620" border="0" style="border:solid 1px #DDD;background-color:#eaf0f0">
<tbody><tr>
<td>
$alert;
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>

</tr>
</tbody></table>
</div>
</td>
</tr>
</table>
</form>
<script language="javascript" type="text/javascript">
window.history.forward();
</script>
<script language="javascript" src="_js/jsAnalytics.js" type="text/javascript"></script>
</body>
</html>
';
?>

-1

Решение

Вам не хватает закрывающей скобки здесь

 if(isset($_GET[$workbook])) //<--- this one
1

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]