Solved

Stop IF Statment

Posted on 2011-09-18
2
214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

752 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