Error con PHP
Hola buenos dias:
Tengo un problema desde que hice la actualizacion del servidor PHP 5.0 a la version 5.1.6, el problema esta que ahora en mi aplicacion me aparece el codigo php en el navegador. Pero si quito el PHP.ini de windows la aplicacion se ejectuta sin problemas.
anexo codigo PHP:
(desde aqui empieza a mostrarme el codigo en el navegador ", $string); )
<?
// USED BY SHUFFLE ROUTINE
function getLastStr($hay, $need)
{
$getLastStr = 0;
$pos = strpos($hay, $need);
if (is_int ($pos))
{
while($pos)
{
$getLastStr = $getLastStr + $pos + strlen($need);
$hay = substr ($hay , $pos + strlen($need));
$pos = strpos($hay, $need);
}
return $getLastStr - strlen($need);
} else {
return -1;
}
}
// PERFORMS SHUFFLE OF QUESTION ORDER
function GrabQuestions($string)
{
$ary = explode("<!-- TP7Q //-->", $string);
// UNCOMMENT THE NEXT LINE TO ALLOW SHUFFLING OF QUESTION ORDER (AUTOMATED BY TEST PRO)
// $doShuffle = "TRUE";
if ($doShuffle == "TRUE")
{
shuffle($ary);
reset($ary);
}
$cnt = 1;
foreach($ary as $q)
{
if (strlen($q) > 10)
{
$q = str_replace("<!-- QN //-->", "$cnt. ", $q);
echo $q;
$cnt ++;
}
}
}
//
// PHP 4.2 or Later will need these
// Or, you can manually extract each individual variable
// for better security
@extract($_POST);
@extract($_GET);
//
// MAKE SURE STUDENT LOGGED IN
$student = 'Anonymous'; $login_name = $student;
if (strlen($login_name) == 0)
{
header("Location: login.php?errmsg=Login%20Required");
exit;
}
//
// HAS USER ALREADY TAKEN TEST?
$logfile = $login_name;
$logfile .= "_log";
$logfile = str_replace("/","_fs_", $logfile);
$logfile = str_replace("\\","_bs_", $logfile);
$logfile = str_replace("|","_pipe_", $logfile);
$logfile = str_replace("?","_qm_", $logfile);
$logfile = str_replace(":","_colon_", $logfile);
$logfile = str_replace("*","_ast_", $logfile);
$logfile = str_replace(">","_gt_", $logfile);
$logfile = str_replace("<","_lt_", $logfile);
$stfilename = $logfile;
// UNCOMMENT THE NEXT LINE TO ALLOW UNLIMITED TRIES (AUTOMATED BY TEST PRO)
// $allowUnlimitedTries = "TRUE";
if ($allowUnlimitedTries == "TRUE")
{
// DO NOTHING
} else
{
if (file_exists($stfilename))
{
header("Location:login.php?errmsg=Candidate%20Has%20Already%20Taken%20This%20Assessment.");
exit;
}
}
// RECORD STUDENT NAME TO FILE
$newfile = fopen($stfilename, "w") or die("Unable To Create Flag for Student");
fclose($newfile);
// ================================================================
?>
<HTML>
<HEAD>
<TITLE>TUTORÍA PREPA</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.tp_title
{
color : #000000;
text-align : center;
font-family : Arial;
font-size : large;
font-variant : normal;
font-weight : bolder;
padding-bottom : 3px;
padding-left : 3px;
padding-right : 3px;
padding-top : 3px;
}
.tp_body
{
color : #000000;
background-color : #FFFFFF;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 11pt;
background-image:url("http://www.atrixware.com/testpro8/webtestcgi/i-test.jpg");
background-repeat:no-repeat;
}
.tp_header
{
font-size : small;
}
.tp_qprefix_number
{
background-color : #DFDFDF;
text-decoration : none;
font-family : Arial;
font-size : smaller;
font-weight : bold;
border-width : 1px;
border-style : solid;
border-color : #BFBFBF;
margin-right : 6px;
padding-bottom : 5px;
padding-left : 4px;
padding-top : 5px;
}
.tp_qprefix_category
{
font-size : xx-small;
font-style : italic;
}
.tp_qprefix_scoreweight
{
font-size : xx-small;
font-style : italic;
}
.tp_qprefix_qid
{
font-size : xx-small;
...
Tengo un problema desde que hice la actualizacion del servidor PHP 5.0 a la version 5.1.6, el problema esta que ahora en mi aplicacion me aparece el codigo php en el navegador. Pero si quito el PHP.ini de windows la aplicacion se ejectuta sin problemas.
anexo codigo PHP:
(desde aqui empieza a mostrarme el codigo en el navegador ", $string); )
<?
// USED BY SHUFFLE ROUTINE
function getLastStr($hay, $need)
{
$getLastStr = 0;
$pos = strpos($hay, $need);
if (is_int ($pos))
{
while($pos)
{
$getLastStr = $getLastStr + $pos + strlen($need);
$hay = substr ($hay , $pos + strlen($need));
$pos = strpos($hay, $need);
}
return $getLastStr - strlen($need);
} else {
return -1;
}
}
// PERFORMS SHUFFLE OF QUESTION ORDER
function GrabQuestions($string)
{
$ary = explode("<!-- TP7Q //-->", $string);
// UNCOMMENT THE NEXT LINE TO ALLOW SHUFFLING OF QUESTION ORDER (AUTOMATED BY TEST PRO)
// $doShuffle = "TRUE";
if ($doShuffle == "TRUE")
{
shuffle($ary);
reset($ary);
}
$cnt = 1;
foreach($ary as $q)
{
if (strlen($q) > 10)
{
$q = str_replace("<!-- QN //-->", "$cnt. ", $q);
echo $q;
$cnt ++;
}
}
}
//
// PHP 4.2 or Later will need these
// Or, you can manually extract each individual variable
// for better security
@extract($_POST);
@extract($_GET);
//
// MAKE SURE STUDENT LOGGED IN
$student = 'Anonymous'; $login_name = $student;
if (strlen($login_name) == 0)
{
header("Location: login.php?errmsg=Login%20Required");
exit;
}
//
// HAS USER ALREADY TAKEN TEST?
$logfile = $login_name;
$logfile .= "_log";
$logfile = str_replace("/","_fs_", $logfile);
$logfile = str_replace("\\","_bs_", $logfile);
$logfile = str_replace("|","_pipe_", $logfile);
$logfile = str_replace("?","_qm_", $logfile);
$logfile = str_replace(":","_colon_", $logfile);
$logfile = str_replace("*","_ast_", $logfile);
$logfile = str_replace(">","_gt_", $logfile);
$logfile = str_replace("<","_lt_", $logfile);
$stfilename = $logfile;
// UNCOMMENT THE NEXT LINE TO ALLOW UNLIMITED TRIES (AUTOMATED BY TEST PRO)
// $allowUnlimitedTries = "TRUE";
if ($allowUnlimitedTries == "TRUE")
{
// DO NOTHING
} else
{
if (file_exists($stfilename))
{
header("Location:login.php?errmsg=Candidate%20Has%20Already%20Taken%20This%20Assessment.");
exit;
}
}
// RECORD STUDENT NAME TO FILE
$newfile = fopen($stfilename, "w") or die("Unable To Create Flag for Student");
fclose($newfile);
// ================================================================
?>
<HTML>
<HEAD>
<TITLE>TUTORÍA PREPA</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.tp_title
{
color : #000000;
text-align : center;
font-family : Arial;
font-size : large;
font-variant : normal;
font-weight : bolder;
padding-bottom : 3px;
padding-left : 3px;
padding-right : 3px;
padding-top : 3px;
}
.tp_body
{
color : #000000;
background-color : #FFFFFF;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 11pt;
background-image:url("http://www.atrixware.com/testpro8/webtestcgi/i-test.jpg");
background-repeat:no-repeat;
}
.tp_header
{
font-size : small;
}
.tp_qprefix_number
{
background-color : #DFDFDF;
text-decoration : none;
font-family : Arial;
font-size : smaller;
font-weight : bold;
border-width : 1px;
border-style : solid;
border-color : #BFBFBF;
margin-right : 6px;
padding-bottom : 5px;
padding-left : 4px;
padding-top : 5px;
}
.tp_qprefix_category
{
font-size : xx-small;
font-style : italic;
}
.tp_qprefix_scoreweight
{
font-size : xx-small;
font-style : italic;
}
.tp_qprefix_qid
{
font-size : xx-small;
...
1 Respuesta
Respuesta de Jorge Vila
1