Hi there!
I'm using Apache/1.3.14 (Win32) + PHP Version 4.3.2-RC1 locally.
I have a page that reads 2 files from 2 folders and stores them into arrays. Now, I want to pass that sessions to another page and display the arrays.
Here's the code from first page:
And here's the second page:
Locally, it works great, but on web hosting doesn't work at all. It displays both sessions as empty.
The strange thing is that <? phpinfo() ?> doesn't seem to work on that hosting, so I don't know what version is their PHP, so, if anyone have any ideea, it's my code wrong?
The PHP version from that hosting could be the problem?
![[morning] [morning] [morning]](/data/assets/smilies/morning.gif)
I'm using Apache/1.3.14 (Win32) + PHP Version 4.3.2-RC1 locally.
I have a page that reads 2 files from 2 folders and stores them into arrays. Now, I want to pass that sessions to another page and display the arrays.
Here's the code from first page:
Code:
<?
session_start();
$emailDir="./email/";
$messageDir="./message/";
$dire=opendir($emailDir);
$dirm=opendir($messageDir);
while (false !== ($fe = readdir($dire))){
if(is_file($emailDir.$fe)){
$fecontents = file($emailDir.$fe);
$i=0;
while (list($line_numE, $lineE) = each ($fecontents)) {
if(ereg("([_a-zA-Z0-9-]+)@([a-zA-Z0-9-]+)\.([a-zA-Z0-9-]{2,})",$lineE)){
$email[$i]=$lineE;
$i++;
}
}
unlink($emailDir.$fe);
}
}
while (false !== ($fm = readdir($dirm))){
if(is_file($messageDir.$fm)){
$fmcontents = file($messageDir.$fm);
$message=$fmcontents;
unlink($messageDir.$fm);
}
}
session_register("EMAIL");
session_register("MESSAGE");
$eml=array_unique($email);
$EMAIL=$eml;
$MESSAGE=$message;
?>
Code:
<?
session_start();
if((!session_is_registered("EMAIL"))or(!session_is_registered("MESSAGE"))){
header("Location: start.php");
exit;
}
$eml=$EMAIL;
$cntEml=count($eml);
$msg=$MESSAGE;
$cntMsg=count($msg);
echo "Email list:<br>";
for($i=0;$i<$cntEml;$i++){
echo $i." ".$eml[$i]."<br>";
}
echo "The message:<br>";
for($j=0;$j<$cntMsg;$j++){
echo $msg[$j];
}
?>
The strange thing is that <? phpinfo() ?> doesn't seem to work on that hosting, so I don't know what version is their PHP, so, if anyone have any ideea, it's my code wrong?
The PHP version from that hosting could be the problem?
![[morning] [morning] [morning]](/data/assets/smilies/morning.gif)