Solved

Stop IF Statment

Posted on 2011-09-18
2
211 Views
Last Modified: 2012-05-12
Hello,

I am trying to check to see if people have signed up and if so redirect them to the proper page where they left off.

I am trying to use the code below and I wrote it as I went through the site, so the cookies where setting corrected step by step.

When I clear the cookies I just get an infinite loop.

Can you please tell me how to correct this.

Thank you,
Matt

// Have They Paid?
if(!$_COOKIE['paid'] && ($page_name != 'vendor_membership.php')){
		$iizzr = '1';
		$result = mysql_query("SELECT id FROM memberships WHERE user_id = '".$_SESSION['user_id']."' ") 
		or die(mysql_error());  
		while($row = mysql_fetch_array( $result )) { 	
		$iizzr = '3';
		setcookie("paid", 'yes', time()+13600);		
		}
		if ($iizzr == '1') {
			header ('Location: /vendor_membership.php');
		}
}

// Have They Paid?
 else if(!$_COOKIE['account_info'] && ($page_name != 'vendor_manage_account.php#continue')){
		$iizzr = '1';
		$result = mysql_query("SELECT user_id FROM login_users WHERE user_id = '".$_SESSION['user_id']."' AND co_name IS NOT NULL ") 
		or die(mysql_error());  
		while($row = mysql_fetch_array( $result )) { 	
		$iizzr = '3';
		setcookie("account_info", 'yes', time()+13600);		
		}
		if ($iizzr == '1') {
			header ('Location: /vendor_manage_account.php#continue');
		}
}

// Do They Have Locations?
 else if(!$_COOKIE['location_check_a'] && ($page_name != 'vendor_phys.php')){
		$iizzr = '1';
		$result = mysql_query("SELECT phys_locations FROM login_users WHERE user_id = '".$_SESSION['user_id']."' AND phys_locations IS NOT NULL ") 
		or die(mysql_error());  
		while($row = mysql_fetch_array( $result )) { 	
		$iizzr = '3';
		setcookie("location_check_a", $row['phys_locations'], time()+13600);		
		}
		if ($iizzr == '1') {
			header ('Location: /vendor_phys.php');
		}
}

Open in new window

0
Comment
Question by:movieprodw
2 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 36558460
check this condion before

if( isset( $_COOKIE['paid'] ) )
0
 
LVL 1

Author Closing Comment

by:movieprodw
ID: 36558489
did the trick, thank you
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now