Troublesome request

Started by denede, February 09, 2014, 11:25:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

denede

#6
**

denede

#5
*FIXED*

Makee72

Quote from: denede on February 10, 2014, 09:19:42 AM
With your version, from what I am seeing I need to insert the req id... :)
Works fine, I think I can get used to add request id instead of a dropdown box. Btw, do you have modified torrenttable_functions also ? So that the torrent requested should have a request tag and when people click on it to be redirected to the request details page?
I have put the details page like this:
$request = mysql_query("SELECT id,request FROM requests WHERE torrentid=$id");
$subrow2 = mysql_fetch_array($request);
$coun2t = $subrow2[0];
if ($coun2t)
$requ = "link to request: <a class='altlink' href='viewrequests.php?id={$subrow2['id']}&req_details'><b>{$subrow2['request']}</b></a>";


and
if ($coun2t)
$HTMLOUT .="<tr><td class='heading' align='right'>request:</td><td width='99%' align='left'>" . $requ . "
</td></tr>";

denede

#3
With your version, from what I am seeing I need to insert the req id... :)
Works fine, I think I can get used to add request id instead of a dropdown box. Btw, do you have modified torrenttable_functions also ? So that the torrent requested should have a request tag and when people click on it to be redirected to the request details page?

Makee72

#2
I have put it this way,SQL:
ALTER TABLE torrents ADD 'reqid' int(11) unsigned NOT NULL DEFAULT '0';

upload.php
$HTMLOUT .= "<tr>
        <td class='heading' valign='top' align='right'>request:</td><td valign='top' align='left'><input type='text' size='8' name='reqid' value='' /></td>
      </tr>";

takeupload.php
$reqid = unesc($_POST['reqid']);
if ($reqid > 0 ) {
$res = mysql_query("SELECT id FROM requests WHERE id = $reqid") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
if (!$arr)
    stderr("Error", "No requests thats ID: $reqid");
}

and big query reqid and $reqid

and then on the bottom of the page marked desire to be fulfilled, and that comes from the message notification

if ($reqid > 1 ){
$res = mysql_query("SELECT users.username, requests.userid, requests.torrentid, requests.palkkio, requests.request FROM requests inner join users on requests.userid = users.id where requests.id = $reqid") or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res);
if ($CURUSER['id'] == $arr['userid'])
    stderr("{$lang['error_error']}", "{$lang['error_own_id']}");

$msg = "{$lang['filled_your']}[b]".htmlspecialchars($arr['request'])."[/b]{$lang['filled_by']}.{$lang['filled_dl']}[b][url=details.php?id=".$id."]".$TBDEV['baseurl']."/details.php?id=".$id."[/url][/b] {$lang['filled_thx']}{$lang['filled_wrong']}";
mysql_query("UPDATE requests SET torrentid = ".$id.", filledby = $CURUSER[id] WHERE id = $reqid") or sqlerr(__FILE__, __LINE__);
mysql_query("INSERT INTO messages (poster, sender, receiver, added, msg, subject, location) VALUES(0, 0, $arr[userid], ".TIME_NOW.", ".sqlesc($msg).", 'request filled', 1)") or sqlerr(__FILE__, __LINE__);
$res = mysql_query("SELECT `userid` FROM `voted_requests` WHERE `requestid` = $reqid AND userid != $arr[userid]") or sqlerr(__FILE__, __LINE__);

$msgs_buffer = array();

if (mysql_num_rows($res) > 0) {
   
    $pn_subject = sqlesc("{$lang['add_request']} ".$arr['request']."{$lang['filled_upl']}");
     $pn_msg     = sqlesc("{$lang['filled_voted']}[b]".$arr['request']."[/b]{$lang['filled_by']}[b]{$lang['filled_dl']}
    [url=details.php?id=".$id."]".$TBDEV['baseurl']."/details.php?id=".$id."[/url][/b].
      {$lang['filled_thx']}");

    while ($row = mysql_fetch_assoc($res))
        $msgs_buffer[]= '(0, '.$row['userid'].', '.TIME_NOW.', '.$pn_msg.', '.$pn_subject.')';

    $pn_count = count($msgs_buffer);
        if ($pn_count > 0) {
            mysql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES ".implode(', ',$msgs_buffer)) or sqlerr(__FILE__,__LINE__);
            //write_log('[Request Filled Messaged '.$pn_count.' members');
        }
    unset ($msgs_buffer);
}
mysql_free_result($res);

}

and edit this:
$lang = array_merge( load_language('global'), load_language('takeupload') );
like this:
$lang = array_merge( load_language('global'), load_language('takeupload'), load_language('requests'));

denede

I am trying to do a little modification so that when torrents are in the requests section I could select them from upload page so that the job to fill a request would be easier. I managed to make them appear in the dropdown box from upload page. But after I upload torrent with the selected request, it isn't getting filled.
I added this to sql:

ALTER TABLE torrents ADD 'request' int(10) unsigned NOT NULL DEFAULT '0';

and in takeupload.php I have
$request = (((isset($_POST['request']) && is_valid_id($_POST['request'])) ? intval($_POST['request']) : 0)); and added request and $request to the big query