•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 374,181 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,399 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 273 | Replies: 2
![]() |
•
•
Join Date: May 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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.
Any help is very much appreciated!
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!
Last edited by ellabean : May 9th, 2008 at 9:31 pm.
•
•
Join Date: Apr 2005
Location: New York state
Posts: 442
Reputation:
Rep Power: 5
Solved Threads: 65
ellabean, I think in PHP.ini there is a directive that tell's PHP whether appending sessions in the URL is allowed or not. It may have been added later, or the default changed in later PHP versions. I'm just recalling from reading the php session docs, so take a look, I might be wrong...
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- Shooting at Virginia Tech (Geeks' Lounge)
Other Threads in the PHP Forum
- Previous Thread: Search from multiple tables ??
- Next Thread: Load two web pages at the same time


Linear Mode