here is a submition form i made and i know there is a lot of errors with the submit.php because i am brand new to this kind of stuff, but no it does not work, so i need someone smart to please help me fix it
this is the form
HTML Code:
<form method="post" action="submit.php">
<font color="#00ff00">Game Name: </font><input type="text" name="title"><p>
<font color="#00ff00">Game URL: </font><input type="text" name="URL"><p>
<font color="#00ff00">Banner URL (height-68 width-520 EXACT): </font><input type="text" name="banner">
<p>
<font color="#00ff00">Game Information (Tell about your game): </font><input type="text" name="siteinfo"><p>
<input type="submit" name="submit" value="Submit Game">
<input type="reset" value="Reset Form" name="reset">
</form>
here is submit.php (wrong wrong wrong)
please help me with the mistakes i made
PHP Code:
<?php
//find all the posted info and files
$title =$_POST['title'];
$URL =$_POST['URL'];
$banner =$_POST['banner'];
$siteinfo =$_POST['siteinfo'];
$valuefile = "value.txt";
$gamefile = "games.php";
$cho = $_POST['submit'];
//get ready for file changing
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
while($info = mysql_fetch_array( $check )) {
if(isset($cho)) {
if($info['points'] <= 79){
die('You do not have enough points yet! Go back to <a href="topgames.php">Top Games</a>');
};
$fh = fopen($valuefile, 'r');
/* Write game */
$gamestuff = "
<tr>
<td bgcolor=\"black\">
<center>
<font color=red>
<br>
<h2>
".$title."
</h2>
</font>
</center>
</td>
</tr>
<tr>
<td bgcolor=\"black\">
<center>
<h2>
<font color=\"#00ff00\"><a href=\"
".$URL."
\">
<img src=\"
".$banner."
\" border=\"0\">
</a>
</font>
</h2>
</center>
<?php $savefile = \"save"
.$valuefile['1'].
".txt\";
$contentsave = file_get_contents($savefile);
$file = explode(\"|\",$contentsave); ?>
<center>
<font color=\"00ff00\">
#1 - Awesome: <?php echo $file['1']; ?>
<br>
#2 - Ok: <?php echo $file['2']; ?>
<br>
#3 - Terrible: <?php echo $file['3']; ?>
<br>
</font>
</center> <center>
<form action=\"vote.php"
.$valuefile['1'].
"\" method=\"post\">
<font color=\"00ff00\">
#1 - Vote that the game is Awesome: <input type=\"radio\" name=\"choice\" value=\"1\"><br>
#2 - Vote that the game is Ok: <input type=\"radio\" name=\"choice\" value=\"2\">
<br>
#3 - Vote that the game is Terrible: <input type=\"radio\" name=\"choice\" value=\"3\">
<br>
</font>
<input type=\"submit\" value=\"Vote\" name=\"Vote\">
</form>
</center>
<center>
<table width=\"50%\" height=\"100\" cellpadding=7>
<tr>
<td bgcolor=\"#330000\">
<font color=\"00ff00\">"
.$siteinfo.
"</font></td></tr>\r\n";
$handip = fopen($gamefile,"a+");
fwrite($handip, $gamestuff);
fclose($handip);
fclose($valuefile);
//change the value in valuefile
$valuething = fopen($valuefile, "a+");
fwrite($valuething, ++);
fclose($valuething);
/* Change the points to subtract 20 */
$newpoints = $info['points'];
echo "<p>Points before you submitted = " . ($newpoints-80) . "<br>";
echo "Your points after you submitted = " . $newpoints ."<br>";
echo "Submittion complete! <a href=\"topgames.php\">View</a>";
mysql_query("UPDATE users SET points='$newpoints' WHERE points='{$info['points']}'") or die(mysql_error());
}
}
?>
any help is greatly appreciated
Bookmarks