Solved

Stop IF Statment

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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 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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

820 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