Hi everyone.
I'm thiiis close to losing my wits over this. I'm working on carrying Session ID via the url (not secure, I know, but it's not meant to be) and I cannot for the life of me get this to work.
This is a hangman script (pre-written by someone else) that I need to carry the session id from the alphabet letters through the rest of the game and through both play again links. I think the trouble I'm having is the rest of my session ID links were neat ___.php links, rather than what these are, and I've tried every way I can think of to pass the SID without luck.
<?php
session_name ('YourVisitID');
ini_set('session.use_cookies', 0); // Don't use cookies.
session_start();
$Category = "Animals";
# list of words (phrases) to guess below, separated by new line
$list = "
Dog
Cat
Mouse
Lion
Bear";
# if the current alphabet NOT found in the selected letters
# at the link, add the currently selected letter
else
{ $links .= "\n<A HREF=\"$self?letters=$alpha[$c]$letters&n=$n\">$alpha[$c]</A> "; }
}
# update the number of wrong choices
# display a corresponding image
$nwrong=$wrong;
if ($nwrong>6) $nwrong=6;
echo "\n<p><BR>\n<IMG src=\"hangman_$nwrong.gif\" ALIGN=\"MIDDLE\" BORDER=0 WIDTH=100 HEIGHT=100 ALT=\"Wrong: $wrong out of $max\">\n";
# if reached the max wrong trials
if ($wrong >= $max)
{
$n++; # get the next word
if ($n>(count($words)-1)) $n=0; # if the last, back to the first
echo "<BR><BR><H1><font size=5>\n$word_line</font></H1>\n";
echo "<p><BR><FONT color=\"red\"><BIG>SORRY, YOU ARE HANGED!!!</BIG></FONT><BR><BR>";
if (strstr($word, " ")) $term="phrase"; else $term="word"; #check if phrase
echo "The $term was \"<B>$word</B>\"<BR><BR>\n";
echo "<A HREF=$self?n=$n".SID.">Play again.</A>\n\n";
}
# if not reached the max wrong trials
else
{
echo " # Wrong Guesses Left: <B>".($max-$wrong)."</B><BR>\n";
echo "<H1><font size=5>\n$word_line</font></H1>\n";
echo "<P><BR>Choose a letter:<BR><BR>\n";
echo "$links\n";
}
}
# if all the letters are matched ($done is true (1))
else
{
$n++; # get next word
if ($n>(count($words)-1)) $n=0; # if the last, back to the first
echo "<BR><BR><H1><font size=5>\n$word_line</font></H1>\n";
echo "<P><BR><BR><B>Congratulations!!! You win!!!</B><BR><BR><BR>\n";
echo "<A HREF=$self?n=$n".SID.">Play again</A>\n\n";
}
?>
Any help is very much appreciated!