8 Replies - 308 Views - Last Post: 22 October 2012 - 07:59 PM Rate Topic: -----

#1 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Problems on my sessions

Posted 22 October 2012 - 05:26 AM

I am trying to make a agreement.php and donate.php page
where a player should agree first before he or she can go to the donate page
and if the player doesn't agree at all to our terms and condition he or she won't be able to donate
so i am trying to restrict the donate page that only users that agreed to our terms and condition are the only one who can enter to our donate page but after creating the pages it wont go to the donate.php even after clicking the i agree button..

code for my agreement.php
<?php
if(isset($_POST['sub'])){
$_SESSION['agree'] = 1;
header("Location:donate.php");
}
?>
<html>
<body>
<?php
echo "
<form action='agreement.php' method='post'>
Terms and Condition <br/><br/>
1. You will not attempt to recall your donation to rfprojectx.com:2224<br/>
2. You will not dispute the charges incurred to your paypal account from your voluntary donation to rfprojectx.com:2224<br/>
3. You understand that this is a voluntary donation and it is not refundable or disputable at any time or any reason and the money you sent for our server is not a payment or a purchase, it is a donation so we can put the server online 24 hours using that money you donated and as a exchange for donating such amount you'll get benefits as being a donator and having a unique items that the ordinary player dont have.<br/>
4. Any attempt to fraud donation system will lead to permanent removal of your account(s) from our network.<br/> 
5. Being a donator do not give you any privelege. You will be threat just like any other player. <br/>
6. If reward received in response to a donation or donation(s) was stolen/lost/misplaced/dropped in game, we will<br/> not be held responsible for its recovery.<br/>
<br/>

 - If you do not agree to these terms, do not send in a donation but if you agree to this terms and conditions<br/>
  you may press the I agree button.<br/>
<br/>
<input type='submit' name='sub' value='I Agree and I Accept the Terms and Condition'/>
</form>";
?>
</body>
</html>



code to where it goes
<?php
if($_SESSION['agree']!='1'){
	header("Location:agreement.php");
	}else{
 echo "welcome";
}
?>





forgot to mention
there's no login form to check the users session
all i need to check if the user clicks the i agree button so if he or she doesnt click it he or she wont be able to go to our donate page.

Is This A Good Question/Topic? 0
  • +

Replies To: Problems on my sessions

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3515
  • View blog
  • Posts: 10,140
  • Joined: 08-June 10

Re: Problems on my sessions

Posted 22 October 2012 - 05:43 AM

what does var_dump($_POST); yield?

there is no need for the echo statement. you print it anyways, whether the location was sent or not.
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3515
  • View blog
  • Posts: 10,140
  • Joined: 08-June 10

Re: Problems on my sessions

Posted 22 October 2012 - 05:50 AM

and while Iím at it, youíre not opening the session either.
Was This Post Helpful? 0
  • +
  • -

#4 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: Problems on my sessions

Posted 22 October 2012 - 06:04 AM

View PostDormilich, on 22 October 2012 - 05:50 AM, said:

and while Iím at it, youíre not opening the session either.


i opened the session but its still the same.
Was This Post Helpful? 0
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3515
  • View blog
  • Posts: 10,140
  • Joined: 08-June 10

Re: Problems on my sessions

Posted 22 October 2012 - 06:12 AM

that would only influence the setting of session variables.
Was This Post Helpful? 0
  • +
  • -

#6 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: Problems on my sessions

Posted 22 October 2012 - 06:17 AM

View PostDormilich, on 22 October 2012 - 06:12 AM, said:

that would only influence the setting of session variables.



so what do i need to do to fix it?

here's my updated code
Agreement.php
<?php
session_start();
if(isset($_post['sub'])){
$_SESSION['agree'] = 1;
header("Location:donate.php");
}
?>


Donate.php
<?php
session_start();
if($_SESSION['agree']!='1'){
	header("Location:agreement.php");
	}
	?>



Was This Post Helpful? 0
  • +
  • -

#7 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2911
  • View blog
  • Posts: 10,083
  • Joined: 08-August 08

Re: Problems on my sessions

Posted 22 October 2012 - 06:30 AM

Stop! You're trying to run before you can walk!

Start thinking about organizing your code. You can begin to do that using functions.

Other things you need to fix:

  • Avoid using header() unless you're sending the browser away from your site. Include/require works better since the script retains all of its variables.
  • HTML and PHP are processed on different machines and at different times. Put them in different files.

This post has been edited by CTphpnwb: 22 October 2012 - 06:32 AM

Was This Post Helpful? 0
  • +
  • -

#8 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3515
  • View blog
  • Posts: 10,140
  • Joined: 08-June 10

Re: Problems on my sessions

Posted 22 October 2012 - 06:34 AM

are you using IE?
Was This Post Helpful? 0
  • +
  • -

#9 ZevhEr  Icon User is offline

  • New D.I.C Head

Reputation: 9
  • View blog
  • Posts: 38
  • Joined: 18-July 09

Re: Problems on my sessions

Posted 22 October 2012 - 07:59 PM

Use Uppercase in POST

if(isset($_POST['sub'])){
$_SESSION['agree'] = 1;
header("Location:donate.php");
}
?>


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1