Jump to content

2 errors


3raser

Recommended Posts

<?php

//to
$to = $_POST['to'];

//from
$from = $_POST['from'];

//message
$message = $_POST['message'];

//subject
$subject = $_POST['subject']; 

//this is so people can disallow emails to them
$add_to_ignore = $_POST['ignore'];


  if($add_to_ignore)
{
	//make sure the $add_to_ignore variable is safe
	$ignore_email = mysql_real_escape_string($add_to_ignore);

	//add it to the ignore list
	mysql_query("INSERT INTO ignored VALUES ('', '$ignore_email', '$ignore_email')");

	echo "The email ". $add_to_ignore ." has been ignored. <a href='index.php'>Back</a>";
}
elseif(!$message || !$to || !$message || !$subject)
{	
	echo "If you wish to block an email, which means no one can send a message from or to your email address, type in the email: <form action='index.php' method='POST'>
	<input type='text' maxlength='150' name='ignore'><input type='submit' value='Block'></form>
	<br><br><form action='index.php' method='POST'>Email from: <input type='text' name='from' maxlength='45'><br>Email to: <input type='text' name='to' maxlength='45'><br>Subject: <input type='text' name='subject' maxlength='60'>
	<br><br><textarea name='message' maxlength='1000' cols='50' rows='20'></textarea><br/><input type='submit'></form>";
}
else
{
  //banned words
	REMOVED FOR PHPFREAKS DUE TO BAD WORDS

	//filtered words
	$output = str_replace($bad_text, "*", $message);

	//spacing
	$output_final = str_replace("\n.", "\n..", $output);

	//code to check if email is on ignore list
	$check_ignored = mysql_query("SELECT COUNT(id) FROM ignored WHERE to='$to' OR from='$from'");
	$check_it = mysql_fetch_array($check_ignored);

	//check if it is blocked or not
	if(!$check_it)
	{ 
		//footer message
		$footer_message = "This message has been sent by <a href='http://emailpranker.netai.net/'>Email Pranker</a> - If you wish to add your email to the ignore list, just click <a href='#'>here</a>.";
		$output = $output.$message;

		mail($to, $subject, $output, "From: ". $from ."");
		echo "The message has been sent to ". $to ."!";
	}
	else
	{
		echo "The owner of this email has put their email on the ignore list. We no longer allow emails to be sent to their address or sent from their address via our prank email form. <a href='index.php'>Back</a>";
	}
}

?>

 

Why do I receive the following error when I submit an email:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5275546/public_html/index.php on line 61

 

And how do I make it so my <a href=''> link actually works in the email? The link works, but when you read the email it would be like this <a href=''>LINK</a>, so how do I do it?

Link to comment
https://forums.phpfreaks.com/topic/207492-2-errors/
Share on other sites

mebbe something with this line $check_it = mysql_fetch_array($check_ignored); and

if(!$check_it)

{

 

you are fetching something in a array right? shound there not be somethin like  $check_it['$check_ignored'];? im not sure just guessing

 

I switched to that, but it still gives an error.

Link to comment
https://forums.phpfreaks.com/topic/207492-2-errors/#findComment-1084808
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.