Solved

Stop IF Statment

Posted on 2011-09-18
2
210 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
php mail headers 2 13
Link SQL table to Webpage 9 38
regex expression 9 23
Setting Up Local Lan Web Server 1 18
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

760 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

17 Experts available now in Live!

Get 1:1 Help Now