I am very new to php. I have been writing a vote program for a website I work on. Here's the url
http://www.tfmatrix.com/stormrider/vote/gobot/vote.htm
Well I posted this form on our private board for error testing. One of the guys on there was able to add stuff into my table on view votes totals page.
He said while he was on the 2nd page,
http://www.tfmatrix.com/stormrider/vote/gobot/gbaddvote.php
that he simply added ?vote=tester
onto the end of that url to add that into the table.
My question is this how do I prevent him from doing this?!?!?!?
Here is the code I have for this page.
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#006666" link="#FFFFFF">
<?
$vote=
if ($vote == "") {
$vote_err = "<font color=white size=5><center><b>You did not enter a Selection. Please return to the vote form and try again.</b></center></font><br>";
$send = "no";
}
if ($send != "no") {
$db_name="dbname";
$table_name="tablename";
$connection = mysql_connect("localhost", "dbname", "password") or
die("Couldn't connect.");
$db= mysql_select_db($db_name, $connection) or die ("Couldn't Select database.");
$sql = "
insert into $table_name
(vote)
values
(\"$vote\")
";
$result= mysql_query($sql, $connection) or die ("Couldn't execute query.");
echo "<div align=\"center\">
<p><font size=\"6\" color=\"#CCCC00\">Your vote for $vote </font></p>
<p><font size=\"6\" color=\"#CCCC00\">has been recorded.</font></p>";
} else if ($send == "no") {
echo "$vote_err";
echo "<a href=\"vote.htm\"><font color=white size=5><center><b>Back to Vote Form</b></center></font></a>";
}
?>
<p> </p>
<p> </p>
<table width="75%" border="0" align="center">
<tr>
<td>
<div align="center"><font color="#CCCC00"><b><font color="#FFFFFF"><a href="http://www.transfandom.com">Return
to home page</a></font></b></font></div>
</td>
<td>
<div align="center"><font color="#CCCC00"><b><font color="#FFFFFF"><a href="viewgbtots.php">View
vote totals</a></font></b></font></div>
</td>
</tr>
</table>
<p> </p>
</body>
Can anyone help me?
--stormie