session_start(); issue

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   session_start(); issue
chusrubi2
CZ Newbie
 Codezwiz Site Donator
chusrubi2 has been a member for over 13 year's 13 Year Member
Status: Offline
Joined: Feb 02, 2011
0.00 posts per day
Posts: 13
Points: 545
   
Hello!

Im trying to add some captcha in registration page
   session_start();
      if ($_SESSION['tmptxt'] == $_POST['tmptxt']) {
         echo "Bienvenido ".$_POST['nombres'];
      } else {
         title(""._NEWUSERERROR."");
   OpenTable();
   echo "<center> Error: INVALID VERIFICATION CODE <br><br>"._GOBACK."</center>";
   CloseTable();
   include("footer.php");
   die();
    }

that has some session stuff.

The captcha works well but here it comes the problem: it f*cks up cookies.
After any user goes to registration page (index of your account module), and sees the captcha, he is not able to read anymore the comments of the newspost (or other activities) because when he clicks on "comments" the website is refreshed.

What can i do to use sessions in phpnuke?

Thx!

PD: all goes good again if u delete your cookies in your webbrowser!


Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
You will need to add the session_start in the mainfile.php before any other header output. Then you can safely use $_SESSION variable. Also make sure that when setting the $_SESSION variable you do it before any header output.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: session_start(); issue
chusrubi2
CZ Newbie
 Codezwiz Site Donator
chusrubi2 has been a member for over 13 year's 13 Year Member
Status: Offline
Joined: Feb 02, 2011
0.00 posts per day
Posts: 13
Points: 545
   
Thanks mate, last thing.
We are having randomly this "Invalid Session. Please resubmit the form." in forum. Ive searched that in google and i found some "solutions" and it was about cookie configuration in forum, but since i fixed it following those instructions, it still appearing to some users.

Could it be cause the other cookie problem that im having with session start?

pd: phpnuke 8.2 has been released for if u didnt know it icon_wink.gif



Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
It could be if your trying to set the session in the mainfile also. Look for that error in posting.php and see what they are checking.

Is this the new PHP Nuke version that was just released? I would bet it is full of bugs.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   
chusrubi2
CZ Newbie
 Codezwiz Site Donator
chusrubi2 has been a member for over 13 year's 13 Year Member
Status: Offline
Joined: Feb 02, 2011
0.00 posts per day
Posts: 13
Points: 545
   
No, its 8.1.

Ok, i fixed it but it didnt work with your method. What i did is replace every $_SESSION to $_COOKIE.



Back to top Reply with quote
#6   re: session_start(); issue
chusrubi2
CZ Newbie
 Codezwiz Site Donator
chusrubi2 has been a member for over 13 year's 13 Year Member
Status: Offline
Joined: Feb 02, 2011
0.00 posts per day
Posts: 13
Points: 545
   
Okay mate, im having mass issues with "Invalid Session. Please resubmit the form." in forum.

It started 1 month ago, i dont know why but now it only affects to some normal users.
How i tested it? i used teamviewer with a friend and i tried to post a reply in a forum thread. "Invalid Session. Please resubmit the form." with his acc. Then i logged off, logged in with mine (admin) and no problem.

I found in internet so many threads about this but any of them gave me the solution. Here it is my cookie configuration at forum:
Cookie domain http://rocarena.com/np
Cookie name phpbbrocarena
Cookie path /np/
Cookie secure Disabled
Session length [ seconds ] 3600


Any idea?



Back to top Reply with quote
#7   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Cookie Domain: .rocarena.com
Cookie Path: /

Try those settings.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#8   re: session_start(); issue
chusrubi2
CZ Newbie
 Codezwiz Site Donator
chusrubi2 has been a member for over 13 year's 13 Year Member
Status: Offline
Joined: Feb 02, 2011
0.00 posts per day
Posts: 13
Points: 545
   
Okay, it seems its working now but ill test it coz im not 100% sure, thanks (again).



Back to top Reply with quote
#9   re: session_start(); issue
chusrubi2
CZ Newbie
 Codezwiz Site Donator
chusrubi2 has been a member for over 13 year's 13 Year Member
Status: Offline
Joined: Feb 02, 2011
0.00 posts per day
Posts: 13
Points: 545
   
icon_sad.gif it doesnt work, it happens again...
btw my nuke is installed in /np/



Back to top Reply with quote
#10   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Try leaving the cookie path blank.

I don't think the session check is even needed since the sessions aren't even used.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum