Jump to content

[SOLVED] add code to code


fullyloaded

Recommended Posts

hi

any one know how i can add code 1 to code 2 witch is below?what im trying to do is have a banned email code so when some one signs up it will say the email has been banned i have a table in my database with the list of emails that i want banned its called banned_emails and iin the banned emails table its called banned_email that is where the emails are please help

 

code 1 :

$this->dbu->query("select banned_email from banned_emails where email='".$ld['email']."'");

code 2 :

if(!$ld['email'])
	{
		$ld['error'].="Please fill in the 'Email Address' field."."<br>";
		$is_ok=false;
	}
	elseif(!secure_email($ld['email']))
	{
		$ld['error'].="Please provide a valid email address."."<br>";
		$is_ok=false;
	}
	elseif(!$allowed_email[$ld['email']])
	{
		$this->dbu->query("select members_id from members where email='".$ld['email']."'");

		if($this->dbu->move_next())
		{
			$ld['error'].="This email address is already registered."."<br>";
			$is_ok=false;
		}
	}

Link to comment
Share on other sites

Is this what you want?

 

if(!$ld['email'])
	{
		$ld['error'].="Please fill in the 'Email Address' field."."<br>";
		$is_ok=false;
	}
	elseif(!secure_email($ld['email']))
	{
		$ld['error'].="Please provide a valid email address."."<br>";
		$is_ok=false;
	}
	elseif(!$allowed_email[$ld['email']])
	{
		$this->dbu->query("select members_id from members where email='".$ld['email']."'");

		if($this->dbu->move_next())
		{
			$ld['error'].="This email address is already registered."."<br>";
			$is_ok=false;
		}

		$this->dbu->query("select banned_email from banned_emails where email='".$ld['email']."'");

		if($this->dbu->move_next())
		{
			$ld['error'].="This email address is banned.  Please contact the administrator."."<br>";
			$is_ok=false;
		}
	}

Link to comment
Share on other sites

hi yeah like that but im getting this error any idea why?

Process Halted!
Error:db::query() failed.ERROR MESSAGE IS: Failed to run Query:select banned_email from banned_emails where email='email@email.com' Unknown column 'email' in 'where clause'

 

Unknown column 'email' in 'where clause'

This means that ur database field name is not matching with ur query column.

email will be something other in ur database check it and redo it in ur query.

Link to comment
Share on other sites

hi this is what the table looks like in my database is there any way to make this code work with the table?

 

code :

$this->dbu->query("select banned_email from banned_emails where email='".$ld['email']."'");

if($this->dbu->move_next())

{

$ld['error'].="This email address is banned.  Please contact the administrator."."<br>";

$is_ok=false;

}
}

 

database table :

-- 
-- Table structure for table `banned_emails`
-- 

CREATE TABLE `banned_emails` (
  `banned_emails` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- 
-- Dumping data for table `banned_email`
-- 

INSERT INTO `banned_email` VALUES ('email@email.com');

Link to comment
Share on other sites

hi this is what the table looks like in my database is there any way to make this code work with the table?

 

code :

$this->dbu->query("select banned_email from banned_emails where email='".$ld['email']."'");

if($this->dbu->move_next())

{

$ld['error'].="This email address is banned.  Please contact the administrator."."<br>";

$is_ok=false;

}
}

 

database table :

-- 
-- Table structure for table `banned_emails`
-- 

CREATE TABLE `banned_emails` (
  `banned_emails` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- 
-- Dumping data for table `banned_email`
-- 

INSERT INTO `banned_email` VALUES ('email@email.com');

 

 

$this->dbu->query("select banned_email from banned_emails where banned_emails='".$ld['email']."'");

if($this->dbu->move_next())

{

$ld['error'].="This email address is banned.  Please contact the administrator."."<br>";

$is_ok=false;

}
}

Try this.

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.