function link_web($update_id)
{
    global $settings;
    deleteupdatedfile($update_id);
    $filetype = type_suffix(extractfilename($_POST['linkurl']));
    $filename = stripsuffix(extractfilename($_POST['linkurl']));
    $fileatts = remote_fileatts($_POST['linkurl']);
    //big question: are we just updating or creating a new file?
    if (!$update_id) {
        //insert a new row to the database and fill it with some nice data
        $dosql = "INSERT INTO {$GLOBALS['prefix']}lb_postings\n         (author_id, title, posted, filelocal, audio_size, audio_length, audio_type, audio_file, status)\n         VALUES\n         (\n         '{$_SESSION['authorid']}',\n         '{$filename}',\n         '" . date('Y-m-d H:i:s') . "', '0',\n         '" . $fileatts['size'] . "', '" . $fileatts['length'] . "',\n         '{$filetype}',\n         '{$_POST['linkurl']}',\n         '1'\n         );";
        $result = mysql_query($dosql) or die(mysql_error());
        //if the parser gets until here, all should be good
        echo "<p class=\"msg\">Successfully linked. Fight content-stealing!</p>";
    } else {
        //update an existing row in the database
        $dosql = "UPDATE {$GLOBALS['prefix']}lb_postings SET\n\n         author_id = '{$_SESSION['authorid']}',\n         filelocal = '0',  \n         audio_file= '" . $_POST['linkurl'] . "',\n         audio_size= '" . $fileatts['size'] . "',\n         audio_length= '" . $fileatts['length'] . "',\n         audio_type= '" . $filetype . "' \n         \n         WHERE id = '" . $update_id . "';";
        $result = mysql_query($dosql) or die(mysql_error());
    }
    //get id for editing data after finishing this function
    $dosql = "SELECT id FROM {$GLOBALS['prefix']}lb_postings \n          WHERE audio_file='" . $_POST['linkurl'] . "';";
    $result = mysql_query($dosql) or die(mysql_error());
    $row = mysql_fetch_assoc($result);
    return $row['id'];
}
Ejemplo n.º 2
0
function link_web($update_id)
{
    global $settings;
    deleteupdatedfile($update_id);
    $filetype = type_suffix($_POST['linkurl']);
    $filename = stripsuffix(extractfilename($_POST['linkurl']));
    $fileatts = remote_fileatts($_POST['linkurl']);
    //big question: are we just updating or creating a new file?
    if (!$update_id) {
        //insert a new row to the database and fill it with some nice data
        $dosql = "INSERT INTO {$GLOBALS['prefix']}lb_postings\n         (author_id, title, posted, filelocal, audio_size, audio_length, \n         audio_type, audio_file, status, \n         countweb, countfla, countpod, countall)\n         VALUES\n         (\n         '{$_SESSION['authorid']}',\n         '" . $filename . "',\n         '" . date('Y-m-d H:i:s') . "', '0',\n         '" . $fileatts['size'] . "', '" . $fileatts['length'] . "',\n         '{$filetype}',\n         '" . urldecode($_POST['linkurl']) . "',\n         '1','0','0','0','0'\n         )";
        $GLOBALS['lbdata']->Execute($dosql);
        //if the parser gets until here, all should be good
        echo "<p class=\"msg\">" . bla("msg_linksuccess") . "</p>";
    } else {
        //update an existing row in the database
        $dosql = "UPDATE {$GLOBALS['prefix']}lb_postings SET\n\n         author_id = '{$_SESSION['authorid']}',\n         filelocal = '0',  \n         audio_file = '" . urldecode($_POST['linkurl']) . "',\n         audio_size = '" . $fileatts['size'] . "',\n         audio_length = '" . $fileatts['length'] . "',\n         audio_type = '" . $filetype . "' \n         \n         WHERE id = '" . $update_id . "'";
        $GLOBALS['lbdata']->Execute($dosql);
    }
    //get id for editing data after finishing this function
    $dosql = "SELECT id FROM {$GLOBALS['prefix']}lb_postings \n          WHERE audio_file = '" . urldecode($_POST['linkurl']) . "'";
    $row = $GLOBALS['lbdata']->GetArray($dosql);
    return $row[0]['id'];
}