I seem to be digging a bigger and bigger hole for myself: I made a test file, and eliminated all but a few entries in the quotations array. I then tried to incorporate Traq's diagnostics suggestion, i.e.
Code:
if ( isset( $_SESSION['code'] ) ){
print $_SESSION['code'];
}
else {
print "$_SESSION['code'] not found";
}
and get parse error. I comment out that section and get numerous additional error messages.
Here is the test file (with diagnostics commented out), in its entirety:
Code:
<?php
$quotations = array(
"We, as criminal defense lawyers, are forced to deal with <a
href='http://en.wikipedia.org/wiki/Torture_memos' target='_blank'>some of the lowest people on
earth</a>. People who have no sense of right and wrong. People who will lie in court to get what
they want. People who do not care who gets hurt in the process. It is our job, our sworn duty as
criminal defense lawyers, to protect our clients from those people.",
"Cynthia Rosenberry",
"An advocate by the sacred duty which he owes his client knows, in the discharge of that office, but
one person in the world--that client and none other.",
"Henry Lord Brougham",
"It is wrong to expect a reward for your struggles. The reward is the act of struggle itself, not
what you win. Even though you can't expect to defeat the absurdity of the world, you must
make that attempt. That's morality. That's religion. That's art.
That's life.",
"Phil Ochs",
"For to him that is joined to all the living there is hope: for a living dog is better than a dead
lion.
<br />
<br />
For the living know that they shall die: but the dead know not anything, neither have they any more
a reward; for the memory of them is forgotten.
<br />
<br />
Also their love, and their hatred, and their envy, is not perished; neither have they any more a
portion for ever in any thing that is done under the sun.",
"Ecclesiastes 8:4-6",
);
/***********************************************************************
if ( isset( $_SESSION['code'] ) ){
print $_SESSION['code'];
}
else {
print "$_SESSION['code'] not found";
}
***********************************************************************/
if ( $_SESSION["code"] == "0"
|| $_SESSION["code"] == "1") {
$bigIndex = rand(0, (count($quotations) -1)) & 65534; // select entry, force even
$_SESSION["quoteIndex"] = $bigIndex;
}
else {
$bigIndex = $_SESSION["quoteIndex"];
}
echo "<br /><br /><div class='bigquote'> {$quotations [$bigIndex]} <br /><br /><div
align='right'>"; // display
$noSource = " "; // To test whether we need, or can skip, Part Two
if ($quotations [$bigIndex + 1] != $noSource) { // ...then we have an attribution to display for
Part Two,
echo $quotations [$bigIndex + 1] . "<br /><br />"; // so display it already
}
if ( $_SESSION["code"] == "0"
|| $_SESSION["code"] == "2") {
$universe = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n
o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 0"; // establish Part Three (partial) universe
$characters = explode(" ", $universe); // make array of it
shuffle ($characters); // go to Buffalo
$characters = array_slice($characters, 20, 3); // trim. The "20" is somewhat arbitrary
$decorations = array( // "Mommy, see all the pretty decorations."
"♠",
"<span style='color : #ff4040; '>♥</span>",
"<span style='color : #ff4040; '>♦</span>",
"∫",
"ω",
"π",
"∑",
"♣"
);
shuffle ($decorations); // to Buffalo, too, the decorations
$decorations = array_slice($decorations, 0, 3); // pare decorations
$decorations = array_merge($decorations, $characters); // meld tree onto decorations
shuffle ($decorations); // again to Buffalo we go, to complete Part Three
$_SESSION["decorations"] = $decorations;
}
else {
$decorations = $_SESSION["decorations"];
}
echo "Your Access Code is " . implode(" ", $decorations) . ".<br /><font size='-2'>Access code
broken? Click <a href='http://www.MarainLaw.com/test'>*** here ***</a> to replace it.</font><br
/><br /><br /></div></div>";?>
ALSO, to address the issue of whether the php.ini parameter was set correctly, I inserted session_start(); into the calling module, t0.pho. Here is the t0.php code:
Code:
<?php
session_start();
$_SESSION["code"] = "0";
header( 'Location: page.php?here=test' );
?>
The error messages now are much increased:
Notice: Undefined index: code in /var/www/html/pageContent/test.txt on line 46
Notice: Undefined index: code in /var/www/html/pageContent/test.txt on line 47
Notice: Undefined index: quoteIndex in /var/www/html/pageContent/test.txt on line 54
Notice: Undefined index: in /var/www/html/pageContent/test.txt on line 58
Cynthia Rosenberry
Notice: Undefined index: code in /var/www/html/pageContent/test.txt on line 67
Notice: Undefined index: code in /var/www/html/pageContent/test.txt on line 68
Notice: Undefined index: decorations in /var/www/html/pageContent/test.txt on line 101
Warning: implode() [function.implode]: Invalid arguments passed in /var/www/html/pageContent/test.txt on line 105
Your Access Code is .
Access code broken? Click *** here *** to replace it.
The test page is http://www.marainlaw.com/page.php?here=test .
Bookmarks