Jump to content

Fatal error: Allowed memory size of 67108864 bytes exhausted??


mfleming

Recommended Posts

Hi.

 

I tried to add some more if statements to check for validation and I'm now getting this error.  The "on line ###" changes depending how many fields are FALSE.

 

 

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 35 bytes) in /home/content/f/u/s/fusionfashion/html/registration.php on line 133

 

I think it has to do with the php.ini file.  So I added the memory_limit in the php.ini file.

 

register_globals = off
allow_url_fopen = off

expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
memory_limit = 128M
post_max_size = 128M
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

[Zend]
zend_extension=/usr/local/zo/ZendExtensionManager.so
zend_extension=/usr/local/zo/4_3/ZendOptimizer.so

 

But I'm still getting the error.  How to I check my php version and this value within a browser? 

<?php phpinfo() ?>

  Found this. 

 

Its showing 64M in LOCAL and MASTER.  But I just updated the local?

Link to comment
Share on other sites

What is wrong with my code?  (The memory errors started happening when I added more IF statements inside the WHILE loop)

 

My Code:

<?
phpinfo();
?>
<?php
session_start();
?>
<?php
$submit = $_POST['submit'];
// Form Data
$firstname = strip_tags($_POST['firstname']);
$lastname = strip_tags($_POST['lastname']);
$address = strip_tags($_POST['address']);
$email = strip_tags($_POST['email']);
$repeatemail = strip_tags($_POST['repeatemail']);
$phone = strip_tags($_POST['phone']);
$salonname = strip_tags($_POST['salonname']);
$salonaddress = strip_tags($_POST['salonaddress']);
$salonprov = strip_tags($_POST['salonprov']);
$salonpostal = strip_tags($_POST['salonpostal']);
$salonconfirm = strip_tags($_POST['salonconfirm']);
$enewsletter = strip_tags($_POST['enewsletter']);
$saloncountry = strip_tags($_POST['saloncountry']);
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$username = strip_tags($_POST['username']);
$date = date("Y-m-d");
// Set e-mail recipient
$myemail = "info@fusionfashionhair.com";

$errormsg['MissAll'] = "Please Enter in ALL Fields!";
$errormsg['ErrFirstName'] = "Please Enter Valid First Name";
$errormsg['ErrLastName'] = "Please Enter Valid Last Name";
$errormsg['ErrAdd'] = "Please Enter Valid Address";
$errormsg['ErrEmail'] = "Please Enter Valid Email";
$errormsg['ErrEmailMatch'] = "Your Email address do not match!";
$errormsg['ErrPhone'] = "Please Enter Valid Phone Number";
$errormsg['ErrPassLngt'] = "Password must be between 6 and 32 characters";
$errormsg['ErrPassMatch'] = "Password do not match!";
$errormsg['ErrSalNam'] = "Please Enter Valid Salon Name";
$errormsg['ErrSalAdd'] = "Please Enter Valid Salon Address";
$errormsg['ErrProv'] = "Please Select Province/State";
$errormsg['ErrPstl'] = "Please Enter Valid Postal/Zip Code";
$errormsg['ErrCntry'] = "Please Select Country";
$errormsg['ErrSalPro'] = "Please Confirm Salon Professional";
$errormsg['ErrSecCode'] = "Please Enter Security Code";
$errormsg['ErrEmailUsed'] = "Email Address already being used. Please us an alternate Email";
$errormsg['PlaceHold'] = "";
$errortrack[] = $errormsg['PlaceHold'];


