<?
$password = "temp";
if (empty($SESSION['inputpass'])) {$SESSION['inputpass'] = $POST['inputpass'];}
$pass = $SESSION['inputpass'];
if ($pass == $password)
{
switch($action)
{
case "color":
break;
case "bio":
break;
case "links":
break;
case "addpic":
echo "<form name='dbinserter' method='post' action='$PHP_SELF?link=admin&action=addpic'>
<input type='hidden' name='inserted' value='1'>
<table>
<tr>
<td><b><center>Picture Location:</center></b></td>
<td><b><center>Picture Caption:</center></b></td>
</tr>
<tr>
<td><input type='text' name='pictureinsert'></td>
<td><input type='text' name='altinsert'></td>
</tr>
</table>
<input type='submit' value='Add'>
</form>";
$query = mysql_query("SELECT * FROM pic_locations", $db);
echo "<table>
<tr>
<td><center><b>Index:</b></center></b></td>
<td><center><b>Picture Location:</b></center></b></td>
<td><center><b>Picture Caption:</b></center></b></td>
</tr>";
if ($array = mysql_fetch_array($query))
{
do {
$dbindex = $array['index'];
$dbpicture = $array['picture'];
$dbalt = $array['alt'];
echo "<form name='dbchanger' method='post' action='$PHP_SELF?link=admin&action=addpic'>
<input type='hidden' name='changed' value='1'>
<input type='hidden' name='index' value='".$dbindex."'>";
echo "<tr>
<td><center>".$dbindex."</center></td>
<td><input type='text' name='picturechange' value='".$dbpicture."'></td>
<td><input type='text' name='altchange' value='".$dbalt."'></td>
<td><input type='submit' value='Update'></td>
</tr>
</form>";
}
while($array = mysql_fetch_array($query));
echo "</table>";
}
if ($changed == "1")
{
mysql_query('UPDATE `pic_locations` SET `picture` = "$picturechange", alt = "$altchange" WHERE `index` = "$index"', $db) or die(mysql_error());
echo $picturechange." ".$altchange." ".$index."<br>";
echo "Picture Database Change Succesful";
}
if ($inserted == "1")
{
mysql_query("INSERT INTO pic_locations (picture, alt) VALUES ('$pictureinsert', '$altinsert')", $db) or die(mysql_error());
echo "Picture Addition Succesful";
}
break;
default:
break;
}
echo "<form name='actionform' method='post' action='$PHP_SELF?link=admin'>
<select name='action'>
<option value='addpic'>Add Picture</option>
<option value='color'>Change Colors</option>
<option value='bio'>Change Bio</option>
<option value='links'>Change Links</options>
</select>
<input type='submit' value='Go'>";
}
else
{
$_SESSION['inputpass'] = NULL;
echo "<form name='password' method='post' action='$PHP_SELF?link=admin'><b>Password:</b><input type='password' name='inputpass'> <input type='submit' value='Submit'></form>";
}
?>
Theres the code, here's the problem. When I try and UPDATE the SQL database, for some reason it won't submit it. It gives me no errors, it says it has updated, but I recheck the database and nothing has changed. PLEASE HELP!!!!