Creative Insanity, on Sep 1 2007, 03:31 AM, said:
Still didn't work.. bugger.
What was the error? Plus the if(($first)&&($second)) is missed out, that bit is to check that both inserts were successful.
May I ask what this bit of code is for, as it only looks like a header redirect to me:
$insertGoTo = "track_upload.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
*Edit: Some of the inserts have wrong names, like $act_cat: $acat = $_POST['act_cat']; the name used to insert it into the database would be $acat.
---
None of the inserts are secure, use htmlspecialchars() on them
$genre = htmlspecialchars($_POST['genre']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add_track")) {
$acat = $_POST['act_cat'];
$action = $_POST['action'];
$datee = $_POST['datee'];
$tname = $_POST['name'];
$tfile = $_POST['file'];
$img = $_POST['img'];
$genre = $_POST['genre'];
$txt = $_POST['txt'];
$cat = $_POST['cat'];
$first = mysql_query("INSERT INTO music (tname, tfile, img, genre, txt, cat) VALUES ('$name', '$file', '$img', $genre, '$txt', '$cat')") or die(mysql_error());
$first = mysql_query("INSERT INTO actions (acat, action, datee) VALUES ('$acat', '$action', $datee)") or die(mysql_error());
if(($first)&&($second))
{
$insertGoTo = "track_upload.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
Edited by stingerblue, 01 September 2007 - 10:56 AM.