Solved

Stop IF Statment

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Move wordpress site 3 38
How would I do a website like this? 5 56
MySql and Apache/PHP Error Reporting 2 26
How would I do this...? 2 28
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses four methods for overlaying images in a container on a web page
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 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 …

776 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