Jump to content


Photo

Parse error...ob_start???


  • Please log in to reply
10 replies to this topic

#1 steelmanronald06

steelmanronald06
  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 12 September 2006 - 10:45 PM

Lines 122-153:

<?php		// Start output buffering
		ob_start()
		
		echo "The following error occured:<br />";
		
		//See which of the two, if not both, is already in use
		if($email_check > 0) {
			
			echo "The email address, $email_address , is already in our database!<br />";
			
			unset($email_address);
		}
		if($username_check > 0) {
			
			echo "The username, $username , is already in our database!<br />";
			
		}
		echo "Please fix the above errors!";
		
		//Show bottom layout
		require_once('../includes/bot.php');
		
		//Reload to the form
		header("Location:  /users/register.php");
		
		//Flush ouput buffering
		ob_flush();
		
		//Exit the script
		exit();
		
	}?>
*enclosed in php tags for the color effect :)

Error generated:

Parse error: parse error, unexpected T_ECHO in C:\wamp\www\lampgeekz\users\register.php on line 125



#2 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 12 September 2006 - 10:54 PM

No semi-colon after ob_start()
I'm considered good looking in some countries

#3 steelmanronald06

steelmanronald06
  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 12 September 2006 - 10:55 PM

Line 258 - 278:

<?php 	//Ensure Their Account Was Activated
	$sql_doublecheck = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$code' AND activated='1'");
	$doublecheck = mysql_num_rows($sql_doublecheck);
	
	if($doublecheck == 0){
		echo "<strong><font color=red>Your account could not be activated!</font></strong>";
		
		//Include the bottom layout
		require_once('../includes/bot.php');
		
		//Exit the script
		exit();
	} elseif ($doublecheck > 0) {
		echo "<strong>Your account has been activated!</strong> You may now login!<br />";
		
		//Include the bottom layout
		require_once('../includes/bot.php')
		
		//Exit the script
		exit();
	} ?>

error:

Parse error: parse error, unexpected T_EXIT in C:\wamp\www\lampgeekz\users\register.php on line 277



#4 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 12 September 2006 - 10:59 PM

Once again, no semi-colon

require_once('../includes/bot.php')
I'm considered good looking in some countries

#5 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 12 September 2006 - 10:59 PM

Been programming too long today?
I'm considered good looking in some countries

#6 steelmanronald06

steelmanronald06
  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 12 September 2006 - 11:00 PM

haha! yes. I wrote that script in 1 hour. there is a total of 286 lines! It is all one big switch! :(

#7 steelmanronald06

steelmanronald06
  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 12 September 2006 - 11:08 PM

hahaha!

<?php 	//Set the variables from the url
	$username = $_REQUEST['id'];
	$code = $_REQUEST['code'];
	
	//Update their information to activated
	$sql = mysql_query("UPDATE users SET activated='1' WHERE username='$username' AND password='$code'") or die (mysql_error());
	
	//Set their Private Message Inbox to activated
	$sql2 = mysql_query("UPDATE users_pm_allow SET activated='1' WHERE username='$username'");
	
	//Ensure Their Account Was Activated
	$sql_doublecheck = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$code' AND activated='1'");
	$doublecheck = mysql_num_rows($sql_doublecheck);
	
	if($doublecheck == 0){
		echo "<strong><font color=red>Your account could not be activated!</font></strong>";
		
		//Include the bottom layout
		require_once('../includes/bot.php');
		
		//Exit the script
		exit();
	} elseif ($doublecheck > 0) {
		echo "<strong>Your account has been activated!</strong> You may now login!<br />";
		
		//Include the bottom layout
		require_once('../includes/bot.php');
		
		//Exit the script
		exit();
	} ?>

guess what I get?

Your account could not be activated!


No other error but my custom error is returned, and when I echo $username and $code it shows what it should, by matching it to the phpmyadmin entry.  so my question, why is it not activating?  It isn't updating the row :'(

#8 steelmanronald06

steelmanronald06
  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 12 September 2006 - 11:09 PM

so just checked something else!

see where there is that second update query for the users_pm_allow? that one works!  so it is just the one that isn't working  :o

#9 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 12 September 2006 - 11:11 PM

I would personally check to see what $doublecheck is coming back with.  Use the die() function there after your query.  I don't know what you're set up like but it seems as if you're posting the right information and still getting the error, you're probably not getting the right info returned from your query.  This is why I use Adodb because it does my debugging for me = )
I'm considered good looking in some countries

#10 steelmanronald06

steelmanronald06
  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 12 September 2006 - 11:26 PM

wow! i don't know what i was doing, but it works now! thanks for the help gijew and neylitalo (im moral support).

#11 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 12 September 2006 - 11:29 PM

Ha, good luck and happy coding!
I'm considered good looking in some countries




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users