I am new with php and here is a simple guessbook page but I am being hit with spam from a group of the same email. I know I need to do an IF statement but I am kinda foggy on how to do the code.
What I want to do is make an file that has email address that I want to block and code to call it up to make sure the people that are signing it is not one of the spamers.
Here is my code for the page. Just need help on where to nest the code to call up the blocked email to stop them from posting.
Also if any one knows how to disable html coding from being displayed as well would be helpful.
Code: [Select]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Feed Back</title>
<? include "data/head.php"; ?>
<body>
<center>
<table width="700" border=".01" cellspacing="0" cellpadding="0">
<tr>
<td height="182" align="center" valign="bottom">
<P ALIGN=CENTER><P ALIGN=CENTER><IMG SRC="Images/title/feedback2.gif" NAME="graphics10" ALT="About Me" ALIGN=BOTTOM WIDTH=500 HEIGHT=100 BORDER=0>
</p>
<?php include "data/menu.php"; ?>
</td></tr>
<tr>
<td height="1050" align="left" valign="top">
<center><h2>Feedback Form</h2></center>
<p>Share your feedback with me.</p>
<form method="post" action="feedback.php">
<label for="firstname">First name:</label>
<input type="text" name="firstname" /><br />
<label for="lastname">Last name:</label>
<input type="text" name="lastname" /><br />
<label for="email">What is your email address?</label>
<input type="text" name="email" /> Required<br />
<label for="like">Do you like my website, if no please tell me why?</label>
Yes <input name="like" type="radio" value="does" />
No <input name="like" type="radio" value="does not" /><br />
<label for="message">Your Feed Back</label>
<textarea rows="8" cols="40" wrap="virtual" name="message"></textarea><br />
<input type="submit" value="Submit Feedback" name="submit" />
</form>
<br />
<?php
$first_name = $_POST['firstname'];
$last_name = $_POST['lastname'];
$email = $_POST['email'];
$like = $_POST['like'];
$message = $_POST['message'];
$dbc = mysqli_connect('172.23.50.3', 'username', 'password', 'website')
or die('Error connecting to MySQL server.');
if (!empty($email)) {
$query = "INSERT INTO feedback (first_name, last_name, email, `like`, message) " .
"VALUES ('$first_name', '$last_name', '$email', '$like', '$message')";
$result = mysqli_query($dbc, $query)
or die('Error querying database.');
}
else {
}
// Retrieve data base
$query = "SELECT * FROM feedback" ;
$data = mysqli_query($dbc, $query);
// Loop through the array of payment data
while ($row = mysqli_fetch_array($data)) {
// Display the payment data
echo '<strong>' .$row['last_name'] . ' ' . $row['first_name'] . '</strong><br />' ;
echo 'This person ' . $row['like'] . ' like this site. <br />';
echo '<strong>What this person had to say:</strong>' . '<br />';
echo $row['message'] . '<br />';
echo '<br />' ;
}
mysqli_close($dbc);
?>
</td>
</tr>
<tr>
<td colspan="2" height="280"valign="top"><p align="center">
<?php include "data/footer.php";?>
</td>
</tr>
</table>
</body>
</html>
Thanks
mysql_real_escape_string making variable equal nothing
i post a form and i post the variable:Code: $var = $_POST[variable];then i echo $var its what i submitted the variable to be. then i add the mysql_real_escape_string() function to itspell it correctly
Why is the logic of this simple code not working?
Hey, I'm trying to determine if a table already exists in mysql, but doing a query first with mysql_query, then checking $sql as if it a were TRUE of FALSE. Which I though it would be. My Code
db entry based on primary key
My "topics" table contains 10 entires*--------------*topicid topic------*--------------* 01 Bye 02 Hi 03 Hello..... 10 Morning*--------------*<?php
ldap connection
We are using ldap to get user information from the domain controller. It was working before. Recently I found the application is hanging at ldap_connect. It doesn't return any message. i am not sure
Creating a unique 'control panel' for each user
Hi there,I'm thinking of designing a site that will allow users to sign up and have their own unique 'control panel'.I just need some pointers on the logic behind this design, specifically:How can I
Syntax Help
I'm trying to make a form that edits a php file which contains config settings. I'm using strings that are defined by the user form inputs. This is what my file should look like when the form is
Help on Order Entry Form/System Where is best to begin.
I have a dilema and a very short amount of time at this point and I'm looking for some help on deciding where would be best to begin or which is the best way to approach the problem.The company I work
problem with GROUP BY and ORDER BY
i usually use this query to display the last 10 entries from a sql table:Code: $query = "SELECT search_time, search_keywords FROM phpbb_popsearch ORDER BY search_time DESC limit 35"; as you
Using real time in php
I'm very average at PHP and im looking to introduce time to something on my site.Its a sports site and everyone has fixtures. I have them so they are created and put into a table, what I now want to
Why use OOP?
Can someone explain to me why I should use OOP instead of procedure based code.Im building a shopping cart and i created and Item object already and using it to hold data for each item. But this