//echo $_SESSION[key].' - '.$_POST[user_code].'<br>';
if ($_POST[submit]){
if ($errorstop = "go") {
	// loop through if statements until forms completed
	$errorstop="go";
	while ($errorstop<>"stop")
	{


		if ($_SESSION[key]==$_POST[user_code]){
		$_SESSION[key]='';
		} else {
			//echo "False - Stop 0";
			$errortrack[] = $errormsg['ErrSecCode'];
			$errorcount=$errorcount+1;
			$errorstop="stop";
		}


		if (strlen($firstname)>1||strlen($firstname)<26) { 
		$errorstop="go";
			//echo "TRUE";
		} else {
			//echo "False - Stop 0";
			$errortrack[] = $errormsg['ErrFirstName'];
			$errorcount=$errorcount+1;
			$errorstop="stop";
		}		


		if (strlen($lastname)>1||strlen($lastname)<26) { 
		$errorstop="go";
			//echo "TRUE";
		} else {
			//echo "False - Stop 0";
			$errortrack[] = $errormsg['ErrLastName'];
			$errorcount=$errorcount+1;
			$errorstop="stop";
		}				


		if (strlen($address)>1||strlen($address)<26) { 
		$errorstop="go";
			//echo "TRUE";
		} else {
			//echo "False - Stop 0";
			$errortrack[] = $errormsg['ErrAdd'];
			$errorcount=$errorcount+1;
			$errorstop="stop";
		}		

		// Call it with the code below
		$email = trim($_POST['email']);
		if(!checkEmail($email)) {
			// echo 'Invalid email address!';
			$errortrack[] = $errormsg['ErrEmail'];
			$errorstop="stop";
		} else {
			// echo "Email is Valid";
			$errorstop="stop"; //Get out of while loop
		}


		// checks email input match
		if ($email<>$repeatemail) { 
			// echo "<p>Emails do not match!</p>";
			$errortrack[] = $errormsg['ErrEmailMatch'];
			$errorstop="stop";
		} else {
		$errorstop="go";
		}			


		// check phone input match
		if ($phone) { 
			$errortrack[] = $errormsg['ErrPhone'];
			$errorstop="stop";
		} else {
		$errorstop="go";
		}			


		//check password length
		if (strlen($password)>32||strlen($password)<6) {
			// echo '<p class="formecho">Password must be between 6 and 32 characters</p>';
			$errortrack[] = $errormsg['ErrPassLngt'];
			$errorstop="stop";
		} else {
		$errorstop="go";
		} //end of password length check	


		// check password input match
		if ($password<>$repeatpassword) { 
			// echo "<p>Passwords do not match!</p>";
			$errortrack[] = $errormsg['ErrPassMatch'];
			$errorstop="stop";
		} else {
		$errorstop="go";
		// checks email input match
		}


		if (strlen($salonname)>1||strlen($salonname)<26) { 
			$errorstop="go";
			//echo "TRUE";
		} else {
			//echo "False - Stop 0";
			$errortrack[] = $errormsg['ErrSalNam'];
			$errorcount=$errorcount+1;
			$errorstop="stop";
		}							


		if (strlen($salonaddress)>1||strlen($salonaddress)<26) { 
			$errorstop="go";
			//echo "TRUE";
		} else {
			//echo "False - Stop 0";
			$errortrack[] = $errormsg['ErrSalAdd'];
			$errorcount=$errorcount+1;
			$errorstop="stop";
		}		

		// Checks Proper input of Province/State
		if ($salonprov=="Please Select" || $salonprov=="------------") {
			// echo '<p class="formecho">Please Select a Valid Province/State!</p>';
			$errortrack[] = $errormsg['ErrProv'];
			$errorstop="stop";
		} else {
			$errorstop="go";
		}


		if ($salonpostal) { 
			$errorstop="go";
			//echo "TRUE";
		} else {
			//echo "False - Stop 0";
			$errortrack[] = $errormsg['ErrPstl'];
			$errorcount=$errorcount+1;
			$errorstop="stop";
		}					


		// Checks Proper input of Country
		if ($saloncountry=="Please Select") {
			// echo '<p class="formecho">Please Select a Valid Country!</p>';
			$errortrack[] = $errormsg['ErrCntry'];
			$errorstop="stop";
		} else { 
			$errorstop="go";
		}// End checks Country input


		// Checks Proper input Salon Confirmation
		if (isset($_POST['$salonconfirm'])=="1") {
			// echo '<p class="formecho">Please Confirm You are your Salon</p>';
			$errortrack[] = $errormsg['ErrSalPro'];
			$errorstop="stop";
		} else {
			$errorstop="go";
		} // End checks Salon Confirm input



	}//End While Loop


	$errorstop="go";
	include "dbConfig.php";
	// table is mysql table, WHERE FIELD_NAME ='text'" OR =>='10'"; or VAR = '.$variable.')


	// SQL grabs records
	// * means "ALL RECORDS" or use FIELD_NAME, FIELD_NAME2 instead of *
	// $usertable = user where user is the TABLE 
	// use WHERE FIELD_NAME = '$email'  variable
	$SQL = "SELECT email FROM {$usertable} WHERE email = '{$email}' ";

	// mysql_query() is used to send a SQL query to database and returns TRUE or FALSE, or FILE HANDLE if using SELECT
	// $result = mysql_query($SQL); only POINTS to results
	$result = mysql_query($SQL);

	// mysql_fetch_assoc($result) GETS RESULTS from $result
	// assoc or associative array brings keys as text Array['One'] =, Array['Two']= and NOT Array[1]=
	// Place results into $db_field Array		
	$db_field = mysql_fetch_assoc($result);

	if ($result) {
		$db_field = mysql_fetch_assoc($result);
		//echo $db_field['email'] .' '.'has already been used!';
		$errortrack[] = $errormsg['ErrEmailUsed'];
		$errorstop="stop";
	} else {
		$errorstop="go";
		// Thank you Page
		$insertGoTo = "thankyou.php";
		header(sprintf("Location: %s", $insertGoTo));

		// encrypt password
		$temppass = $password;
		$password = md5($password);
		$repeatpassword = md5($repeatpassword);

		// dBase file
		include "dbConfig.php";
		//open database
		//generate random number for activation process
		$random = md5(rand(23456789,987654321));


		// register the user!
		// Set default username
		$username = $email;

		// INSERT INTO user...  replace user with table name
		// make sure you have the same number and order of values as the database has
		$queryreg = mysql_query("

		INSERT INTO user VALUES ('','$firstname','$lastname','$username','$password','$date','$email','$phone','$address','$salonname','$salonaddress','$salonprov','$salonpostal','$saloncountry','$salonconfirm','$enewsletter','$random','0')");

		//Insert ID based on last ID in database
		$lastid = mysql_insert_id();

		//send activation email
		$to = $email;  //Change to $myemail to send activation to webmaster
		$subject = "Activate Salon Member Acctount at Fusion Fashion Hair";
		$headers = "From:  webmaster@fusionfashionhair.com";
		$server = "mail.fusionfashionhair.com";

		//change php.ini and set SMTP to $server
		ini_set("SMTP",$server);


		$body = "

		$firstname $lastname from $salonname is wanting a membership, \n\n

		Please click on the link provided below to activate the account with Fusion Fashion Hair
		http://www.fusionfashionhair.com/activate.php?id=$lastid&code=$random \n\n

		Username = $username \n



		Thank you,

		Customer Service
		";

		//function to send email
		mail($to, $subject, $body, $headers);



	} //End if Result


 // End check for existance
} else {
// echo '<p class="formecho">Please fill in <b>ALL</b> fields!</p>';
$errortrack[] = $errormsg['MissAll'];
$errorstop="stop";
} //End if GO check


}// End if Sumbit
?>
<?php

// LINUX PLATFORM OPTION 3

// checkEmail function checks standard email format same as preg_match()
// checkEmail function checks DSN records using checkdnsrr  Use list() to seperate name and domain using split function
// checkdnsrr ONLY WORKS on LINUX PLATFORM
// Check to see if domain and username is active
// uses fsockopen() to check if its in use using port 25
function checkEmail($email) {
// checks proper syntax
if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)) {

	// gets domain name
	list($username,$domain)=split('@',$email);
	// checks for if MX records in the DNS
	if(!checkdnsrr($domain, 'MX')) {
		return false;
	}
	return true;
}
return false;
}
?>
<?php

function checkStringText($str) {
// checks proper syntax
//if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $firstname)) {


//Removes white space, null, tabs, new lines from both sides
trim($str);
// Strips HTML Tags
strip_tags($str);
if(preg_match('^[0-9]+:/[\s|\n|\t|*|@|&|/',$str)) {
	echo "special char found!";
}
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.