lJesterl Posted March 27, 2007 Share Posted March 27, 2007 ill try to explain the best I can. I am working on some scripts for a gaming ladder and im using cookies and sessions. Im using the following code to display messages when an action is complete i.e for deleting comments if($result){ include("finishmessage.php"); display_message("Comment(s) have been deleted<META HTTP-EQUIV='refresh' content='2;URL=playermanager.php'>","playermanager.php"); } } all is well it goes to the page, redirects, everything. Here is the problem. When it goes to the page it does not recognize the session becuase on the menu i use if session id = 0 login, validate else player manager, team manager when it goes to finishmessage.php it does not recognize the session id at all even if i list $session[id] in the finishmessage.php here is the code for finishmessage.php <? function display_message($finishmessage,$returnpage){ if($returnpage){ $returnto="$returnpage"; }else{ $returnto="main"; } include("config/dlconfig.php"); include("include/session.php"); $poplayerid=$HTTP_COOKIE_VARS["pid"]; $poplayerpw=$HTTP_COOKIE_VARS["ppw"]; $out[body]=$out[body]." <center> <br> <br>$finishmessage<br> <br> <br> $session[id] </center>"; include "themes/$theme/$themefile"; exit; } ?> Please help i dont know how else to show a message Link to comment https://forums.phpfreaks.com/topic/44446-please-help-with-function-problem/ Share on other sites More sharing options...
kenrbnsn Posted March 27, 2007 Share Posted March 27, 2007 Do you have "session_start()" as the first executable statement in each script? Also you should use $_COOKIE instead of $HTTP_COOKIE_VARS. Ken Link to comment https://forums.phpfreaks.com/topic/44446-please-help-with-function-problem/#findComment-215859 Share on other sites More sharing options...
lJesterl Posted March 27, 2007 Author Share Posted March 27, 2007 yea session start is in session.php Link to comment https://forums.phpfreaks.com/topic/44446-please-help-with-function-problem/#findComment-215869 Share on other sites More sharing options...
desithugg Posted March 27, 2007 Share Posted March 27, 2007 umm try including your session file at the way top and i think you need the single quotes when you use stuff in array format with letters like this echo $var[one]; //i think would be wrong echo $var['one']; //would be right $varshow = "one"; echo $var[$varshow]; //would be right //it's just a guess because my scripts didnt work till i added the single quotes so try changing $out[body]=$out[body]." <center> <br> <br>$finishmessage<br> <br> <br> $session[id] </center>"; to $out['body']=$out['body']." <center> <br> <br>$finishmessage<br> <br> <br> ".$session['id']." </center>"; and so on... Link to comment https://forums.phpfreaks.com/topic/44446-please-help-with-function-problem/#findComment-215990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.